[PATCH xf86-video-amdgpu 2/2] Handle failures in setting a CRTC to a DRM mode properly

Alex Deucher alexdeucher at gmail.com
Tue Nov 17 09:54:30 PST 2015


From: Stephen Chandler Paul <cpaul at redhat.com>

This fixes a bug where running the card out of PPLL's when hotplugging
another monitor would result in all of the displays going blank and
failing to work properly until X was restarted or the user switched to
another VT.

[Michel Dänzer: Pass errno instead of -ret to strerror()]

Signed-off-by: Stephen Chandler Paul <cpaul at redhat.com>
Reviewed-by: Michel Dänzer <michel.daenzer at amd.com>

Ported from radeon commit:
7186a8713ba004de4991f21c1a9fc4abc62aeff4
---
 src/drmmode_display.c | 16 +++++++++-------
 1 file changed, 9 insertions(+), 7 deletions(-)

diff --git a/src/drmmode_display.c b/src/drmmode_display.c
index cd401af..fcd3e9d 100644
--- a/src/drmmode_display.c
+++ b/src/drmmode_display.c
@@ -699,14 +699,16 @@ drmmode_set_mode_major(xf86CrtcPtr crtc, DisplayModePtr mode,
 				amdgpu_glamor_finish(pScrn);
 			}
 		}
-		ret =
-		    drmModeSetCrtc(pAMDGPUEnt->fd,
-				   drmmode_crtc->mode_crtc->crtc_id, fb_id, x,
-				   y, output_ids, output_count, &kmode);
-		if (ret)
+
+		if (drmModeSetCrtc(pAMDGPUEnt->fd,
+				   drmmode_crtc->mode_crtc->crtc_id,
+				   fb_id, x, y, output_ids,
+				   output_count, &kmode) != 0) {
 			xf86DrvMsg(crtc->scrn->scrnIndex, X_ERROR,
-				   "failed to set mode: %s", strerror(-ret));
-		else
+				   "failed to set mode: %s", strerror(errno));
+			ret = FALSE;
+			goto done;
+		} else
 			ret = TRUE;
 
 		if (crtc->scrn->pScreen)
-- 
1.8.3.1



More information about the xorg-driver-ati mailing list