@@ -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
@@ -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.
*
@@ -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,
This unmaps a previously mapped (via exynos_bo_map()) buffer object. Signed-off-by: Tobias Jakobi <tjakobi@math.uni-bielefeld.de> --- exynos/exynos-symbol-check | 1 + exynos/exynos_drm.c | 20 ++++++++++++++++++++ exynos/exynos_drmif.h | 1 + 3 files changed, 22 insertions(+)