From 65b7fff39c36856826781e1e5277bc8d78c1240d Mon Sep 17 00:00:00 2001 From: Thomas Hellstrom Date: Thu, 9 Feb 2012 16:56:47 +0100 Subject: [PATCH] --- yaml --- r: 293637 b: refs/heads/master c: 67d4a87b0a6bf7225aacc2c14e3542ec2f6b803f h: refs/heads/master i: 293635: 6bd64bcd7d575d1d4cfd80102c9862c7ea242147 v: v3 --- [refs] | 2 +- trunk/drivers/gpu/drm/vmwgfx/vmwgfx_drv.c | 18 ++++++++++++++---- 2 files changed, 15 insertions(+), 5 deletions(-) diff --git a/[refs] b/[refs] index f841c72465ad..5de93abcd8ef 100644 --- a/[refs] +++ b/[refs] @@ -1,2 +1,2 @@ --- -refs/heads/master: eb4f923b1ceac8a618469c51ff249bd89bc0dfa4 +refs/heads/master: 67d4a87b0a6bf7225aacc2c14e3542ec2f6b803f diff --git a/trunk/drivers/gpu/drm/vmwgfx/vmwgfx_drv.c b/trunk/drivers/gpu/drm/vmwgfx/vmwgfx_drv.c index 12272329d91b..f076f66b1153 100644 --- a/trunk/drivers/gpu/drm/vmwgfx/vmwgfx_drv.c +++ b/trunk/drivers/gpu/drm/vmwgfx/vmwgfx_drv.c @@ -395,7 +395,9 @@ void vmw_3d_resource_dec(struct vmw_private *dev_priv, * Sets the initial_[width|height] fields on the given vmw_private. * * It does so by reading SVGA_REG_[WIDTH|HEIGHT] regs and then - * capping the value to fb_max_[width|height] fields and the + * clamping the value to fb_max_[width|height] fields and the + * VMW_MIN_INITIAL_[WIDTH|HEIGHT]. + * If the values appear to be invalid, set them to * VMW_MIN_INITIAL_[WIDTH|HEIGHT]. */ static void vmw_get_initial_size(struct vmw_private *dev_priv) @@ -407,10 +409,18 @@ static void vmw_get_initial_size(struct vmw_private *dev_priv) height = vmw_read(dev_priv, SVGA_REG_HEIGHT); width = max_t(uint32_t, width, VMW_MIN_INITIAL_WIDTH); - width = min_t(uint32_t, width, dev_priv->fb_max_width); - height = max_t(uint32_t, height, VMW_MIN_INITIAL_HEIGHT); - height = min_t(uint32_t, height, dev_priv->fb_max_height); + + if (width > dev_priv->fb_max_width || + height > dev_priv->fb_max_height) { + + /* + * This is a host error and shouldn't occur. + */ + + width = VMW_MIN_INITIAL_WIDTH; + height = VMW_MIN_INITIAL_HEIGHT; + } dev_priv->initial_width = width; dev_priv->initial_height = height;