From patchwork Tue Sep 22 15:55:00 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tobias Jakobi X-Patchwork-Id: 7240561 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 53E08BEEC1 for ; Tue, 22 Sep 2015 16:00:29 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id D8C6220865 for ; Tue, 22 Sep 2015 16:00:23 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) by mail.kernel.org (Postfix) with ESMTP id 35F1F20845 for ; Tue, 22 Sep 2015 16:00:22 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 374A56EAC2; Tue, 22 Sep 2015 09:00:21 -0700 (PDT) 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 EC3E66EAC2 for ; Tue, 22 Sep 2015 09:00:19 -0700 (PDT) Received: from chidori.entropy (unknown [5.147.63.78]) (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 CC25C600D0; Tue, 22 Sep 2015 18:00:17 +0200 (CEST) From: Tobias Jakobi To: linux-samsung-soc@vger.kernel.org Subject: [PATCH 11/13] exynos/fimg2d: add exynos_bo_unmap() Date: Tue, 22 Sep 2015 17:55:00 +0200 Message-Id: <1442937302-8211-12-git-send-email-tjakobi@math.uni-bielefeld.de> X-Mailer: git-send-email 2.0.5 In-Reply-To: <1442937302-8211-1-git-send-email-tjakobi@math.uni-bielefeld.de> References: <1442937302-8211-1-git-send-email-tjakobi@math.uni-bielefeld.de> Cc: emil.l.velikov@gmail.com, dri-devel@lists.freedesktop.org, Tobias Jakobi , gustavo.padovan@collabora.co.uk 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.2 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,