From patchwork Fri Mar 30 14:11:28 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Daniel Stone X-Patchwork-Id: 10317765 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id BC65B60383 for ; Fri, 30 Mar 2018 14:12:43 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id AC73F286C8 for ; Fri, 30 Mar 2018 14:12:43 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id A140B286EC; Fri, 30 Mar 2018 14:12:43 +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=-4.2 required=2.0 tests=BAYES_00, RCVD_IN_DNSWL_MED, UNPARSEABLE_RELAY 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 3751C286C8 for ; Fri, 30 Mar 2018 14:12:43 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id CF9C26E8D6; Fri, 30 Mar 2018 14:12:13 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from bhuna.collabora.co.uk (bhuna.collabora.co.uk [IPv6:2a00:1098:0:82:1000:25:2eeb:e3e3]) by gabe.freedesktop.org (Postfix) with ESMTPS id 734846E8C1 for ; Fri, 30 Mar 2018 14:11:45 +0000 (UTC) Received: from [127.0.0.1] (localhost [127.0.0.1]) (Authenticated sender: daniels) with ESMTPSA id E9D862779FB From: Daniel Stone To: dri-devel@lists.freedesktop.org Subject: [PATCH 14/24] drm/tegra: Move fbdev unmap special case Date: Fri, 30 Mar 2018 15:11:28 +0100 Message-Id: <20180330141138.28987-14-daniels@collabora.com> X-Mailer: git-send-email 2.16.2 In-Reply-To: <20180330141138.28987-1-daniels@collabora.com> References: <20180330141138.28987-1-daniels@collabora.com> 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: linux-tegra@vger.kernel.org, Thierry Reding MIME-Version: 1.0 Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" X-Virus-Scanned: ClamAV using ClamSMTP User framebuffers are created with either bo->pages or bo->vaddr set, depending on whether or not an IOMMU is present. On the other hand, the framebuffer created for fbdev emulation has a vaddr mapping made if bo->pages is set after creation. This is set up in fbdev probe. Remove the special case unmapping from the general-purpose framebuffer destroy, and move it to fbdev teardown. Signed-off-by: Daniel Stone Cc: Thierry Reding Cc: linux-tegra@vger.kernel.org --- drivers/gpu/drm/tegra/fb.c | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/drivers/gpu/drm/tegra/fb.c b/drivers/gpu/drm/tegra/fb.c index 57da9683a713..709aa6ef171a 100644 --- a/drivers/gpu/drm/tegra/fb.c +++ b/drivers/gpu/drm/tegra/fb.c @@ -99,12 +99,8 @@ static void tegra_fb_destroy(struct drm_framebuffer *framebuffer) for (i = 0; i < framebuffer->format->num_planes; i++) { struct tegra_bo *bo = tegra_fb_get_plane(framebuffer, i); - if (bo) { - if (bo->pages) - vunmap(bo->vaddr); - + if (bo) drm_gem_object_put_unlocked(&bo->gem); - } } drm_framebuffer_cleanup(framebuffer); @@ -369,8 +365,17 @@ static void tegra_fbdev_exit(struct tegra_fbdev *fbdev) { drm_fb_helper_unregister_fbi(&fbdev->base); - if (fbdev->fb) + if (fbdev->fb) { + struct tegra_bo *bo = tegra_fb_get_plane(fbdev->fb, 0); + + /* Undo the special mapping we made in fbdev probe. */ + if (bo && bo->pages) { + vunmap(bo->vaddr); + bo->vaddr = 0; + } + drm_framebuffer_remove(fbdev->fb); + } drm_fb_helper_fini(&fbdev->base); tegra_fbdev_free(fbdev);