From 6ed0fd23b84d8621a8c7005f5a17799de387272e Mon Sep 17 00:00:00 2001 From: Guangliu Ding Date: Thu, 28 Nov 2024 10:30:03 +0800 Subject: [PATCH] LF-13727 [#ccc] fix Bytes alignment issue of gpu video memory node Meet split failure of video memory node when running gfxbench gles for a long time on 8QXP, leading to GPU dump. Move Bytes alignment to ensure to find a video memory node with sufficient memory to avoid split failure. Signed-off-by: Guangliu Ding Acked-by: Jason Liu --- .../mxc/gpu-viv/hal/kernel/gc_hal_kernel_video_memory.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/drivers/mxc/gpu-viv/hal/kernel/gc_hal_kernel_video_memory.c b/drivers/mxc/gpu-viv/hal/kernel/gc_hal_kernel_video_memory.c index 1e85a2486d30..076edf540f63 100644 --- a/drivers/mxc/gpu-viv/hal/kernel/gc_hal_kernel_video_memory.c +++ b/drivers/mxc/gpu-viv/hal/kernel/gc_hal_kernel_video_memory.c @@ -893,6 +893,11 @@ gckVIDMEM_AllocateLinear(IN gckKERNEL Kernel, IN gckVIDMEM Memory, } } #endif + if (Alignment > 0) { + /* Ensure the size is aligned */ + Bytes = gcmALIGN(Bytes, Alignment); + } + if (Bytes > Memory->freeBytes) { /* Not enough memory. */ status = gcvSTATUS_OUT_OF_MEMORY; @@ -951,9 +956,6 @@ gckVIDMEM_AllocateLinear(IN gckKERNEL Kernel, IN gckVIDMEM Memory, /* Do we have an alignment? */ if (alignment > 0) { - /* Ensure the size is aligned */ - Bytes = gcmALIGN(Bytes, alignment); - /* Split the node so it is aligned. */ if (_Split(Memory->os, node, alignment)) { /* Successful split, move to aligned node. */