Commit 49b70a31 authored by Gerd Hoffmann's avatar Gerd Hoffmann Committed by Dave Airlie

bochs: fix bochsdrmfb mmap

Remove the mapping offset from the bo backing the fbdev framebuffer.
Wire up fbdev mmap function to map the backing bo using ttm_fbdev_mmap.
With that patch in place mmap(/dev/fb0) works as expected.
Signed-off-by: default avatarGerd Hoffmann <kraxel@redhat.com>
Signed-off-by: default avatarDave Airlie <airlied@redhat.com>
parent 9ecdb039
...@@ -9,6 +9,17 @@ ...@@ -9,6 +9,17 @@
/* ---------------------------------------------------------------------- */ /* ---------------------------------------------------------------------- */
static int bochsfb_mmap(struct fb_info *info,
struct vm_area_struct *vma)
{
struct drm_fb_helper *fb_helper = info->par;
struct bochs_device *bochs =
container_of(fb_helper, struct bochs_device, fb.helper);
struct bochs_bo *bo = gem_to_bochs_bo(bochs->fb.gfb.obj);
return ttm_fbdev_mmap(vma, &bo->bo);
}
static struct fb_ops bochsfb_ops = { static struct fb_ops bochsfb_ops = {
.owner = THIS_MODULE, .owner = THIS_MODULE,
.fb_check_var = drm_fb_helper_check_var, .fb_check_var = drm_fb_helper_check_var,
...@@ -19,6 +30,7 @@ static struct fb_ops bochsfb_ops = { ...@@ -19,6 +30,7 @@ static struct fb_ops bochsfb_ops = {
.fb_pan_display = drm_fb_helper_pan_display, .fb_pan_display = drm_fb_helper_pan_display,
.fb_blank = drm_fb_helper_blank, .fb_blank = drm_fb_helper_blank,
.fb_setcmap = drm_fb_helper_setcmap, .fb_setcmap = drm_fb_helper_setcmap,
.fb_mmap = bochsfb_mmap,
}; };
static int bochsfb_create_object(struct bochs_device *bochs, static int bochsfb_create_object(struct bochs_device *bochs,
...@@ -123,11 +135,9 @@ static int bochsfb_create(struct drm_fb_helper *helper, ...@@ -123,11 +135,9 @@ static int bochsfb_create(struct drm_fb_helper *helper,
info->screen_base = bo->kmap.virtual; info->screen_base = bo->kmap.virtual;
info->screen_size = size; info->screen_size = size;
#if 0 drm_vma_offset_remove(&bo->bo.bdev->vma_manager, &bo->bo.vma_node);
/* FIXME: get this right for mmap(/dev/fb0) */ info->fix.smem_start = 0;
info->fix.smem_start = bochs_bo_mmap_offset(bo);
info->fix.smem_len = size; info->fix.smem_len = size;
#endif
ret = fb_alloc_cmap(&info->cmap, 256, 0); ret = fb_alloc_cmap(&info->cmap, 256, 0);
if (ret) { if (ret) {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment