aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSinclair Yeh <syeh@vmware.com>2016-06-29 14:29:47 -0400
committerSinclair Yeh <syeh@vmware.com>2016-07-01 13:47:48 -0400
commit7c20d213dd3cd6295bf9162730e7a368af957854 (patch)
tree68b5fb2e94855ca1bfd2b4e74875cf9d7b7e040e
parenta9cd9c044aa90ba2b31d1bf3e3432f38fb1d25fe (diff)
drm/vmwgfx: Work around mode set failure in 2D VMs
In a low-memory 2D VM, fbdev can take up a large percentage of available memory, making them unavailable for other DRM clients. Since we do not take fbdev into account when filtering modes, we end up claiming to support more modes than we actually do. As a result, users get a black screen when setting a mode too large for current available memory. In a low-memory VM configuration, users can get a black screen for a mode as low as 1024x768. The current mode filtering mechanism keys off of SVGA_REG_SUGGESTED_GBOBJECT_MEM_SIZE_KB, i.e. the maximum amount of surface memory we have. Since this value is a performance suggestion, not a hard limit, and since there should not be much of a performance impact for a 2D VM, rather than filtering out more modes, we will just allow ourselves to exceed the SVGA's performance suggestion. Also changed assumed bpp to 32 from 16 to make sure we can actually support all the modes listed. Signed-off-by: Sinclair Yeh <syeh@vmware.com> Reviewed-by: Thomas Hellstrom <thellstrom@vmware.com> Cc: <stable@vger.kernel.org>
-rw-r--r--drivers/gpu/drm/vmwgfx/vmwgfx_drv.c7
-rw-r--r--drivers/gpu/drm/vmwgfx/vmwgfx_kms.c9
2 files changed, 8 insertions, 8 deletions
diff --git a/drivers/gpu/drm/vmwgfx/vmwgfx_drv.c b/drivers/gpu/drm/vmwgfx/vmwgfx_drv.c
index 9fcd8200d485..fc9ad0050d23 100644
--- a/drivers/gpu/drm/vmwgfx/vmwgfx_drv.c
+++ b/drivers/gpu/drm/vmwgfx/vmwgfx_drv.c
@@ -706,6 +706,13 @@ static int vmw_driver_load(struct drm_device *dev, unsigned long chipset)
706 vmw_read(dev_priv, 706 vmw_read(dev_priv,
707 SVGA_REG_SUGGESTED_GBOBJECT_MEM_SIZE_KB); 707 SVGA_REG_SUGGESTED_GBOBJECT_MEM_SIZE_KB);
708 708
709 /*
710 * Workaround for low memory 2D VMs to compensate for the
711 * allocation taken by fbdev
712 */
713 if (!(dev_priv->capabilities & SVGA_CAP_3D))
714 mem_size *= 2;
715
709 dev_priv->max_mob_pages = mem_size * 1024 / PAGE_SIZE; 716 dev_priv->max_mob_pages = mem_size * 1024 / PAGE_SIZE;
710 dev_priv->prim_bb_mem = 717 dev_priv->prim_bb_mem =
711 vmw_read(dev_priv, 718 vmw_read(dev_priv,
diff --git a/drivers/gpu/drm/vmwgfx/vmwgfx_kms.c b/drivers/gpu/drm/vmwgfx/vmwgfx_kms.c
index 55231cce73a0..077f16d6de6f 100644
--- a/drivers/gpu/drm/vmwgfx/vmwgfx_kms.c
+++ b/drivers/gpu/drm/vmwgfx/vmwgfx_kms.c
@@ -1553,14 +1553,7 @@ int vmw_du_connector_fill_modes(struct drm_connector *connector,
1553 DRM_MODE_FLAG_NHSYNC | DRM_MODE_FLAG_PVSYNC) 1553 DRM_MODE_FLAG_NHSYNC | DRM_MODE_FLAG_PVSYNC)
1554 }; 1554 };
1555 int i; 1555 int i;
1556 u32 assumed_bpp = 2; 1556 u32 assumed_bpp = 4;
1557
1558 /*
1559 * If using screen objects, then assume 32-bpp because that's what the
1560 * SVGA device is assuming
1561 */
1562 if (dev_priv->active_display_unit == vmw_du_screen_object)
1563 assumed_bpp = 4;
1564 1557
1565 if (dev_priv->active_display_unit == vmw_du_screen_target) { 1558 if (dev_priv->active_display_unit == vmw_du_screen_target) {
1566 max_width = min(max_width, dev_priv->stdu_max_width); 1559 max_width = min(max_width, dev_priv->stdu_max_width);