Hi
Am 11.03.25 um 14:10 schrieb Jocelyn Falempe:
On 05/03/2025 17:30, Thomas Zimmermann wrote:
The cursor scanout address requires alignment to a multiple of 8,
but does not require page alignment. Change the offset calculation
accordingly. Frees up a few more bytes for the primary framebuffer.
The framebuffer is page aligned, so I'm not sure you can use the extra
bytes.
The GEM buffer located in system ram is page aligned, so that mmap works
as expected. But the scanout buffer in VRAM doesn't have to be as we
don't ever mmap that to user space. The cursor scanout address only
requires an alignment of 8. The damage handling only copies visible
bytes, hence we don't accidentally overwrite cursor bytes when we copy
the primary plane. So this should all be fine.
The driver likely requires an improved version of
ast_mode_config_mode_valid() to really use these extra bytes. I've been
working on this a bit.
I think this might not make much of a difference on most machines, but
there are lowest-of-the-low-end systems with only 4 MiB of VRAM
available. Maybe there's a case where those additional bytes will be useful.
Otherwise, it looks good to me.
Reviewed-by: Jocelyn Falempe <jfalempe@xxxxxxxxxx>
Thanks for reviewing, BTW
Best regards
Thomas
Signed-off-by: Thomas Zimmermann <tzimmermann@xxxxxxx>
---
drivers/gpu/drm/ast/ast_cursor.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/gpu/drm/ast/ast_cursor.c
b/drivers/gpu/drm/ast/ast_cursor.c
index cb0c48d47207..5ee724bfd682 100644
--- a/drivers/gpu/drm/ast/ast_cursor.c
+++ b/drivers/gpu/drm/ast/ast_cursor.c
@@ -58,7 +58,7 @@ long ast_cursor_vram_offset(struct ast_device *ast)
if (size > ast->vram_size)
return -EINVAL;
- return PAGE_ALIGN_DOWN(ast->vram_size - size);
+ return ALIGN_DOWN(ast->vram_size - size, SZ_8);
}
static u32 ast_cursor_calculate_checksum(const void *src,
unsigned int width, unsigned int height)
--
--
Thomas Zimmermann
Graphics Driver Developer
SUSE Software Solutions Germany GmbH
Frankenstrasse 146, 90461 Nuernberg, Germany
GF: Ivo Totev, Andrew Myers, Andrew McDonald, Boudien Moerman
HRB 36809 (AG Nuernberg)