aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/gpu
diff options
context:
space:
mode:
authorMarc-André Lureau <marcandre.lureau@gmail.com>2014-10-16 05:39:44 -0400
committerDave Airlie <airlied@redhat.com>2014-10-21 21:11:50 -0400
commitc572aaf46f71f63ae5914d4e194a955e0ba1b519 (patch)
tree4985ee124bc3081dc90961663464f4965a8a683c /drivers/gpu
parente800cab3a72892134bde4b72ada063a75683c66b (diff)
qxl: don't create too large primary surface
Limit primary to qemu vgamem size, to avoid reaching qemu guest bug "requested primary larger than framebuffer" on resizing screen too large to fit. Remove unneeded and misleading variables. Related to: https://bugzilla.redhat.com/show_bug.cgi?id=1127552 Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com> Cc: stable@vger.kernel.org Signed-off-by: Dave Airlie <airlied@redhat.com>
Diffstat (limited to 'drivers/gpu')
-rw-r--r--drivers/gpu/drm/qxl/qxl_display.c16
1 files changed, 8 insertions, 8 deletions
diff --git a/drivers/gpu/drm/qxl/qxl_display.c b/drivers/gpu/drm/qxl/qxl_display.c
index af9e78546688..0d1396266857 100644
--- a/drivers/gpu/drm/qxl/qxl_display.c
+++ b/drivers/gpu/drm/qxl/qxl_display.c
@@ -572,7 +572,6 @@ static int qxl_crtc_mode_set(struct drm_crtc *crtc,
572 struct qxl_framebuffer *qfb; 572 struct qxl_framebuffer *qfb;
573 struct qxl_bo *bo, *old_bo = NULL; 573 struct qxl_bo *bo, *old_bo = NULL;
574 struct qxl_crtc *qcrtc = to_qxl_crtc(crtc); 574 struct qxl_crtc *qcrtc = to_qxl_crtc(crtc);
575 uint32_t width, height, base_offset;
576 bool recreate_primary = false; 575 bool recreate_primary = false;
577 int ret; 576 int ret;
578 int surf_id; 577 int surf_id;
@@ -602,9 +601,10 @@ static int qxl_crtc_mode_set(struct drm_crtc *crtc,
602 if (qcrtc->index == 0) 601 if (qcrtc->index == 0)
603 recreate_primary = true; 602 recreate_primary = true;
604 603
605 width = mode->hdisplay; 604 if (bo->surf.stride * bo->surf.height > qdev->vram_size) {
606 height = mode->vdisplay; 605 DRM_ERROR("Mode doesn't fit in vram size (vgamem)");
607 base_offset = 0; 606 return -EINVAL;
607 }
608 608
609 ret = qxl_bo_reserve(bo, false); 609 ret = qxl_bo_reserve(bo, false);
610 if (ret != 0) 610 if (ret != 0)
@@ -618,10 +618,10 @@ static int qxl_crtc_mode_set(struct drm_crtc *crtc,
618 if (recreate_primary) { 618 if (recreate_primary) {
619 qxl_io_destroy_primary(qdev); 619 qxl_io_destroy_primary(qdev);
620 qxl_io_log(qdev, 620 qxl_io_log(qdev,
621 "recreate primary: %dx%d (was %dx%d,%d,%d)\n", 621 "recreate primary: %dx%d,%d,%d\n",
622 width, height, bo->surf.width, 622 bo->surf.width, bo->surf.height,
623 bo->surf.height, bo->surf.stride, bo->surf.format); 623 bo->surf.stride, bo->surf.format);
624 qxl_io_create_primary(qdev, base_offset, bo); 624 qxl_io_create_primary(qdev, 0, bo);
625 bo->is_primary = true; 625 bo->is_primary = true;
626 } 626 }
627 627