From patchwork Thu Jul 25 17:19:31 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Thomas Zimmermann X-Patchwork-Id: 11059371 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 7FBAF746 for ; Thu, 25 Jul 2019 17:19:52 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 62A8B28A14 for ; Thu, 25 Jul 2019 17:19:52 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 56FF928A16; Thu, 25 Jul 2019 17:19:52 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.2 required=2.0 tests=BAYES_00,MAILING_LIST_MULTI, RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 171A228A14 for ; Thu, 25 Jul 2019 17:19:52 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id EACF66E7DB; Thu, 25 Jul 2019 17:19:44 +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 1FB9D6E7D8 for ; Thu, 25 Jul 2019 17:19:37 +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 62CF2AFE2; Thu, 25 Jul 2019 17:19:35 +0000 (UTC) From: Thomas Zimmermann To: daniel@ffwll.ch, kraxel@redhat.com, sam@ravnborg.org, airlied@redhat.com, yc_chen@aspeedtech.com, Christian.Koenig@amd.com Subject: [PATCH v2 2/3] drm/ast: Use drm_gem_vram_{vmap, vunmap}() to map cursor source BO Date: Thu, 25 Jul 2019 19:19:31 +0200 Message-Id: <20190725171932.31189-3-tzimmermann@suse.de> X-Mailer: git-send-email 2.22.0 In-Reply-To: <20190725171932.31189-1-tzimmermann@suse.de> References: <20190725171932.31189-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 Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" X-Virus-Scanned: ClamAV using ClamSMTP The VRAM helper's vmap interfaces provide pinning and mapping of BO memory. This patch replaces the respective code in ast cursor handling. Signed-off-by: Thomas Zimmermann --- drivers/gpu/drm/ast/ast_mode.c | 21 +++++++-------------- 1 file changed, 7 insertions(+), 14 deletions(-) diff --git a/drivers/gpu/drm/ast/ast_mode.c b/drivers/gpu/drm/ast/ast_mode.c index c792362024a5..6e9434175c46 100644 --- a/drivers/gpu/drm/ast/ast_mode.c +++ b/drivers/gpu/drm/ast/ast_mode.c @@ -1176,26 +1176,22 @@ static int ast_cursor_set(struct drm_crtc *crtc, return -ENOENT; } gbo = drm_gem_vram_of_gem(obj); - - ret = drm_gem_vram_pin(gbo, 0); - if (ret) - goto err_drm_gem_object_put_unlocked; - src = drm_gem_vram_kmap(gbo, true, NULL); + src = drm_gem_vram_vmap(gbo); if (IS_ERR(src)) { ret = PTR_ERR(src); - goto err_drm_gem_vram_unpin; + goto err_drm_gem_object_put_unlocked; } dst = drm_gem_vram_kmap(drm_gem_vram_of_gem(ast->cursor_cache), false, NULL); if (IS_ERR(dst)) { ret = PTR_ERR(dst); - goto err_drm_gem_vram_kunmap; + goto err_drm_gem_vram_vunmap; } dst_gpu = drm_gem_vram_offset(drm_gem_vram_of_gem(ast->cursor_cache)); if (dst_gpu < 0) { ret = (int)dst_gpu; - goto err_drm_gem_vram_kunmap; + goto err_drm_gem_vram_vunmap; } dst += (AST_HWC_SIZE + AST_HWC_SIGNATURE_SIZE)*ast->next_cursor; @@ -1230,16 +1226,13 @@ static int ast_cursor_set(struct drm_crtc *crtc, ast_show_cursor(crtc); - drm_gem_vram_kunmap(gbo); - drm_gem_vram_unpin(gbo); + drm_gem_vram_vunmap(gbo, src); drm_gem_object_put_unlocked(obj); return 0; -err_drm_gem_vram_kunmap: - drm_gem_vram_kunmap(gbo); -err_drm_gem_vram_unpin: - drm_gem_vram_unpin(gbo); +err_drm_gem_vram_vunmap: + drm_gem_vram_vunmap(gbo, src); err_drm_gem_object_put_unlocked: drm_gem_object_put_unlocked(obj); return ret;