This unmaps a previously mapped (via exynos_bo_map()) buffer object. Signed-off-by: Tobias Jakobi <tjakobi@xxxxxxxxxxxxxxxxxxxxx> --- 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, -- 2.4.9 -- To unsubscribe from this list: send the line "unsubscribe linux-samsung-soc" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html