1 From d5f1a291e32309324a8c481ed84b5c118d1360ea Mon Sep 17 00:00:00 2001
2 From: Sinclair Yeh <syeh@vmware.com>
3 Date: Wed, 29 Jun 2016 13:23:18 -0700
4 Subject: drm/vmwgfx: Delay pinning fbdev framebuffer until after mode set
6 From: Sinclair Yeh <syeh@vmware.com>
8 commit d5f1a291e32309324a8c481ed84b5c118d1360ea upstream.
10 For the Screen Object display unit, we need to reserve a
11 guest-invisible region equal to the size of the framebuffer for
12 the host. This region can only be reserved in VRAM, whereas
13 the guest-visible framebuffer can be reserved in either VRAM or
16 As such priority should be given to the guest-invisible
17 region otherwise in a limited VRAM situation, we can fail to
20 This patch makes it so that vmw_sou_backing_alloc() is called
21 before the framebuffer is pinned.
23 Signed-off-by: Sinclair Yeh <syeh@vmware.com>
24 Reviewed-by: Thomas Hellstrom <thellstrom@vmware.com>
25 Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
28 drivers/gpu/drm/vmwgfx/vmwgfx_fb.c | 47 +++++++++++++++++++------------------
29 1 file changed, 25 insertions(+), 22 deletions(-)
31 --- a/drivers/gpu/drm/vmwgfx/vmwgfx_fb.c
32 +++ b/drivers/gpu/drm/vmwgfx/vmwgfx_fb.c
33 @@ -517,28 +517,6 @@ static int vmw_fb_kms_framebuffer(struct
35 par->set_fb = &vfb->base;
39 - * Pin before mapping. Since we don't know in what placement
40 - * to pin, call into KMS to do it for us.
42 - ret = vfb->pin(vfb);
44 - DRM_ERROR("Could not pin the fbdev framebuffer.\n");
48 - ret = ttm_bo_kmap(&par->vmw_bo->base, 0,
49 - par->vmw_bo->base.num_pages, &par->map);
52 - DRM_ERROR("Could not map the fbdev framebuffer.\n");
56 - par->bo_ptr = ttm_kmap_obj_virtual(&par->map, &par->bo_iowrite);
62 @@ -601,6 +579,31 @@ static int vmw_fb_set_par(struct fb_info
67 + struct vmw_framebuffer *vfb = vmw_framebuffer_to_vfb(set.fb);
70 + * Pin before mapping. Since we don't know in what placement
71 + * to pin, call into KMS to do it for us.
73 + ret = vfb->pin(vfb);
75 + DRM_ERROR("Could not pin the fbdev framebuffer.\n");
79 + ret = ttm_bo_kmap(&par->vmw_bo->base, 0,
80 + par->vmw_bo->base.num_pages, &par->map);
83 + DRM_ERROR("Could not map the fbdev framebuffer.\n");
87 + par->bo_ptr = ttm_kmap_obj_virtual(&par->map, &par->bo_iowrite);
91 vmw_fb_dirty_mark(par, par->fb_x, par->fb_y,
92 par->set_fb->width, par->set_fb->height);