diff options
author | Hans de Goede <hdegoede@redhat.com> | 2018-09-18 19:44:34 +0200 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2018-09-20 12:32:05 +0200 |
commit | 0424d7ba4574ba3fcfd68c567becb5e90547e4f9 (patch) | |
tree | 44fbff0587aa59af133850910dc43f0203b09ea4 /drivers/staging/vboxvideo | |
parent | cb5eaf187d1d996a226b95a01f7a57b9dd603bea (diff) |
staging: vboxvideo: Init fb_info.fix.smem once from fbdev_create
The fbdev compat fb gets pinned into VRAM at creation and then gets pinned
a second time when set as scanout buffer and unpinned when replaced, this
means its pin count never becomes less then 1, so it is always at the same
address and there is no need for the vbox_fbdev_set_base() call.
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/staging/vboxvideo')
-rw-r--r-- | drivers/staging/vboxvideo/vbox_drv.h | 1 | ||||
-rw-r--r-- | drivers/staging/vboxvideo/vbox_fb.c | 14 | ||||
-rw-r--r-- | drivers/staging/vboxvideo/vbox_mode.c | 3 |
3 files changed, 5 insertions, 13 deletions
diff --git a/drivers/staging/vboxvideo/vbox_drv.h b/drivers/staging/vboxvideo/vbox_drv.h index 28ffdffe877a..5034c6bd5445 100644 --- a/drivers/staging/vboxvideo/vbox_drv.h +++ b/drivers/staging/vboxvideo/vbox_drv.h @@ -201,7 +201,6 @@ int vbox_framebuffer_init(struct vbox_private *vbox, int vbox_fbdev_init(struct vbox_private *vbox); void vbox_fbdev_fini(struct vbox_private *vbox); -void vbox_fbdev_set_base(struct vbox_private *vbox, unsigned long gpu_addr); struct vbox_bo { struct ttm_buffer_object bo; diff --git a/drivers/staging/vboxvideo/vbox_fb.c b/drivers/staging/vboxvideo/vbox_fb.c index 11b6364ed14a..0e5550fa7c57 100644 --- a/drivers/staging/vboxvideo/vbox_fb.c +++ b/drivers/staging/vboxvideo/vbox_fb.c @@ -80,6 +80,7 @@ static int vboxfb_create(struct drm_fb_helper *helper, struct drm_gem_object *gobj; struct vbox_bo *bo; int size, ret; + u64 gpu_addr; u32 pitch; mode_cmd.width = sizes->surface_width; @@ -107,7 +108,7 @@ static int vboxfb_create(struct drm_fb_helper *helper, if (ret) return ret; - ret = vbox_bo_pin(bo, TTM_PL_FLAG_VRAM, NULL); + ret = vbox_bo_pin(bo, TTM_PL_FLAG_VRAM, &gpu_addr); if (ret) { vbox_bo_unreserve(bo); return ret; @@ -152,6 +153,9 @@ static int vboxfb_create(struct drm_fb_helper *helper, drm_fb_helper_fill_var(info, &fbdev->helper, sizes->fb_width, sizes->fb_height); + info->fix.smem_start = info->apertures->ranges[0].base + gpu_addr; + info->fix.smem_len = vbox->available_vram_size - gpu_addr; + info->screen_base = (char __iomem *)bo->kmap.virtual; info->screen_size = size; @@ -241,11 +245,3 @@ err_fini: drm_fb_helper_fini(&fbdev->helper); return ret; } - -void vbox_fbdev_set_base(struct vbox_private *vbox, unsigned long gpu_addr) -{ - struct fb_info *fbdev = vbox->fbdev->helper.fbdev; - - fbdev->fix.smem_start = fbdev->apertures->ranges[0].base + gpu_addr; - fbdev->fix.smem_len = vbox->available_vram_size - gpu_addr; -} diff --git a/drivers/staging/vboxvideo/vbox_mode.c b/drivers/staging/vboxvideo/vbox_mode.c index f35045ce154b..6d7a89524fbf 100644 --- a/drivers/staging/vboxvideo/vbox_mode.c +++ b/drivers/staging/vboxvideo/vbox_mode.c @@ -276,9 +276,6 @@ static int vbox_crtc_set_base_and_mode(struct drm_crtc *crtc, /* Commit: Update hardware to use the new fb */ mutex_lock(&vbox->hw_mutex); - if (&vbox->fbdev->afb == to_vbox_framebuffer(new_fb)) - vbox_fbdev_set_base(vbox, gpu_addr); - vbox_crtc->fb_offset = gpu_addr; /* vbox_do_modeset() checks vbox->single_framebuffer so update it now */ |