From 235e4db80170bd0db921f849491db885faf76856 Mon Sep 17 00:00:00 2001 From: Grzegorz Prajsner Date: Wed, 24 Jun 2015 15:23:13 +0100 Subject: [PATCH] FROMLIST: drm/rockchip: add fb_dmabuf_export support Add support for fb_dmabuf_export call, which is executed when ioctl FBIOGET_DMABUF is called. Change-Id: I13b753ae25d043835b1f4ffc20b5e233171d1096 Signed-off-by: Guillaume Tucker Signed-off-by: Mark Yao (am from https://github.com/ARM-software/linux/commit/61062681c90f49e129c0602ebe755a12787fbd66) --- drivers/gpu/drm/rockchip/rockchip_drm_fbdev.c | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/drivers/gpu/drm/rockchip/rockchip_drm_fbdev.c b/drivers/gpu/drm/rockchip/rockchip_drm_fbdev.c index cf605ba5ec16..1832cbbd0c97 100644 --- a/drivers/gpu/drm/rockchip/rockchip_drm_fbdev.c +++ b/drivers/gpu/drm/rockchip/rockchip_drm_fbdev.c @@ -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, -- 2.34.1