diff --git a/src/broadcom/common/v3d_device_info.c b/src/broadcom/common/v3d_device_info.c index 9228f4b6955..f18a998bf42 100644 --- a/src/broadcom/common/v3d_device_info.c +++ b/src/broadcom/common/v3d_device_info.c @@ -27,6 +27,7 @@ #include #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: diff --git a/src/broadcom/common/v3d_device_info.h b/src/broadcom/common/v3d_device_info.h index 362078314fe..c56fbc9d3ee 100644 --- a/src/broadcom/common/v3d_device_info.h +++ b/src/broadcom/common/v3d_device_info.h @@ -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 diff --git a/src/broadcom/vulkan/v3dv_device.c b/src/broadcom/vulkan/v3dv_device.c index 5d6b7333bbc..93918642a7d 100644 --- a/src/broadcom/vulkan/v3dv_device.c +++ b/src/broadcom/vulkan/v3dv_device.c @@ -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; diff --git a/src/broadcom/vulkan/v3dv_meta_clear.c b/src/broadcom/vulkan/v3dv_meta_clear.c index 83a2409ab72..802246a672b 100644 --- a/src/broadcom/vulkan/v3dv_meta_clear.c +++ b/src/broadcom/vulkan/v3dv_meta_clear.c @@ -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; diff --git a/src/broadcom/vulkan/v3dv_pipeline.c b/src/broadcom/vulkan/v3dv_pipeline.c index cb91254d876..b953d137dbc 100644 --- a/src/broadcom/vulkan/v3dv_pipeline.c +++ b/src/broadcom/vulkan/v3dv_pipeline.c @@ -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; diff --git a/src/broadcom/vulkan/v3dvx_cmd_buffer.c b/src/broadcom/vulkan/v3dvx_cmd_buffer.c index 6200afd5394..2b374b99b02 100644 --- a/src/broadcom/vulkan/v3dvx_cmd_buffer.c +++ b/src/broadcom/vulkan/v3dvx_cmd_buffer.c @@ -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) + diff --git a/src/gallium/drivers/v3d/v3d_screen.c b/src/gallium/drivers/v3d/v3d_screen.c index c93ce33e7a1..3a09b05c65c 100644 --- a/src/gallium/drivers/v3d/v3d_screen.c +++ b/src/gallium/drivers/v3d/v3d_screen.c @@ -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; diff --git a/src/gallium/drivers/v3d/v3dx_emit.c b/src/gallium/drivers/v3d/v3dx_emit.c index e498319c4c3..bd111bd521c 100644 --- a/src/gallium/drivers/v3d/v3dx_emit.c +++ b/src/gallium/drivers/v3d/v3dx_emit.c @@ -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;