summaryrefslogtreecommitdiff
path: root/vmwgfx_drv.c
diff options
context:
space:
mode:
authorSinclair Yeh <syeh@vmware.com>2016-06-17 09:05:11 -0700
committerSinclair Yeh <syeh@vmware.com>2016-06-20 11:19:36 -0700
commit9c3ba9a11c29fffd75adb9728e90af2bc957ca70 (patch)
treede176116d4079811be88194aa91535ea9d2219f7 /vmwgfx_drv.c
parent60bacf93e32d72341f1166a4761bc7a3eab7286d (diff)
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. 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>
Diffstat (limited to 'vmwgfx_drv.c')
-rw-r--r--vmwgfx_drv.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/vmwgfx_drv.c b/vmwgfx_drv.c
index 934b2c9..6a48189 100644
--- a/vmwgfx_drv.c
+++ b/vmwgfx_drv.c
@@ -692,6 +692,13 @@ static int vmw_driver_load(struct drm_device *dev, unsigned long chipset)
vmw_read(dev_priv,
SVGA_REG_SUGGESTED_GBOBJECT_MEM_SIZE_KB);
+ /*
+ * Workaround for low memory 2D VMs to compensate for the
+ * allocation taken by fbdev
+ */
+ if (!(dev_priv->capabilities & SVGA_CAP_3D))
+ mem_size *= 2;
+
dev_priv->max_mob_pages = mem_size * 1024 / PAGE_SIZE;
dev_priv->prim_bb_mem =
vmw_read(dev_priv,