]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/blob - releases/4.6.5/drm-vmwgfx-work-around-mode-set-failure-in-2d-vms.patch
Linux 4.6.5
[thirdparty/kernel/stable-queue.git] / releases / 4.6.5 / drm-vmwgfx-work-around-mode-set-failure-in-2d-vms.patch
1 From 7c20d213dd3cd6295bf9162730e7a368af957854 Mon Sep 17 00:00:00 2001
2 From: Sinclair Yeh <syeh@vmware.com>
3 Date: Wed, 29 Jun 2016 11:29:47 -0700
4 Subject: drm/vmwgfx: Work around mode set failure in 2D VMs
5
6 From: Sinclair Yeh <syeh@vmware.com>
7
8 commit 7c20d213dd3cd6295bf9162730e7a368af957854 upstream.
9
10 In a low-memory 2D VM, fbdev can take up a large percentage of
11 available memory, making them unavailable for other DRM clients.
12
13 Since we do not take fbdev into account when filtering modes,
14 we end up claiming to support more modes than we actually do.
15
16 As a result, users get a black screen when setting a mode too
17 large for current available memory. In a low-memory VM
18 configuration, users can get a black screen for a mode as low
19 as 1024x768.
20
21 The current mode filtering mechanism keys off of
22 SVGA_REG_SUGGESTED_GBOBJECT_MEM_SIZE_KB, i.e. the maximum amount
23 of surface memory we have. Since this value is a performance
24 suggestion, not a hard limit, and since there should not be much
25 of a performance impact for a 2D VM, rather than filtering out
26 more modes, we will just allow ourselves to exceed the SVGA's
27 performance suggestion.
28
29 Also changed assumed bpp to 32 from 16 to make sure we can
30 actually support all the modes listed.
31
32 Signed-off-by: Sinclair Yeh <syeh@vmware.com>
33 Reviewed-by: Thomas Hellstrom <thellstrom@vmware.com>
34 Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
35
36 ---
37 drivers/gpu/drm/vmwgfx/vmwgfx_drv.c | 7 +++++++
38 drivers/gpu/drm/vmwgfx/vmwgfx_kms.c | 9 +--------
39 2 files changed, 8 insertions(+), 8 deletions(-)
40
41 --- a/drivers/gpu/drm/vmwgfx/vmwgfx_drv.c
42 +++ b/drivers/gpu/drm/vmwgfx/vmwgfx_drv.c
43 @@ -704,6 +704,13 @@ static int vmw_driver_load(struct drm_de
44 vmw_read(dev_priv,
45 SVGA_REG_SUGGESTED_GBOBJECT_MEM_SIZE_KB);
46
47 + /*
48 + * Workaround for low memory 2D VMs to compensate for the
49 + * allocation taken by fbdev
50 + */
51 + if (!(dev_priv->capabilities & SVGA_CAP_3D))
52 + mem_size *= 2;
53 +
54 dev_priv->max_mob_pages = mem_size * 1024 / PAGE_SIZE;
55 dev_priv->prim_bb_mem =
56 vmw_read(dev_priv,
57 --- a/drivers/gpu/drm/vmwgfx/vmwgfx_kms.c
58 +++ b/drivers/gpu/drm/vmwgfx/vmwgfx_kms.c
59 @@ -1553,14 +1553,7 @@ int vmw_du_connector_fill_modes(struct d
60 DRM_MODE_FLAG_NHSYNC | DRM_MODE_FLAG_PVSYNC)
61 };
62 int i;
63 - u32 assumed_bpp = 2;
64 -
65 - /*
66 - * If using screen objects, then assume 32-bpp because that's what the
67 - * SVGA device is assuming
68 - */
69 - if (dev_priv->active_display_unit == vmw_du_screen_object)
70 - assumed_bpp = 4;
71 + u32 assumed_bpp = 4;
72
73 if (dev_priv->assume_16bpp)
74 assumed_bpp = 2;