summaryrefslogtreecommitdiff
path: root/drivers/gpu/drm/vmwgfx/vmwgfx_surface.c
diff options
context:
space:
mode:
authorSinclair Yeh <syeh@vmware.com>2017-03-27 21:12:27 +0300
committerSinclair Yeh <syeh@vmware.com>2017-04-01 01:21:20 +0300
commit28c954299cd2b5cb5411816c9eeaf3f51ed4638e (patch)
tree8d6afa1906526ea636035af1bbbc7f177cb02a1a /drivers/gpu/drm/vmwgfx/vmwgfx_surface.c
parent810b3e1683d00e51c8392bcee7dc7a1c65354777 (diff)
downloadlinux-28c954299cd2b5cb5411816c9eeaf3f51ed4638e.tar.xz
drm/vmwgfx: Properly check display/scanout surface size
The scanout surface size is the smaller of max texture size and max STDU size. Signed-off-by: Sinclair Yeh <syeh@vmware.com> Reviewed-by: Thomas Hellstrom <thellstrom@vmware.com>
Diffstat (limited to 'drivers/gpu/drm/vmwgfx/vmwgfx_surface.c')
-rw-r--r--drivers/gpu/drm/vmwgfx/vmwgfx_surface.c14
1 files changed, 14 insertions, 0 deletions
diff --git a/drivers/gpu/drm/vmwgfx/vmwgfx_surface.c b/drivers/gpu/drm/vmwgfx/vmwgfx_surface.c
index 6abcf82d8a39..41b9d20d6ae7 100644
--- a/drivers/gpu/drm/vmwgfx/vmwgfx_surface.c
+++ b/drivers/gpu/drm/vmwgfx/vmwgfx_surface.c
@@ -1479,10 +1479,24 @@ int vmw_surface_gb_priv_define(struct drm_device *dev,
*srf_out = NULL;
if (for_scanout) {
+ uint32_t max_width, max_height;
+
if (!svga3dsurface_is_screen_target_format(format)) {
DRM_ERROR("Invalid Screen Target surface format.");
return -EINVAL;
}
+
+ max_width = min(dev_priv->texture_max_width,
+ dev_priv->stdu_max_width);
+ max_height = min(dev_priv->texture_max_height,
+ dev_priv->stdu_max_height);
+
+ if (size.width > max_width || size.height > max_height) {
+ DRM_ERROR("%ux%u\n, exeeds max surface size %ux%u",
+ size.width, size.height,
+ max_width, max_height);
+ return -EINVAL;
+ }
} else {
const struct svga3d_surface_desc *desc;