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 <eric@igalia.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/20871>
This commit is contained in:
Iago Toral Quiroga
2023-01-24 08:24:49 +01:00
committed by Marge Bot
parent 0c6e56c391
commit a81063d2ca

View File

@@ -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");