[PATCH 04/11] drm/ast: Reserve space for double-buffered cursor image

Thomas Zimmermann tzimmermann at suse.de
Wed Sep 18 14:23:00 UTC 2019


With the patch, we reserve 2x 16 KiB at the high end of video memory,
with each frame aligned to an 8-byte boundary. The remaining memory is
available for GEM VRAM buffer objects.

Signed-off-by: Thomas Zimmermann <tzimmermann at suse.de>
---
 drivers/gpu/drm/ast/ast_ttm.c | 13 ++++++++++---
 1 file changed, 10 insertions(+), 3 deletions(-)

diff --git a/drivers/gpu/drm/ast/ast_ttm.c b/drivers/gpu/drm/ast/ast_ttm.c
index fad34106083a..8e6a1d8917d0 100644
--- a/drivers/gpu/drm/ast/ast_ttm.c
+++ b/drivers/gpu/drm/ast/ast_ttm.c
@@ -35,13 +35,20 @@
 
 int ast_mm_init(struct ast_private *ast)
 {
+	unsigned long cursor_size;
 	struct drm_vram_mm *vmm;
 	int ret;
 	struct drm_device *dev = ast->dev;
 
-	vmm = drm_vram_helper_alloc_mm(
-		dev, pci_resource_start(dev->pdev, 0),
-		ast->vram_size);
+	/* At the high end of video memory, we reserve space for
+	 * two cursor images. The cursor plane uses this memory to
+	 * store a double-buffered image of the current cursor.
+	 */
+	cursor_size = roundup((AST_HWC_SIZE + AST_HWC_SIGNATURE_SIZE),
+			      PAGE_SIZE) * AST_DEFAULT_HWC_NUM;
+
+	vmm = drm_vram_helper_alloc_mm(dev, pci_resource_start(dev->pdev, 0),
+				       ast->vram_size - cursor_size);
 	if (IS_ERR(vmm)) {
 		ret = PTR_ERR(vmm);
 		DRM_ERROR("Error initializing VRAM MM; %d\n", ret);
-- 
2.23.0



More information about the dri-devel mailing list