From patchwork Wed Sep 18 14:23:00 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Thomas Zimmermann X-Patchwork-Id: 11150451 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id E69511745 for ; Wed, 18 Sep 2019 14:23:20 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id CF34721920 for ; Wed, 18 Sep 2019 14:23:20 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org CF34721920 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=suse.de Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=dri-devel-bounces@lists.freedesktop.org Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 6C0316F3B8; Wed, 18 Sep 2019 14:23:16 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mx1.suse.de (mx2.suse.de [195.135.220.15]) by gabe.freedesktop.org (Postfix) with ESMTPS id 4DEFC6F3BC for ; Wed, 18 Sep 2019 14:23:14 +0000 (UTC) X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay2.suse.de (unknown [195.135.220.254]) by mx1.suse.de (Postfix) with ESMTP id 052FEB676; Wed, 18 Sep 2019 14:23:11 +0000 (UTC) From: Thomas Zimmermann To: airlied@linux.ie, daniel@ffwll.ch, kraxel@redhat.com, sam@ravnborg.org, yc_chen@aspeedtech.com, corbet@lwn.net Subject: [PATCH 04/11] drm/ast: Reserve space for double-buffered cursor image Date: Wed, 18 Sep 2019 16:23:00 +0200 Message-Id: <20190918142307.27127-5-tzimmermann@suse.de> X-Mailer: git-send-email 2.23.0 In-Reply-To: <20190918142307.27127-1-tzimmermann@suse.de> References: <20190918142307.27127-1-tzimmermann@suse.de> MIME-Version: 1.0 X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Thomas Zimmermann , dri-devel@lists.freedesktop.org, linux-doc@vger.kernel.org Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" 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 --- 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);