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: 7240571 Return-Path: X-Original-To: patchwork-linux-samsung-soc@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 B1F14BEEC1 for ; Tue, 22 Sep 2015 16:00:31 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id CD44E20845 for ; Tue, 22 Sep 2015 16:00:30 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id E611A20835 for ; Tue, 22 Sep 2015 16:00:29 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1758344AbbIVQAY (ORCPT ); Tue, 22 Sep 2015 12:00:24 -0400 Received: from smtp.math.uni-bielefeld.de ([129.70.45.10]:40827 "EHLO smtp.math.uni-bielefeld.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1758193AbbIVQAT (ORCPT ); Tue, 22 Sep 2015 12:00:19 -0400 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 Cc: dri-devel@lists.freedesktop.org, emil.l.velikov@gmail.com, jy0922.shim@samsung.com, gustavo.padovan@collabora.co.uk, inki.dae@samsung.com, Tobias Jakobi 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> Sender: linux-samsung-soc-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-samsung-soc@vger.kernel.org X-Spam-Status: No, score=-6.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, 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,