xf86-video-ati: Branch 'master'

Michel Dänzer daenzer at kemper.freedesktop.org
Wed Feb 21 16:52:44 UTC 2018


 src/drmmode_display.c |   32 +++++++++++++++++++++++++-------
 1 file changed, 25 insertions(+), 7 deletions(-)

New commits:
commit f777e909fd23e063729ecb038997db445f82ef5e
Author: Michel Dänzer <michel.daenzer at amd.com>
Date:   Fri Feb 16 16:55:03 2018 +0100

    Don't bail from drmmode_set_desired_modes immediately
    
    If we fail to find or set the mode for a CRTC, keep trying for the
    remaining CRTCs, and only return FALSE if we failed for all CRTCs that
    should be on.
    
    (Ported from amdgpu commit f5ac5f385f41d1547cfd7ccc8bb35a537a8fffeb)

diff --git a/src/drmmode_display.c b/src/drmmode_display.c
index f94f70bf..517ec8fb 100644
--- a/src/drmmode_display.c
+++ b/src/drmmode_display.c
@@ -2717,6 +2717,7 @@ Bool drmmode_set_desired_modes(ScrnInfoPtr pScrn, drmmode_ptr drmmode,
 {
 	xf86CrtcConfigPtr   config = XF86_CRTC_CONFIG_PTR(pScrn);
 	RADEONEntPtr pRADEONEnt = RADEONEntPriv(pScrn);
+	unsigned num_desired = 0, num_on = 0;
 	int c;
 
 	for (c = 0; c < config->num_crtc; c++) {
@@ -2753,14 +2754,19 @@ Bool drmmode_set_desired_modes(ScrnInfoPtr pScrn, drmmode_ptr drmmode,
 		if (!output)
 			continue;
 
+		num_desired++;
+
 		/* Mark that we'll need to re-set the mode for sure */
 		memset(&crtc->mode, 0, sizeof(crtc->mode));
 		if (!crtc->desiredMode.CrtcHDisplay)
 		{
 			DisplayModePtr  mode = xf86OutputFindClosestMode (output, pScrn->currentMode);
 
-			if (!mode)
-				return FALSE;
+			if (!mode) {
+				xf86DrvMsg(pScrn->scrnIndex, X_WARNING,
+					   "Failed to find mode for CRTC %d\n", c);
+				continue;
+			}
 			crtc->desiredMode = *mode;
 			crtc->desiredRotation = RR_Rotate_0;
 			crtc->desiredX = 0;
@@ -2768,18 +2774,30 @@ Bool drmmode_set_desired_modes(ScrnInfoPtr pScrn, drmmode_ptr drmmode,
 		}
 
 		if (set_hw) {
-			if (!crtc->funcs->set_mode_major(crtc, &crtc->desiredMode, crtc->desiredRotation,
-							 crtc->desiredX, crtc->desiredY))
-				return FALSE;
+			if (crtc->funcs->set_mode_major(crtc, &crtc->desiredMode,
+							crtc->desiredRotation,
+							crtc->desiredX,
+							crtc->desiredY)) {
+				num_on++;
+			} else {
+				xf86DrvMsg(pScrn->scrnIndex, X_WARNING,
+					   "Failed to set mode on CRTC %d\n", c);
+			}
 		} else {
 			crtc->mode = crtc->desiredMode;
 			crtc->rotation = crtc->desiredRotation;
 			crtc->x = crtc->desiredX;
 			crtc->y = crtc->desiredY;
-			if (!drmmode_handle_transform(crtc))
-				return FALSE;
+			if (drmmode_handle_transform(crtc))
+				num_on++;
 		}
 	}
+
+	if (num_on == 0 && num_desired > 0) {
+		xf86DrvMsg(pScrn->scrnIndex, X_ERROR, "Failed to enable any CRTC\n");
+		return FALSE;
+	}
+
 	return TRUE;
 }
 


More information about the xorg-commit mailing list