All of lore.kernel.org
 help / color / mirror / Atom feed
From: Thomas Zimmermann <tzimmermann@suse.de>
To: jfalempe@redhat.com, airlied@redhat.com
Cc: dri-devel@lists.freedesktop.org, Thomas Zimmermann <tzimmermann@suse.de>
Subject: [PATCH v2 6/7] drm/ast: Remove vram_fb_available from struct ast_device
Date: Wed,  5 Mar 2025 17:30:45 +0100	[thread overview]
Message-ID: <20250305163207.267650-7-tzimmermann@suse.de> (raw)
In-Reply-To: <20250305163207.267650-1-tzimmermann@suse.de>

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.

v2:
- initialize plane size

Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
---
 drivers/gpu/drm/ast/ast_cursor.c | 18 ++++--------------
 drivers/gpu/drm/ast/ast_drv.h    |  4 ----
 drivers/gpu/drm/ast/ast_mm.c     |  1 -
 3 files changed, 4 insertions(+), 19 deletions(-)

diff --git a/drivers/gpu/drm/ast/ast_cursor.c b/drivers/gpu/drm/ast/ast_cursor.c
index 05e297f30b4e..cb0c48d47207 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
@@ -289,25 +290,16 @@ int ast_cursor_plane_init(struct ast_device *ast)
 	struct ast_cursor_plane *ast_cursor_plane = &ast->cursor_plane;
 	struct ast_plane *ast_plane = &ast_cursor_plane->base;
 	struct drm_plane *cursor_plane = &ast_plane->base;
-	size_t size;
+	unsigned long size;
 	void __iomem *vaddr;
 	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);
-
-	if (ast->vram_fb_available < size)
-		return -ENOMEM;
-
-	vaddr = ast->vram + ast->vram_fb_available - size;
+	size = ast_cursor_vram_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 +312,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;
 }
-- 
2.48.1


  parent reply	other threads:[~2025-03-05 16:35 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-03-05 16:30 [PATCH v2 0/7] drm/ast: Various changes for video memory Thomas Zimmermann
2025-03-05 16:30 ` [PATCH v2 1/7] drm/ast: Replace AST_VIDMEM_SIZE_ with Linux SZ_ constants Thomas Zimmermann
2025-03-11 13:06   ` Jocelyn Falempe
2025-03-05 16:30 ` [PATCH v2 2/7] drm/ast: Add VGACRAA register constants Thomas Zimmermann
2025-03-11 13:07   ` Jocelyn Falempe
2025-03-05 16:30 ` [PATCH v2 3/7] drm/ast: Add VGACR99 " Thomas Zimmermann
2025-03-11 13:07   ` Jocelyn Falempe
2025-03-05 16:30 ` [PATCH v2 4/7] drm/ast: cursor: Add helpers for computing location in video memory Thomas Zimmermann
2025-03-11 13:07   ` Jocelyn Falempe
2025-03-05 16:30 ` [PATCH v2 5/7] drm/ast: Add helper for computing framebuffer " Thomas Zimmermann
2025-03-11 13:08   ` Jocelyn Falempe
2025-03-05 16:30 ` Thomas Zimmermann [this message]
2025-03-11 13:08   ` [PATCH v2 6/7] drm/ast: Remove vram_fb_available from struct ast_device Jocelyn Falempe
2025-03-05 16:30 ` [PATCH v2 7/7] drm/ast: cursor: Drop page alignment Thomas Zimmermann
2025-03-11 13:10   ` Jocelyn Falempe
2025-03-11 16:07     ` Thomas Zimmermann

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20250305163207.267650-7-tzimmermann@suse.de \
    --to=tzimmermann@suse.de \
    --cc=airlied@redhat.com \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=jfalempe@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.