From patchwork Sun Nov 22 18:48:41 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tobias Jakobi X-Patchwork-Id: 7677061 Return-Path: X-Original-To: patchwork-dri-devel@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id AC717BF90C for ; Sun, 22 Nov 2015 18:54:28 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id E7B4620703 for ; Sun, 22 Nov 2015 18:54:27 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) by mail.kernel.org (Postfix) with ESMTP id EC68E20711 for ; Sun, 22 Nov 2015 18:54:25 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 2BAF36E328; Sun, 22 Nov 2015 10:54:25 -0800 (PST) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from smtp.math.uni-bielefeld.de (smtp.math.uni-bielefeld.de [129.70.45.10]) by gabe.freedesktop.org (Postfix) with ESMTPS id 839926E328 for ; Sun, 22 Nov 2015 10:54:24 -0800 (PST) Received: from chidori.local (dslb-092-077-040-173.092.077.pools.vodafone-ip.de [92.77.40.173]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-SHA256 (128/128 bits)) (Client did not present a certificate) by smtp.math.uni-bielefeld.de (Postfix) with ESMTPSA id 68915610BD; Sun, 22 Nov 2015 19:54:22 +0100 (CET) From: Tobias Jakobi To: linux-samsung-soc@vger.kernel.org Subject: [PATCH v2 11/13] exynos/fimg2d: add exynos_bo_unmap() Date: Sun, 22 Nov 2015 19:48:41 +0100 Message-Id: <1448218123-21292-12-git-send-email-tjakobi@math.uni-bielefeld.de> X-Mailer: git-send-email 2.4.9 In-Reply-To: <1448218123-21292-1-git-send-email-tjakobi@math.uni-bielefeld.de> References: <1448218123-21292-1-git-send-email-tjakobi@math.uni-bielefeld.de> Cc: emil.l.velikov@gmail.com, dri-devel@lists.freedesktop.org, Tobias Jakobi X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" X-Spam-Status: No, score=-4.8 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_MED, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP This unmaps a previously mapped (via exynos_bo_map()) buffer object. Signed-off-by: Tobias Jakobi --- exynos/exynos-symbol-check | 1 + exynos/exynos_drm.c | 20 ++++++++++++++++++++ exynos/exynos_drmif.h | 1 + 3 files changed, 22 insertions(+) diff --git a/exynos/exynos-symbol-check b/exynos/exynos-symbol-check index 2bb7718..2e4ba56 100755 --- a/exynos/exynos-symbol-check +++ b/exynos/exynos-symbol-check @@ -17,6 +17,7 @@ exynos_bo_get_info exynos_bo_get_name exynos_bo_handle exynos_bo_map +exynos_bo_unmap exynos_device_create exynos_device_destroy exynos_prime_fd_to_handle diff --git a/exynos/exynos_drm.c b/exynos/exynos_drm.c index 7a400ad..e086a00 100644 --- a/exynos/exynos_drm.c +++ b/exynos/exynos_drm.c @@ -309,6 +309,26 @@ void *exynos_bo_map(struct exynos_bo *bo) return bo->vaddr; } +int exynos_bo_unmap(struct exynos_bo *bo) +{ + int ret = 0; + + if (!bo->vaddr) + goto out; + + ret = munmap(bo->vaddr, bo->size); + if (ret) { + fprintf(stderr, "failed to unmap buffer [%s].\n", + strerror(errno)); + goto out; + } + + bo->vaddr = NULL; + +out: + return ret; +} + /* * Export gem object to dmabuf as file descriptor. * diff --git a/exynos/exynos_drmif.h b/exynos/exynos_drmif.h index 626e399..3b26ebf 100644 --- a/exynos/exynos_drmif.h +++ b/exynos/exynos_drmif.h @@ -91,6 +91,7 @@ struct exynos_bo * exynos_bo_from_name(struct exynos_device *dev, uint32_t name) int exynos_bo_get_name(struct exynos_bo *bo, uint32_t *name); uint32_t exynos_bo_handle(struct exynos_bo *bo); void * exynos_bo_map(struct exynos_bo *bo); +int exynos_bo_unmap(struct exynos_bo *bo); int exynos_prime_handle_to_fd(struct exynos_device *dev, uint32_t handle, int *fd); int exynos_prime_fd_to_handle(struct exynos_device *dev, int fd,