v3d: 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 <itoral@igalia.com>
cc: mesa-stable

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/29023>
This commit is contained in:
Jose Maria Casanova Crespo 2024-05-08 22:10:29 +02:00 committed by Marge Bot
parent 26c8a5cd72
commit e2c624e74e

View file

@ -34,9 +34,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
@ -59,7 +61,9 @@ v3d_cl_ensure_space(struct v3d_cl *cl, uint32_t space, uint32_t alignment)
}
v3d_bo_unreference(&cl->bo);
cl->bo = v3d_bo_alloc(cl->job->v3d->screen, align(space, 4096), "CL");
cl->bo = v3d_bo_alloc(cl->job->v3d->screen,
align(space, V3D_CLE_BUFFER_MIN_SIZE),
"CL");
cl->base = v3d_bo_map(cl->bo);
cl->size = cl->bo->size;
cl->next = cl->base;
@ -82,7 +86,9 @@ v3d_cl_ensure_space_with_branch(struct v3d_cl *cl, uint32_t space)
*/
uint32_t unusable_size = V3D_CLE_READAHEAD + cl_packet_length(BRANCH);
struct v3d_bo *new_bo = v3d_bo_alloc(cl->job->v3d->screen,
space + unusable_size, "CL");
align(space + unusable_size,
V3D_CLE_BUFFER_MIN_SIZE),
"CL");
assert(space + unusable_size <= new_bo->size);
/* Chain to the new BO from the old one. */