[Spice-devel] [PATCH xf86-qxl] drm: fail gracefuly on monitor resize

Marc-André Lureau marcandre.lureau at redhat.com
Fri Aug 8 10:35:27 PDT 2014


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



More information about the Spice-devel mailing list