Commit faabb12b authored by Marc-André Lureau's avatar Marc-André Lureau Committed by Luis Henriques

qxl: don't create too large primary surface

commit c572aaf4 upstream.

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=1127552Signed-off-by: default avatarMarc-André Lureau <marcandre.lureau@redhat.com>
Signed-off-by: default avatarDave Airlie <airlied@redhat.com>
Signed-off-by: default avatarLuis Henriques <luis.henriques@canonical.com>
parent 7e35ef04
...@@ -523,7 +523,6 @@ static int qxl_crtc_mode_set(struct drm_crtc *crtc, ...@@ -523,7 +523,6 @@ static int qxl_crtc_mode_set(struct drm_crtc *crtc,
struct qxl_framebuffer *qfb; struct qxl_framebuffer *qfb;
struct qxl_bo *bo, *old_bo = NULL; struct qxl_bo *bo, *old_bo = NULL;
struct qxl_crtc *qcrtc = to_qxl_crtc(crtc); struct qxl_crtc *qcrtc = to_qxl_crtc(crtc);
uint32_t width, height, base_offset;
bool recreate_primary = false; bool recreate_primary = false;
int ret; int ret;
int surf_id; int surf_id;
...@@ -553,9 +552,10 @@ static int qxl_crtc_mode_set(struct drm_crtc *crtc, ...@@ -553,9 +552,10 @@ static int qxl_crtc_mode_set(struct drm_crtc *crtc,
if (qcrtc->index == 0) if (qcrtc->index == 0)
recreate_primary = true; recreate_primary = true;
width = mode->hdisplay; if (bo->surf.stride * bo->surf.height > qdev->vram_size) {
height = mode->vdisplay; DRM_ERROR("Mode doesn't fit in vram size (vgamem)");
base_offset = 0; return -EINVAL;
}
ret = qxl_bo_reserve(bo, false); ret = qxl_bo_reserve(bo, false);
if (ret != 0) if (ret != 0)
...@@ -569,10 +569,10 @@ static int qxl_crtc_mode_set(struct drm_crtc *crtc, ...@@ -569,10 +569,10 @@ static int qxl_crtc_mode_set(struct drm_crtc *crtc,
if (recreate_primary) { if (recreate_primary) {
qxl_io_destroy_primary(qdev); qxl_io_destroy_primary(qdev);
qxl_io_log(qdev, qxl_io_log(qdev,
"recreate primary: %dx%d (was %dx%d,%d,%d)\n", "recreate primary: %dx%d,%d,%d\n",
width, height, bo->surf.width, bo->surf.width, bo->surf.height,
bo->surf.height, bo->surf.stride, bo->surf.format); bo->surf.stride, bo->surf.format);
qxl_io_create_primary(qdev, base_offset, bo); qxl_io_create_primary(qdev, 0, bo);
bo->is_primary = true; bo->is_primary = true;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment