broadcom: add and use max_render_targets to devinfo

Use the new devinfo value instead the V3D_MAX_RENDER_TARGETS
macro.

We only maintain the usage of the macro in devinfo initialization
and the V3D in the versioned file src/gallium/drivers/v3d/v3dx_state.c

Reviewed-by: Iago Toral Quiroga <itoral@igalia.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/42117>
This commit is contained in:
Jose Maria Casanova Crespo 2026-05-29 16:33:02 +02:00 committed by Marge Bot
parent f21a95f890
commit 5242d4c171
8 changed files with 16 additions and 8 deletions

View file

@ -27,6 +27,7 @@
#include <string.h>
#include "common/v3d_device_info.h"
#include "common/v3d_limits.h"
#include "drm-uapi/v3d_drm.h"
#include "util/log.h"
#include "util/os_misc.h"
@ -78,6 +79,7 @@ v3d_get_device_info(int fd, struct v3d_device_info* devinfo, v3d_ioctl_fun drm_i
os_get_page_size(&os_page_size);
assert(os_page_size <= UINT32_MAX);
devinfo->page_size = (uint32_t)os_page_size;
devinfo->max_render_targets = V3D_MAX_RENDER_TARGETS(devinfo->ver);
switch (devinfo->ver) {
case 42:

View file

@ -72,6 +72,12 @@ struct v3d_device_info {
/** OS page size. It's the minimum allocation size for a v3d buffer. */
uint32_t page_size;
/** Maximum framebuffer dimension is limited by max clip size */
uint32_t max_framebuffer_size;
/** Max render targets the GPU supports */
uint8_t max_render_targets;
};
/* TFU has a 64-bytes readhead. To avoid the unit reading unmaped memory

View file

@ -916,7 +916,7 @@ get_device_properties(const struct v3dv_physical_device *device,
const VkSampleCountFlags supported_sample_counts =
VK_SAMPLE_COUNT_1_BIT | VK_SAMPLE_COUNT_4_BIT;
const uint8_t max_rts = V3D_MAX_RENDER_TARGETS(device->devinfo.ver);
const uint8_t max_rts = device->devinfo.max_render_targets;
struct timespec clock_res;
clock_getres(CLOCK_MONOTONIC, &clock_res);
@ -3005,7 +3005,7 @@ v3dv_setup_dynamic_framebuffer(struct v3dv_cmd_buffer *cmd_buffer,
* MSAA resolves.
*/
const uint32_t max_attachments =
2 * (V3D_MAX_RENDER_TARGETS(device->devinfo.ver) + 1);
2 * device->devinfo.max_render_targets + 1;
const uint32_t attachments_alloc_size =
sizeof(struct v3dv_image_view *) * max_attachments;

View file

@ -1238,7 +1238,7 @@ v3dv_CmdClearAttachments(VkCommandBuffer commandBuffer,
/* We can have at most max_color_RTs + 1 D/S attachments */
assert(attachmentCount <=
V3D_MAX_RENDER_TARGETS(cmd_buffer->device->devinfo.ver) + 1);
cmd_buffer->device->devinfo.max_render_targets + 1);
/* We can only clear attachments in the current subpass */
struct v3dv_render_pass *pass = cmd_buffer->state.pass;

View file

@ -2913,7 +2913,7 @@ pipeline_init_dynamic_state(struct v3dv_device *device,
}
v3dv_dyn->color_write_enable =
(1ull << (4 * V3D_MAX_RENDER_TARGETS(device->devinfo.ver))) - 1;
(1ull << (4 * device->devinfo.max_render_targets)) - 1;
if (pipeline_state->cb) {
const uint8_t color_writes = pipeline_state->cb->color_write_enables;
v3dv_dyn->color_write_enable = 0;

View file

@ -1633,7 +1633,7 @@ v3dX(cmd_buffer_emit_blend)(struct v3dv_cmd_buffer *cmd_buffer)
return;
const struct v3d_device_info *devinfo = &cmd_buffer->device->devinfo;
const uint32_t max_color_rts = V3D_MAX_RENDER_TARGETS(devinfo->ver);
const uint32_t max_color_rts = devinfo->max_render_targets;
const uint32_t blend_packets_size =
cl_packet_length(BLEND_ENABLES) +

View file

@ -329,7 +329,7 @@ v3d_init_screen_caps(struct v3d_screen *screen)
caps->max_texture_3d_levels = V3D_MAX_MIP_LEVELS;
caps->max_texture_array_layers = V3D_MAX_ARRAY_LAYERS;
caps->max_render_targets = V3D_MAX_RENDER_TARGETS(screen->devinfo.ver);
caps->max_render_targets = screen->devinfo.max_render_targets;
caps->fbfetch = caps->max_render_targets;
caps->fbfetch_coherent = true;
caps->max_dual_source_render_targets = 1;

View file

@ -531,7 +531,7 @@ v3dX(emit_state)(struct pipe_context *pctx)
}
const uint32_t max_rts =
V3D_MAX_RENDER_TARGETS(v3d->screen->devinfo.ver);
v3d->screen->devinfo.max_render_targets;
if (blend->base.independent_blend_enable) {
for (int i = 0; i < max_rts; i++)
emit_rt_blend(v3d, job, &blend->base, i,
@ -572,7 +572,7 @@ v3dX(emit_state)(struct pipe_context *pctx)
struct pipe_blend_state *blend = &v3d->blend->base;
const uint32_t max_rts =
V3D_MAX_RENDER_TARGETS(v3d->screen->devinfo.ver);
v3d->screen->devinfo.max_render_targets;
cl_emit(&job->bcl, COLOR_WRITE_MASKS, mask) {
for (int i = 0; i < max_rts; i++) {
int rt = blend->independent_blend_enable ? i : 0;