FROMLIST: drm/rockchip: add fb_dmabuf_export support
authorGrzegorz Prajsner <grzegorz.prajsner@arm.com>
Wed, 24 Jun 2015 14:23:13 +0000 (15:23 +0100)
committerHuang, Tao <huangtao@rock-chips.com>
Wed, 21 Jun 2017 07:13:25 +0000 (15:13 +0800)
Add support for fb_dmabuf_export call, which is executed when ioctl
FBIOGET_DMABUF is called.

Change-Id: I13b753ae25d043835b1f4ffc20b5e233171d1096
Signed-off-by: Guillaume Tucker <guillaume.tucker@arm.com>
Signed-off-by: Mark Yao <mark.yao@rock-chips.com>
(am from https://github.com/ARM-software/linux/commit/61062681c90f49e129c0602ebe755a12787fbd66)

drivers/gpu/drm/rockchip/rockchip_drm_fbdev.c

index cf605ba5ec16b0ea32c6fb1275d7be7bfa9b61c0..1832cbbd0c978a39d679a0661d5fa8fea7f46e9b 100644 (file)
@@ -33,6 +33,23 @@ static int rockchip_fbdev_mmap(struct fb_info *info,
        return rockchip_gem_mmap_buf(private->fbdev_bo, vma);
 }
 
+static struct dma_buf *rockchip_fbdev_get_dma_buf(struct fb_info *info)
+{
+       struct dma_buf *buf = NULL;
+       struct drm_fb_helper *helper = info->par;
+       struct rockchip_drm_private *private = helper->dev->dev_private;
+       struct drm_device *dev = helper->dev;
+
+       if (dev->driver->gem_prime_export) {
+               buf = dev->driver->gem_prime_export(dev, private->fbdev_bo,
+                                                   O_RDWR);
+               if (buf)
+                       drm_gem_object_reference(private->fbdev_bo);
+       }
+
+       return buf;
+}
+
 static struct fb_ops rockchip_drm_fbdev_ops = {
        .owner          = THIS_MODULE,
        .fb_mmap        = rockchip_fbdev_mmap,
@@ -44,6 +61,7 @@ static struct fb_ops rockchip_drm_fbdev_ops = {
        .fb_blank       = drm_fb_helper_blank,
        .fb_pan_display = drm_fb_helper_pan_display,
        .fb_setcmap     = drm_fb_helper_setcmap,
+       .fb_dmabuf_export       = rockchip_fbdev_get_dma_buf,
 };
 
 static int rockchip_drm_fbdev_create(struct drm_fb_helper *helper,