Skip to content

Commit da6eb39

Browse files
author
Thomas Zimmermann
committed
drm/omapdrm: Use GEM mmap for fbdev emulation
The fbdev emulation currently uses fbdev's default mmap code, which has been written for I/O memory. Provide an mmap that uses GEM's mmap infrastructure. Utilize fine-grained fbdev macros to initialize struct fb_ops. The macros set the read/write and the draw callbacks for DMA memory. Set the fb_mmap callback to omapdrm's new mmap helper. Also select the correct Kconfig token for fbdev's DMA helpers. Note that the DMA helpers are the same as for system memory. Signed-off-by: Thomas Zimmermann <[email protected]> Reviewed-by: Javier Martinez Canillas <[email protected]> Acked-by: Maxime Ripard <[email protected]> Cc: Tomi Valkeinen <[email protected]> Link: https://patchwork.freedesktop.org/patch/msgid/[email protected]
1 parent 413b757 commit da6eb39

File tree

2 files changed

+14
-3
lines changed

2 files changed

+14
-3
lines changed

drivers/gpu/drm/omapdrm/Kconfig

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ config DRM_OMAP
44
depends on DRM && OF
55
depends on ARCH_OMAP2PLUS
66
select DRM_KMS_HELPER
7-
select FB_SYS_HELPERS if DRM_FBDEV_EMULATION
7+
select FB_DMA_HELPERS if DRM_FBDEV_EMULATION
88
select VIDEOMODE_HELPERS
99
select HDMI
1010
default n

drivers/gpu/drm/omapdrm/omap_fbdev.c

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,15 @@ static int omap_fbdev_pan_display(struct fb_var_screeninfo *var,
7676
return drm_fb_helper_pan_display(var, fbi);
7777
}
7878

79+
static int omap_fbdev_fb_mmap(struct fb_info *info, struct vm_area_struct *vma)
80+
{
81+
struct drm_fb_helper *helper = info->par;
82+
struct drm_framebuffer *fb = helper->fb;
83+
struct drm_gem_object *bo = drm_gem_fb_get_obj(fb, 0);
84+
85+
return drm_gem_mmap_obj(bo, omap_gem_mmap_size(bo), vma);
86+
}
87+
7988
static void omap_fbdev_fb_destroy(struct fb_info *info)
8089
{
8190
struct drm_fb_helper *helper = info->par;
@@ -97,14 +106,16 @@ static void omap_fbdev_fb_destroy(struct fb_info *info)
97106

98107
static const struct fb_ops omap_fb_ops = {
99108
.owner = THIS_MODULE,
100-
FB_DEFAULT_SYS_OPS,
109+
__FB_DEFAULT_DMA_OPS_RDWR,
101110
.fb_check_var = drm_fb_helper_check_var,
102111
.fb_set_par = drm_fb_helper_set_par,
103112
.fb_setcmap = drm_fb_helper_setcmap,
104113
.fb_blank = drm_fb_helper_blank,
105114
.fb_pan_display = omap_fbdev_pan_display,
115+
__FB_DEFAULT_DMA_OPS_DRAW,
106116
.fb_ioctl = drm_fb_helper_ioctl,
107-
.fb_destroy = omap_fbdev_fb_destroy,
117+
.fb_mmap = omap_fbdev_fb_mmap,
118+
.fb_destroy = omap_fbdev_fb_destroy,
108119
};
109120

110121
static int omap_fbdev_create(struct drm_fb_helper *helper,

0 commit comments

Comments
 (0)