<div dir="ltr">ping<br></div><div class="gmail_extra"><br><div class="gmail_quote">On Thu, Oct 16, 2014 at 11:39 AM, Marc-André Lureau <span dir="ltr"><<a href="mailto:marcandre.lureau@gmail.com" target="_blank">marcandre.lureau@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Limit primary to qemu vgamem size, to avoid reaching<br>
qemu guest bug "requested primary larger than framebuffer"<br>
on resizing screen too large to fit.<br>
<br>
Remove unneeded and misleading variables.<br>
<br>
Related to:<br>
<a href="https://bugzilla.redhat.com/show_bug.cgi?id=1127552" target="_blank">https://bugzilla.redhat.com/show_bug.cgi?id=1127552</a><br>
<br>
Signed-off-by: Marc-André Lureau <<a href="mailto:marcandre.lureau@redhat.com">marcandre.lureau@redhat.com</a>><br>
---<br>
 drivers/gpu/drm/qxl/qxl_display.c | 16 ++++++++--------<br>
 1 file changed, 8 insertions(+), 8 deletions(-)<br>
<br>
diff --git a/drivers/gpu/drm/qxl/qxl_display.c b/drivers/gpu/drm/qxl/qxl_display.c<br>
index 5d7ea24..98a344c 100644<br>
--- a/drivers/gpu/drm/qxl/qxl_display.c<br>
+++ b/drivers/gpu/drm/qxl/qxl_display.c<br>
@@ -523,7 +523,6 @@ static int qxl_crtc_mode_set(struct drm_crtc *crtc,<br>
        struct qxl_framebuffer *qfb;<br>
        struct qxl_bo *bo, *old_bo = NULL;<br>
        struct qxl_crtc *qcrtc = to_qxl_crtc(crtc);<br>
-       uint32_t width, height, base_offset;<br>
        bool recreate_primary = false;<br>
        int ret;<br>
        int surf_id;<br>
@@ -553,9 +552,10 @@ static int qxl_crtc_mode_set(struct drm_crtc *crtc,<br>
        if (qcrtc->index == 0)<br>
                recreate_primary = true;<br>
<br>
-       width = mode->hdisplay;<br>
-       height = mode->vdisplay;<br>
-       base_offset = 0;<br>
+       if (bo->surf.stride * bo->surf.height > qdev->vram_size) {<br>
+               DRM_ERROR("Mode doesn't fit in vram size (vgamem)");<br>
+               return -EINVAL;<br>
+        }<br>
<br>
        ret = qxl_bo_reserve(bo, false);<br>
        if (ret != 0)<br>
@@ -569,10 +569,10 @@ static int qxl_crtc_mode_set(struct drm_crtc *crtc,<br>
        if (recreate_primary) {<br>
                qxl_io_destroy_primary(qdev);<br>
                qxl_io_log(qdev,<br>
-                          "recreate primary: %dx%d (was %dx%d,%d,%d)\n",<br>
-                          width, height, bo->surf.width,<br>
-                          bo->surf.height, bo->surf.stride, bo->surf.format);<br>
-               qxl_io_create_primary(qdev, base_offset, bo);<br>
+                          "recreate primary: %dx%d,%d,%d\n",<br>
+                          bo->surf.width, bo->surf.height,<br>
+                          bo->surf.stride, bo->surf.format);<br>
+               qxl_io_create_primary(qdev, 0, bo);<br>
                bo->is_primary = true;<br>
        }<br>
<span class="HOEnZb"><font color="#888888"><br>
--<br>
1.9.3<br>
<br>
</font></span></blockquote></div><br><br clear="all"><br>-- <br>Marc-André Lureau
</div>