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

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxxxxxxxxxxxxxxxx
http://lists.freedesktop.org/mailman/listinfo/spice-devel




[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Security]     [Bugtraq]     [Linux]     [Linux OMAP]     [Linux MIPS]     [ECOS]     [Asterisk Internet PBX]     [Linux API]     [Monitors]