From a81063d2ca39c2ce01dc0fb7e6b0587906ae255c Mon Sep 17 00:00:00 2001 From: Iago Toral Quiroga Date: Tue, 24 Jan 2023 08:24:49 +0100 Subject: [PATCH] v3dv: ensure we allocate at least the requested space for a CL While we are already ensuring we allocate at least 8192 bytes should this not be the first allocation and our allocations are typically just a few bytes, multilayered framebuffers with large numbers of layers may require more space than that in a single allocation. Fixes: 3325950648 ('v3dv: increase BO allocation size when growing CLs') Reviewed-by: Eric Engestrom Part-of: --- src/broadcom/vulkan/v3dv_cl.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/broadcom/vulkan/v3dv_cl.c b/src/broadcom/vulkan/v3dv_cl.c index 62e6144e7ec..fab9b05ec48 100644 --- a/src/broadcom/vulkan/v3dv_cl.c +++ b/src/broadcom/vulkan/v3dv_cl.c @@ -62,7 +62,10 @@ cl_alloc_bo(struct v3dv_cl *cl, uint32_t space, bool use_branch) * of allocations with large command buffers. This has a very significant * impact on the number of draw calls per second reported by vkoverhead. */ - space = cl->bo ? cl->bo->size * 2 : align(space, 4096); + space = align(space, 4096); + if (cl->bo) + space = MAX2(cl->bo->size * 2, space); + struct v3dv_bo *bo = v3dv_bo_alloc(cl->job->device, space, "CL", true); if (!bo) { fprintf(stderr, "failed to allocate memory for command list\n");