Commit 5a0202f7 authored by Joonyoung Shim's avatar Joonyoung Shim Committed by Inki Dae

drm/exynos: support gem_prime_mmap

This allows exported dma-bufs to be mapped using gem_prime_mmap.
Signed-off-by: default avatarJoonyoung Shim <jy0922.shim@samsung.com>
Signed-off-by: default avatarInki Dae <inki.dae@samsung.com>
parent fa9971d6
...@@ -431,6 +431,7 @@ static struct drm_driver exynos_drm_driver = { ...@@ -431,6 +431,7 @@ static struct drm_driver exynos_drm_driver = {
.gem_prime_import_sg_table = exynos_drm_gem_prime_import_sg_table, .gem_prime_import_sg_table = exynos_drm_gem_prime_import_sg_table,
.gem_prime_vmap = exynos_drm_gem_prime_vmap, .gem_prime_vmap = exynos_drm_gem_prime_vmap,
.gem_prime_vunmap = exynos_drm_gem_prime_vunmap, .gem_prime_vunmap = exynos_drm_gem_prime_vunmap,
.gem_prime_mmap = exynos_drm_gem_prime_mmap,
.ioctls = exynos_ioctls, .ioctls = exynos_ioctls,
.num_ioctls = ARRAY_SIZE(exynos_ioctls), .num_ioctls = ARRAY_SIZE(exynos_ioctls),
.fops = &exynos_drm_driver_fops, .fops = &exynos_drm_driver_fops,
......
...@@ -503,22 +503,12 @@ int exynos_drm_gem_fault(struct vm_area_struct *vma, struct vm_fault *vmf) ...@@ -503,22 +503,12 @@ int exynos_drm_gem_fault(struct vm_area_struct *vma, struct vm_fault *vmf)
} }
} }
int exynos_drm_gem_mmap(struct file *filp, struct vm_area_struct *vma) static int exynos_drm_gem_mmap_obj(struct drm_gem_object *obj,
struct vm_area_struct *vma)
{ {
struct exynos_drm_gem *exynos_gem; struct exynos_drm_gem *exynos_gem = to_exynos_gem(obj);
struct drm_gem_object *obj;
int ret; int ret;
/* set vm_area_struct. */
ret = drm_gem_mmap(filp, vma);
if (ret < 0) {
DRM_ERROR("failed to mmap.\n");
return ret;
}
obj = vma->vm_private_data;
exynos_gem = to_exynos_gem(obj);
DRM_DEBUG_KMS("flags = 0x%x\n", exynos_gem->flags); DRM_DEBUG_KMS("flags = 0x%x\n", exynos_gem->flags);
/* non-cachable as default. */ /* non-cachable as default. */
...@@ -543,6 +533,23 @@ int exynos_drm_gem_mmap(struct file *filp, struct vm_area_struct *vma) ...@@ -543,6 +533,23 @@ int exynos_drm_gem_mmap(struct file *filp, struct vm_area_struct *vma)
return ret; return ret;
} }
int exynos_drm_gem_mmap(struct file *filp, struct vm_area_struct *vma)
{
struct drm_gem_object *obj;
int ret;
/* set vm_area_struct. */
ret = drm_gem_mmap(filp, vma);
if (ret < 0) {
DRM_ERROR("failed to mmap.\n");
return ret;
}
obj = vma->vm_private_data;
return exynos_drm_gem_mmap_obj(obj, vma);
}
/* low-level interface prime helpers */ /* low-level interface prime helpers */
struct sg_table *exynos_drm_gem_prime_get_sg_table(struct drm_gem_object *obj) struct sg_table *exynos_drm_gem_prime_get_sg_table(struct drm_gem_object *obj)
{ {
...@@ -617,3 +624,15 @@ void exynos_drm_gem_prime_vunmap(struct drm_gem_object *obj, void *vaddr) ...@@ -617,3 +624,15 @@ void exynos_drm_gem_prime_vunmap(struct drm_gem_object *obj, void *vaddr)
{ {
/* Nothing to do */ /* Nothing to do */
} }
int exynos_drm_gem_prime_mmap(struct drm_gem_object *obj,
struct vm_area_struct *vma)
{
int ret;
ret = drm_gem_mmap_obj(obj, obj->size, vma);
if (ret < 0)
return ret;
return exynos_drm_gem_mmap_obj(obj, vma);
}
...@@ -139,5 +139,7 @@ exynos_drm_gem_prime_import_sg_table(struct drm_device *dev, ...@@ -139,5 +139,7 @@ exynos_drm_gem_prime_import_sg_table(struct drm_device *dev,
struct sg_table *sgt); struct sg_table *sgt);
void *exynos_drm_gem_prime_vmap(struct drm_gem_object *obj); void *exynos_drm_gem_prime_vmap(struct drm_gem_object *obj);
void exynos_drm_gem_prime_vunmap(struct drm_gem_object *obj, void *vaddr); void exynos_drm_gem_prime_vunmap(struct drm_gem_object *obj, void *vaddr);
int exynos_drm_gem_prime_mmap(struct drm_gem_object *obj,
struct vm_area_struct *vma);
#endif #endif
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment