drm: add mmap function to prime helpers
authorJoonyoung Shim <jy0922.shim@samsung.com>
Fri, 28 Jun 2013 05:24:53 +0000 (14:24 +0900)
committerDave Airlie <airlied@redhat.com>
Fri, 5 Jul 2013 05:44:44 +0000 (15:44 +1000)
This adds to call low-level mmap() from prime helpers.

Signed-off-by: Joonyoung Shim <jy0922.shim@samsung.com>
Acked-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
drivers/gpu/drm/drm_prime.c
include/drm/drmP.h

index ff5fecef367b45f068ec35e635798dca53275a17..85e450e3241cb1d5f6281ee9e417f7e8e4301da1 100644 (file)
@@ -245,7 +245,13 @@ static void drm_gem_dmabuf_kunmap(struct dma_buf *dma_buf,
 static int drm_gem_dmabuf_mmap(struct dma_buf *dma_buf,
                struct vm_area_struct *vma)
 {
-       return -EINVAL;
+       struct drm_gem_object *obj = dma_buf->priv;
+       struct drm_device *dev = obj->dev;
+
+       if (!dev->driver->gem_prime_mmap)
+               return -ENOSYS;
+
+       return dev->driver->gem_prime_mmap(obj, vma);
 }
 
 static const struct dma_buf_ops drm_gem_prime_dmabuf_ops =  {
index 82670ac0d774c1050e3694c8e9468f2337308484..12083dc862a9a6e03f12184a1fd1ff11d4e8ed04 100644 (file)
@@ -937,6 +937,8 @@ struct drm_driver {
                                struct sg_table *sgt);
        void *(*gem_prime_vmap)(struct drm_gem_object *obj);
        void (*gem_prime_vunmap)(struct drm_gem_object *obj, void *vaddr);
+       int (*gem_prime_mmap)(struct drm_gem_object *obj,
+                               struct vm_area_struct *vma);
 
        /* vga arb irq handler */
        void (*vgaarb_irq)(struct drm_device *dev, bool state);