v3dv: centralize limit macros in v3dv_limits.h

Move limit/max macros from v3dv_private.h and v3dv_uniforms.c
to v3dv_limits.h

Reviewed-by: Juan A. Suarez <jasuarez@igalia.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/38732>
This commit is contained in:
Daivik Bhatia 2025-12-02 06:06:35 +05:30 committed by Marge Bot
parent e9c3d42ad5
commit 0b4398134c
4 changed files with 29 additions and 23 deletions

View file

@ -31,7 +31,7 @@
#include <stdbool.h>
#include <stdint.h>
#include "v3dv_limits.h"
#ifdef v3dX
# include "broadcom/cle/v3dx_pack.h"

View file

@ -23,6 +23,8 @@
#ifndef V3DV_LIMITS_H
#define V3DV_LIMITS_H
#include "drm-uapi/v3d_drm.h"
/* From vulkan spec "If the multiple viewports feature is not enabled,
* scissorCount must be 1", ditto for viewportCount. For now we don't support
* that feature.
@ -55,6 +57,31 @@
#define V3DV_SUPPORTED_SHADER_STAGES 4
#define V3DV_MAX_PLANE_COUNT 3
/* Minimum required by the Vulkan 1.1 spec */
#define MAX_MEMORY_ALLOCATION_SIZE (1ull << 30)
/* Maximum performance counters number */
#define V3D_MAX_PERFCNT 93
/* Number of perfmons required to handle all supported performance counters */
#define V3DV_MAX_PERFMONS DIV_ROUND_UP(V3D_MAX_PERFCNT, \
DRM_V3D_MAX_PERF_COUNTERS)
#define MAX_STAGES 3
#define MAX_TOTAL_TEXTURE_SAMPLERS (V3D_MAX_TEXTURE_SAMPLERS * MAX_STAGES)
/* This tracks state BOs for both textures and samplers, so we
* multiply by 2.
*/
#define MAX_TOTAL_STATES (2 * V3D_MAX_TEXTURE_SAMPLERS * MAX_STAGES)
#define MAX_TOTAL_UNIFORM_BUFFERS ((MAX_UNIFORM_BUFFERS + \
MAX_INLINE_UNIFORM_BUFFERS) * MAX_STAGES)
#define MAX_TOTAL_STORAGE_BUFFERS (MAX_STORAGE_BUFFERS * MAX_STAGES)
/* These are tunable parameters in the HW design, but all the V3D
* implementations agree.
*/

View file

@ -120,12 +120,6 @@ struct v3dv_format_plane;
struct v3dv_format;
struct v3d_simulator_file;
/* Minimum required by the Vulkan 1.1 spec */
#define MAX_MEMORY_ALLOCATION_SIZE (1ull << 30)
/* Maximum performance counters number */
#define V3D_MAX_PERFCNT 93
struct v3dv_physical_device {
struct vk_physical_device vk;
@ -619,8 +613,6 @@ struct v3dv_device_memory {
#define V3D_OUTPUT_IMAGE_FORMAT_NO 255
#define TEXTURE_DATA_FORMAT_NO 255
#define V3DV_MAX_PLANE_COUNT 3
/* Note that although VkImageAspectFlags would allow to combine more than one
* PLANE bit, for all the use cases we implement that use VkImageAspectFlags,
* only one plane is allowed, like for example vkCmdCopyImage:
@ -1130,10 +1122,6 @@ struct v3dv_timestamp_query_cpu_job_info {
uint32_t count;
};
/* Number of perfmons required to handle all supported performance counters */
#define V3DV_MAX_PERFMONS DIV_ROUND_UP(V3D_MAX_PERFCNT, \
DRM_V3D_MAX_PERF_COUNTERS)
struct v3dv_perf_query {
uint32_t kperfmon_ids[V3DV_MAX_PERFMONS];

View file

@ -26,30 +26,21 @@
*/
#include "v3dv_private.h"
#include "v3dv_limits.h"
/* Our Vulkan resource indices represent indices in descriptor maps which
* include all shader stages, so we need to size the arrays below
* accordingly. For now we only support a maximum of 3 stages: VS, GS, FS.
*/
#define MAX_STAGES 3
#define MAX_TOTAL_TEXTURE_SAMPLERS (V3D_MAX_TEXTURE_SAMPLERS * MAX_STAGES)
struct texture_bo_list {
struct v3dv_bo *tex[MAX_TOTAL_TEXTURE_SAMPLERS];
};
/* This tracks state BOs for both textures and samplers, so we
* multiply by 2.
*/
#define MAX_TOTAL_STATES (2 * V3D_MAX_TEXTURE_SAMPLERS * MAX_STAGES)
struct state_bo_list {
uint32_t count;
struct v3dv_bo *states[MAX_TOTAL_STATES];
};
#define MAX_TOTAL_UNIFORM_BUFFERS ((MAX_UNIFORM_BUFFERS + \
MAX_INLINE_UNIFORM_BUFFERS) * MAX_STAGES)
#define MAX_TOTAL_STORAGE_BUFFERS (MAX_STORAGE_BUFFERS * MAX_STAGES)
struct buffer_bo_list {
struct v3dv_bo *ubo[MAX_TOTAL_UNIFORM_BUFFERS];
struct v3dv_bo *ssbo[MAX_TOTAL_STORAGE_BUFFERS];