|
Petr Tesarik |
2f419d |
From: Deepak Rawat <drawat@vmware.com>
|
|
Petr Tesarik |
2f419d |
Date: Thu, 13 Sep 2018 12:34:37 +0200
|
|
Petr Tesarik |
2f419d |
Subject: drm/vmwgfx: limit screen size to stdu_max during check_modeset
|
|
Petr Tesarik |
2f419d |
Git-commit: 0c1b174b1b9a497230f937345d4db76fea267398
|
|
Petr Tesarik |
2f419d |
Patch-mainline: v4.19-rc5
|
|
Petr Tesarik |
2f419d |
References: FATE#326289 FATE#326079 FATE#326049 FATE#322398 FATE#326166
|
|
Petr Tesarik |
2f419d |
|
|
Petr Tesarik |
2f419d |
For STDU individual screen target size is limited by
|
|
Petr Tesarik |
2f419d |
SVGA_REG_SCREENTARGET_MAX_WIDTH/HEIGHT registers so add that limit
|
|
Petr Tesarik |
2f419d |
during atomic check_modeset.
|
|
Petr Tesarik |
2f419d |
|
|
Petr Tesarik |
2f419d |
An additional limit is placed in the update_layout ioctl to avoid
|
|
Petr Tesarik |
2f419d |
requesting layouts that current user-space typically can't support.
|
|
Petr Tesarik |
2f419d |
Also modified the comments to reflect current limitation on topology.
|
|
Petr Tesarik |
2f419d |
|
|
Petr Tesarik |
2f419d |
Signed-off-by: Deepak Rawat <drawat@vmware.com>
|
|
Petr Tesarik |
2f419d |
Reviewed-by: Sinclair Yeh <syeh@vmware.com>
|
|
Petr Tesarik |
2f419d |
Reviewed-by: Thomas Hellstrom <thellstrom@vmware.com>
|
|
Petr Tesarik |
2f419d |
Signed-off-by: Thomas Hellstrom <thellstrom@vmware.com>
|
|
Petr Tesarik |
2f419d |
Acked-by: Petr Tesarik <ptesarik@suse.com>
|
|
Petr Tesarik |
2f419d |
---
|
|
Petr Tesarik |
2f419d |
drivers/gpu/drm/vmwgfx/vmwgfx_kms.c | 30 ++++++++++++++++++++++--------
|
|
Petr Tesarik |
2f419d |
1 file changed, 22 insertions(+), 8 deletions(-)
|
|
Petr Tesarik |
2f419d |
|
|
Petr Tesarik |
2f419d |
--- a/drivers/gpu/drm/vmwgfx/vmwgfx_kms.c
|
|
Petr Tesarik |
2f419d |
+++ b/drivers/gpu/drm/vmwgfx/vmwgfx_kms.c
|
|
Petr Tesarik |
2f419d |
@@ -1512,21 +1512,19 @@ static int vmw_kms_check_display_memory(
|
|
Petr Tesarik |
2f419d |
struct drm_rect *rects)
|
|
Petr Tesarik |
2f419d |
{
|
|
Petr Tesarik |
2f419d |
struct vmw_private *dev_priv = vmw_priv(dev);
|
|
Petr Tesarik |
2f419d |
- struct drm_mode_config *mode_config = &dev->mode_config;
|
|
Petr Tesarik |
2f419d |
struct drm_rect bounding_box = {0};
|
|
Petr Tesarik |
2f419d |
u64 total_pixels = 0, pixel_mem, bb_mem;
|
|
Petr Tesarik |
2f419d |
int i;
|
|
Petr Tesarik |
2f419d |
|
|
Petr Tesarik |
2f419d |
for (i = 0; i < num_rects; i++) {
|
|
Petr Tesarik |
2f419d |
/*
|
|
Petr Tesarik |
2f419d |
- * Currently this check is limiting the topology within max
|
|
Petr Tesarik |
2f419d |
- * texture/screentarget size. This should change in future when
|
|
Petr Tesarik |
2f419d |
- * user-space support multiple fb with topology.
|
|
Petr Tesarik |
2f419d |
+ * For STDU only individual screen (screen target) is limited by
|
|
Petr Tesarik |
2f419d |
+ * SCREENTARGET_MAX_WIDTH/HEIGHT registers.
|
|
Petr Tesarik |
2f419d |
*/
|
|
Petr Tesarik |
2f419d |
- if (rects[i].x1 < 0 || rects[i].y1 < 0 ||
|
|
Petr Tesarik |
2f419d |
- rects[i].x2 > mode_config->max_width ||
|
|
Petr Tesarik |
2f419d |
- rects[i].y2 > mode_config->max_height) {
|
|
Petr Tesarik |
2f419d |
- DRM_ERROR("Invalid GUI layout.\n");
|
|
Petr Tesarik |
2f419d |
+ if (dev_priv->active_display_unit == vmw_du_screen_target &&
|
|
Petr Tesarik |
2f419d |
+ (drm_rect_width(&rects[i]) > dev_priv->stdu_max_width ||
|
|
Petr Tesarik |
2f419d |
+ drm_rect_height(&rects[i]) > dev_priv->stdu_max_height)) {
|
|
Petr Tesarik |
2f419d |
+ DRM_ERROR("Screen size not supported.\n");
|
|
Petr Tesarik |
2f419d |
return -EINVAL;
|
|
Petr Tesarik |
2f419d |
}
|
|
Petr Tesarik |
2f419d |
|
|
Petr Tesarik |
2f419d |
@@ -2376,6 +2374,7 @@ int vmw_kms_update_layout_ioctl(struct d
|
|
Petr Tesarik |
2f419d |
struct drm_file *file_priv)
|
|
Petr Tesarik |
2f419d |
{
|
|
Petr Tesarik |
2f419d |
struct vmw_private *dev_priv = vmw_priv(dev);
|
|
Petr Tesarik |
2f419d |
+ struct drm_mode_config *mode_config = &dev->mode_config;
|
|
Petr Tesarik |
2f419d |
struct drm_vmw_update_layout_arg *arg =
|
|
Petr Tesarik |
2f419d |
(struct drm_vmw_update_layout_arg *)data;
|
|
Petr Tesarik |
2f419d |
void __user *user_rects;
|
|
Petr Tesarik |
2f419d |
@@ -2421,6 +2420,21 @@ int vmw_kms_update_layout_ioctl(struct d
|
|
Petr Tesarik |
2f419d |
drm_rects[i].y1 = curr_rect.y;
|
|
Petr Tesarik |
2f419d |
drm_rects[i].x2 = curr_rect.x + curr_rect.w;
|
|
Petr Tesarik |
2f419d |
drm_rects[i].y2 = curr_rect.y + curr_rect.h;
|
|
Petr Tesarik |
2f419d |
+
|
|
Petr Tesarik |
2f419d |
+ /*
|
|
Petr Tesarik |
2f419d |
+ * Currently this check is limiting the topology within
|
|
Petr Tesarik |
2f419d |
+ * mode_config->max (which actually is max texture size
|
|
Petr Tesarik |
2f419d |
+ * supported by virtual device). This limit is here to address
|
|
Petr Tesarik |
2f419d |
+ * window managers that create a big framebuffer for whole
|
|
Petr Tesarik |
2f419d |
+ * topology.
|
|
Petr Tesarik |
2f419d |
+ */
|
|
Petr Tesarik |
2f419d |
+ if (drm_rects[i].x1 < 0 || drm_rects[i].y1 < 0 ||
|
|
Petr Tesarik |
2f419d |
+ drm_rects[i].x2 > mode_config->max_width ||
|
|
Petr Tesarik |
2f419d |
+ drm_rects[i].y2 > mode_config->max_height) {
|
|
Petr Tesarik |
2f419d |
+ DRM_ERROR("Invalid GUI layout.\n");
|
|
Petr Tesarik |
2f419d |
+ ret = -EINVAL;
|
|
Petr Tesarik |
2f419d |
+ goto out_free;
|
|
Petr Tesarik |
2f419d |
+ }
|
|
Petr Tesarik |
2f419d |
}
|
|
Petr Tesarik |
2f419d |
|
|
Petr Tesarik |
2f419d |
ret = vmw_kms_check_display_memory(dev, arg->num_outputs, drm_rects);
|