]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/blob - releases/4.6.5/drm-vmwgfx-delay-pinning-fbdev-framebuffer-until-after-mode-set.patch
5.1-stable patches
[thirdparty/kernel/stable-queue.git] / releases / 4.6.5 / drm-vmwgfx-delay-pinning-fbdev-framebuffer-until-after-mode-set.patch
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
5
6 From: Sinclair Yeh <syeh@vmware.com>
7
8 commit d5f1a291e32309324a8c481ed84b5c118d1360ea upstream.
9
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
14 GMR.
15
16 As such priority should be given to the guest-invisible
17 region otherwise in a limited VRAM situation, we can fail to
18 allocate this region.
19
20 This patch makes it so that vmw_sou_backing_alloc() is called
21 before the framebuffer is pinned.
22
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>
26
27 ---
28 drivers/gpu/drm/vmwgfx/vmwgfx_fb.c | 47 +++++++++++++++++++------------------
29 1 file changed, 25 insertions(+), 22 deletions(-)
30
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
34
35 par->set_fb = &vfb->base;
36
37 - if (!par->bo_ptr) {
38 - /*
39 - * Pin before mapping. Since we don't know in what placement
40 - * to pin, call into KMS to do it for us.
41 - */
42 - ret = vfb->pin(vfb);
43 - if (ret) {
44 - DRM_ERROR("Could not pin the fbdev framebuffer.\n");
45 - return ret;
46 - }
47 -
48 - ret = ttm_bo_kmap(&par->vmw_bo->base, 0,
49 - par->vmw_bo->base.num_pages, &par->map);
50 - if (ret) {
51 - vfb->unpin(vfb);
52 - DRM_ERROR("Could not map the fbdev framebuffer.\n");
53 - return ret;
54 - }
55 -
56 - par->bo_ptr = ttm_kmap_obj_virtual(&par->map, &par->bo_iowrite);
57 - }
58 -
59 return 0;
60 }
61
62 @@ -601,6 +579,31 @@ static int vmw_fb_set_par(struct fb_info
63 if (ret)
64 goto out_unlock;
65
66 + if (!par->bo_ptr) {
67 + struct vmw_framebuffer *vfb = vmw_framebuffer_to_vfb(set.fb);
68 +
69 + /*
70 + * Pin before mapping. Since we don't know in what placement
71 + * to pin, call into KMS to do it for us.
72 + */
73 + ret = vfb->pin(vfb);
74 + if (ret) {
75 + DRM_ERROR("Could not pin the fbdev framebuffer.\n");
76 + return ret;
77 + }
78 +
79 + ret = ttm_bo_kmap(&par->vmw_bo->base, 0,
80 + par->vmw_bo->base.num_pages, &par->map);
81 + if (ret) {
82 + vfb->unpin(vfb);
83 + DRM_ERROR("Could not map the fbdev framebuffer.\n");
84 + return ret;
85 + }
86 +
87 + par->bo_ptr = ttm_kmap_obj_virtual(&par->map, &par->bo_iowrite);
88 + }
89 +
90 +
91 vmw_fb_dirty_mark(par, par->fb_x, par->fb_y,
92 par->set_fb->width, par->set_fb->height);
93