drm/exynos: support gem_prime_mmap
This allows exported dma-bufs to be mapped using gem_prime_mmap. Signed-off-by: Joonyoung Shim <jy0922.shim@samsung.com> Signed-off-by: Inki Dae <inki.dae@samsung.com>
This commit is contained in:
parent
fa9971d62a
commit
5a0202f758
|
@ -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_vmap = exynos_drm_gem_prime_vmap,
|
||||
.gem_prime_vunmap = exynos_drm_gem_prime_vunmap,
|
||||
.gem_prime_mmap = exynos_drm_gem_prime_mmap,
|
||||
.ioctls = exynos_ioctls,
|
||||
.num_ioctls = ARRAY_SIZE(exynos_ioctls),
|
||||
.fops = &exynos_drm_driver_fops,
|
||||
|
|
|
@ -503,22 +503,12 @@ out:
|
|||
}
|
||||
}
|
||||
|
||||
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 drm_gem_object *obj;
|
||||
struct exynos_drm_gem *exynos_gem = to_exynos_gem(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;
|
||||
exynos_gem = to_exynos_gem(obj);
|
||||
|
||||
DRM_DEBUG_KMS("flags = 0x%x\n", exynos_gem->flags);
|
||||
|
||||
/* non-cachable as default. */
|
||||
|
@ -543,6 +533,23 @@ err_close_vm:
|
|||
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 */
|
||||
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)
|
|||
{
|
||||
/* 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,
|
|||
struct sg_table *sgt);
|
||||
void *exynos_drm_gem_prime_vmap(struct drm_gem_object *obj);
|
||||
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
|
||||
|
|
Loading…
Reference in New Issue