diff options
author | Thierry Reding <treding@nvidia.com> | 2018-02-07 12:45:56 -0500 |
---|---|---|
committer | Thierry Reding <treding@nvidia.com> | 2018-03-08 08:38:42 -0500 |
commit | b8f3f500e09c2c457efc2fcbfe8b7f815f2e6a0e (patch) | |
tree | 8c7a43b60ba3f9482bf621f38d55b4468e045038 | |
parent | 04c0746663bd3ae3cce5e02d5b32c8ade2a833b8 (diff) |
drm/tegra: fb: Implement ->fb_mmap() callback
This fixes hangs with legacy applications that use the mmap() syscall on
the fbdev device to map framebuffer memory. The fbdev implementation for
mmap() creates a mapping that conflicts with DRM usage and causes a hang
when the memory is accessed through the mapping.
Reported-by: Marcel Ziswiler <marcel.ziswiler@toradex.com>
Signed-off-by: Thierry Reding <treding@nvidia.com>
Tested-by: Stefan Agner <stefan@agner.ch>
Tested-by: Marcel Ziswiler <marcel.ziswiler@toradex.com>
Reported-by: Marcel Ziswiler <marcel.ziswiler@toradex.com>
Signed-off-by: Thierry Reding <treding@nvidia.com>
-rw-r--r-- | drivers/gpu/drm/tegra/fb.c | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/drivers/gpu/drm/tegra/fb.c b/drivers/gpu/drm/tegra/fb.c index 001cb77e2f59..0786159edef3 100644 --- a/drivers/gpu/drm/tegra/fb.c +++ b/drivers/gpu/drm/tegra/fb.c | |||
@@ -224,12 +224,28 @@ unreference: | |||
224 | } | 224 | } |
225 | 225 | ||
226 | #ifdef CONFIG_DRM_FBDEV_EMULATION | 226 | #ifdef CONFIG_DRM_FBDEV_EMULATION |
227 | static int tegra_fb_mmap(struct fb_info *info, struct vm_area_struct *vma) | ||
228 | { | ||
229 | struct drm_fb_helper *helper = info->par; | ||
230 | struct tegra_bo *bo; | ||
231 | int err; | ||
232 | |||
233 | bo = tegra_fb_get_plane(helper->fb, 0); | ||
234 | |||
235 | err = drm_gem_mmap_obj(&bo->gem, bo->gem.size, vma); | ||
236 | if (err < 0) | ||
237 | return err; | ||
238 | |||
239 | return __tegra_gem_mmap(&bo->gem, vma); | ||
240 | } | ||
241 | |||
227 | static struct fb_ops tegra_fb_ops = { | 242 | static struct fb_ops tegra_fb_ops = { |
228 | .owner = THIS_MODULE, | 243 | .owner = THIS_MODULE, |
229 | DRM_FB_HELPER_DEFAULT_OPS, | 244 | DRM_FB_HELPER_DEFAULT_OPS, |
230 | .fb_fillrect = drm_fb_helper_sys_fillrect, | 245 | .fb_fillrect = drm_fb_helper_sys_fillrect, |
231 | .fb_copyarea = drm_fb_helper_sys_copyarea, | 246 | .fb_copyarea = drm_fb_helper_sys_copyarea, |
232 | .fb_imageblit = drm_fb_helper_sys_imageblit, | 247 | .fb_imageblit = drm_fb_helper_sys_imageblit, |
248 | .fb_mmap = tegra_fb_mmap, | ||
233 | }; | 249 | }; |
234 | 250 | ||
235 | static int tegra_fbdev_probe(struct drm_fb_helper *helper, | 251 | static int tegra_fbdev_probe(struct drm_fb_helper *helper, |