From 115fe1ba22b673f33ecae2fa3d79ed96c9ab35ef 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: (cherry picked from commit bb77ac983e4f8a265141855e60ad2a5637c9b74d) --- .pick_status.json | 2 +- src/broadcom/vulkan/v3dvx_cl.c | 4 +++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/.pick_status.json b/.pick_status.json index c4b419fd812..db85b083cb2 100644 --- a/.pick_status.json +++ b/.pick_status.json @@ -3704,7 +3704,7 @@ "description": "v3dv: Increase alignment to 16k on CL BO on RPi5", "nominated": true, "nomination_type": 0, - "resolution": 0, + "resolution": 1, "main_sha": null, "because_sha": null, "notes": null diff --git a/src/broadcom/vulkan/v3dvx_cl.c b/src/broadcom/vulkan/v3dvx_cl.c index 3bb1d6ac48c..470fc2d9814 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);