From bb77ac983e4f8a265141855e60ad2a5637c9b74d Mon Sep 17 00:00:00 2001 From: Jose Maria Casanova Crespo Date: Wed, 8 May 2024 22:11:01 +0200 Subject: [PATCH] v3dv: Increase alignment to 16k on CL BO on RPi5 We increase the alignment to 16k for BOs allocated for the CL on RPi5 HW. So we have the same ratio of usable space because of HW readahead as than on RPi4, as readahead has been increased from 256 to 1024 bytes on RPi5. We have also concluded that when the kernel is running with 16k pages that is the default on Raspberry Pi 5 HW, BO allocations are aligned to 16k so this increase has no cost and we would be using memory more efficiently. Reviewed-by: Iago Toral Quiroga cc: mesa-stable Part-of: --- src/broadcom/vulkan/v3dvx_cl.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/broadcom/vulkan/v3dvx_cl.c b/src/broadcom/vulkan/v3dvx_cl.c index 8f5ea94a745..62b982566ae 100644 --- a/src/broadcom/vulkan/v3dvx_cl.c +++ b/src/broadcom/vulkan/v3dvx_cl.c @@ -32,9 +32,11 @@ */ #if V3D_VERSION == 42 #define V3D_CLE_READAHEAD 256 +#define V3D_CLE_BUFFER_MIN_SIZE 4096 #endif #if V3D_VERSION >= 71 #define V3D_CLE_READAHEAD 1024 +#define V3D_CLE_BUFFER_MIN_SIZE 16384 #endif void @@ -94,7 +96,7 @@ cl_alloc_bo(struct v3dv_cl *cl, uint32_t space, enum * of allocations with large command buffers. This has a very significant * impact on the number of draw calls per second reported by vkoverhead. */ - space = align(space + unusable_space, 4096); + space = align(space + unusable_space, V3D_CLE_BUFFER_MIN_SIZE); if (cl->bo) space = MAX2(cl->bo->size * 2, space);