[PATCH v2] Handle failures in setting a CRTC to a DRM mode properly

Michel Dänzer michel at daenzer.net
Mon Oct 26 02:39:58 PDT 2015


On 23.10.2015 22:59, cpaul at redhat.com wrote:
> 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.
> 
> Signed-off-by: Stephen Chandler Paul <cpaul at redhat.com>
> Reviewed-by: Michel Dänzer <michel.daenzer at amd.com>
> ---
> 				    Changes
> * We no longer assign the return value of drmModeSetCrtc to ret, instead we
>   just check it in the conditional
> 
>  src/drmmode_display.c | 11 +++++++----
>  1 file changed, 7 insertions(+), 4 deletions(-)
> 
> diff --git a/src/drmmode_display.c b/src/drmmode_display.c
> index 64e79d4..f0f121e 100644
> --- a/src/drmmode_display.c
> +++ b/src/drmmode_display.c
> @@ -760,12 +760,15 @@ drmmode_set_mode_major(xf86CrtcPtr crtc, DisplayModePtr mode,
>  				radeon_bo_wait(drmmode_crtc->scanout[0].bo);
>  			}
>  		}
> -		ret = drmModeSetCrtc(drmmode->fd, drmmode_crtc->mode_crtc->crtc_id,
> -				     fb_id, x, y, output_ids, output_count, &kmode);
> -		if (ret)
> +		if (drmModeSetCrtc(drmmode->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));

errno must be passed instead of -ret to strerror. I pushed the patch
with that fixed, thanks!


-- 
Earthling Michel Dänzer               |               http://www.amd.com
Libre software enthusiast             |             Mesa and X developer


More information about the xorg-devel mailing list