[PATCH 6/7] drm/ast: Remove vram_fb_available from struct ast_device

Thomas Zimmermann tzimmermann at suse.de
Wed Mar 5 13:57:04 UTC 2025



Am 05.03.25 um 14:35 schrieb Thomas Zimmermann:
> Helpers compute the offset and size of the available framebuffer
> memory. Remove the obsolete field vram_fb_available from struct
> ast_device. Also define the cursor-signature size next to its only
> user.
>
> Signed-off-by: Thomas Zimmermann <tzimmermann at suse.de>
> ---
>   drivers/gpu/drm/ast/ast_cursor.c | 15 ++-------------
>   drivers/gpu/drm/ast/ast_drv.h    |  4 ----
>   drivers/gpu/drm/ast/ast_mm.c     |  1 -
>   3 files changed, 2 insertions(+), 18 deletions(-)
>
> diff --git a/drivers/gpu/drm/ast/ast_cursor.c b/drivers/gpu/drm/ast/ast_cursor.c
> index 05e297f30b4e..f48207a45359 100644
> --- a/drivers/gpu/drm/ast/ast_cursor.c
> +++ b/drivers/gpu/drm/ast/ast_cursor.c
> @@ -37,6 +37,7 @@
>    */
>   
>   /* define for signature structure */
> +#define AST_HWC_SIGNATURE_SIZE		SZ_32
>   #define AST_HWC_SIGNATURE_CHECKSUM	0x00
>   #define AST_HWC_SIGNATURE_SizeX		0x04
>   #define AST_HWC_SIGNATURE_SizeY		0x08
> @@ -294,20 +295,10 @@ int ast_cursor_plane_init(struct ast_device *ast)
>   	long offset;
>   	int ret;
>   
> -	/*
> -	 * Allocate backing storage for cursors. The BOs are permanently
> -	 * pinned to the top end of the VRAM.
> -	 */
> -
> -	size = roundup(AST_HWC_SIZE + AST_HWC_SIGNATURE_SIZE, PAGE_SIZE);

There's a bug here, as size if now uninitialized. will be fixed in the 
next iteration.

> -
> -	if (ast->vram_fb_available < size)
> -		return -ENOMEM;
> -
> -	vaddr = ast->vram + ast->vram_fb_available - size;
>   	offset = ast_cursor_vram_offset(ast);
>   	if (offset < 0)
>   		return offset;
> +	vaddr = ast->vram + offset;
>   
>   	ret = ast_plane_init(dev, ast_plane, vaddr, offset, size,
>   			     0x01, &ast_cursor_plane_funcs,
> @@ -320,7 +311,5 @@ int ast_cursor_plane_init(struct ast_device *ast)
>   	drm_plane_helper_add(cursor_plane, &ast_cursor_plane_helper_funcs);
>   	drm_plane_enable_fb_damage_clips(cursor_plane);
>   
> -	ast->vram_fb_available -= size;
> -
>   	return 0;
>   }
> diff --git a/drivers/gpu/drm/ast/ast_drv.h b/drivers/gpu/drm/ast/ast_drv.h
> index ec9ec77260e9..d9da2328d46b 100644
> --- a/drivers/gpu/drm/ast/ast_drv.h
> +++ b/drivers/gpu/drm/ast/ast_drv.h
> @@ -112,12 +112,9 @@ enum ast_config_mode {
>   
>   #define AST_MAX_HWC_WIDTH	64
>   #define AST_MAX_HWC_HEIGHT	64
> -
>   #define AST_HWC_PITCH		(AST_MAX_HWC_WIDTH * SZ_2)
>   #define AST_HWC_SIZE		(AST_MAX_HWC_HEIGHT * AST_HWC_PITCH)
>   
> -#define AST_HWC_SIGNATURE_SIZE	32
> -
>   /*
>    * Planes
>    */
> @@ -183,7 +180,6 @@ struct ast_device {
>   	void __iomem	*vram;
>   	unsigned long	vram_base;
>   	unsigned long	vram_size;
> -	unsigned long	vram_fb_available;
>   
>   	struct mutex modeset_lock; /* Protects access to modeset I/O registers in ioregs */
>   
> diff --git a/drivers/gpu/drm/ast/ast_mm.c b/drivers/gpu/drm/ast/ast_mm.c
> index 3d03ef556d0a..0bc140319464 100644
> --- a/drivers/gpu/drm/ast/ast_mm.c
> +++ b/drivers/gpu/drm/ast/ast_mm.c
> @@ -92,7 +92,6 @@ int ast_mm_init(struct ast_device *ast)
>   
>   	ast->vram_base = base;
>   	ast->vram_size = vram_size;
> -	ast->vram_fb_available = vram_size;
>   
>   	return 0;
>   }

-- 
--
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)



More information about the dri-devel mailing list