Module: Mesa
Branch: main
Commit: b39815fa9c1937458d0fd05d4fb6129b410dc7e9
URL:    
http://cgit.freedesktop.org/mesa/mesa/commit/?id=b39815fa9c1937458d0fd05d4fb6129b410dc7e9

Author: Mike Blumenkrantz <[email protected]>
Date:   Wed Jul 26 16:20:50 2023 -0400

lavapipe: statically allocate fb attachment array

Reviewed-by: Dave Airlie <[email protected]>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24339>

---

 src/gallium/frontends/lavapipe/lvp_execute.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/src/gallium/frontends/lavapipe/lvp_execute.c 
b/src/gallium/frontends/lavapipe/lvp_execute.c
index 51e02f4ed02..6733a2dadab 100644
--- a/src/gallium/frontends/lavapipe/lvp_execute.c
+++ b/src/gallium/frontends/lavapipe/lvp_execute.c
@@ -164,7 +164,7 @@ struct rendering_state {
    bool suspending;
    bool render_cond;
    uint32_t color_att_count;
-   struct lvp_render_attachment *color_att;
+   struct lvp_render_attachment color_att[PIPE_MAX_COLOR_BUFS];
    struct lvp_render_attachment depth_att;
    struct lvp_render_attachment stencil_att;
    struct lvp_image_view *ds_imgv;
@@ -1713,7 +1713,6 @@ handle_begin_rendering(struct vk_cmd_queue_entry *cmd,
    state->framebuffer.nr_cbufs = info->colorAttachmentCount;
 
    state->color_att_count = info->colorAttachmentCount;
-   state->color_att = realloc(state->color_att, sizeof(*state->color_att) * 
state->color_att_count);
    for (unsigned i = 0; i < info->colorAttachmentCount; i++) {
       render_att_init(&state->color_att[i], &info->pColorAttachments[i], 
state->poison_mem, false);
       if (state->color_att[i].imgv) {
@@ -4613,7 +4612,6 @@ VkResult lvp_execute_cmds(struct lvp_device *device,
    for (unsigned i = 0; i < ARRAY_SIZE(state->desc_buffers); i++)
       pipe_resource_reference(&state->desc_buffers[i], NULL);
 
-   free(state->color_att);
    return VK_SUCCESS;
 }
 

Reply via email to