If drmModeSetCrtc() failed, try to fallback to previous working
configuration.

Related to:
https://bugzilla.redhat.com/show_bug.cgi?id=1127552
---
 src/qxl_drmmode.c | 11 +++++++----
 1 file changed, 7 insertions(+), 4 deletions(-)

diff --git a/src/qxl_drmmode.c b/src/qxl_drmmode.c
index f9eca5f..42347e6 100644
--- a/src/qxl_drmmode.c
+++ b/src/qxl_drmmode.c
@@ -214,11 +214,13 @@ drmmode_set_mode_major(xf86CrtcPtr crtc, DisplayModePtr 
mode,
                }
                ret = drmModeSetCrtc(drmmode->fd, 
drmmode_crtc->mode_crtc->crtc_id,
                                     fb_id, x, y, output_ids, output_count, 
&kmode);
-               if (ret)
+               if (ret) {
                        xf86DrvMsg(crtc->scrn->scrnIndex, X_ERROR,
                                   "failed to set mode: %s", strerror(-ret));
-               else
+                       return FALSE;
+               } else {
                        ret = TRUE;
+               }
 
                if (crtc->scrn->pScreen)
                        xf86CrtcSetScreenSubpixelOrder(crtc->scrn->pScreen);
@@ -825,8 +827,9 @@ drmmode_xf86crtc_resize (ScrnInfoPtr scrn, int width, int 
height)
                xf86CrtcPtr crtc = xf86_config->crtc[i];
                if (!crtc->enabled)
                        continue;
-               drmmode_set_mode_major(crtc, &crtc->mode, crtc->rotation,
-                                      crtc->x, crtc->y);
+               if (!drmmode_set_mode_major(crtc, &crtc->mode, crtc->rotation,
+                                            crtc->x, crtc->y))
+                    goto fail;
        }
 
        {
-- 
1.9.3

_______________________________________________
Spice-devel mailing list
Spice-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/spice-devel

Reply via email to