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

Alon Levy alon at pobox.com
Sat Aug 9 11:08:44 PDT 2014


On 08/08/2014 08:35 PM, Marc-André Lureau wrote:
> If drmModeSetCrtc() failed, try to fallback to previous working
> configuration.

ACK

> 
> 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;
>  	}
>  
>  	{
> 



More information about the Spice-devel mailing list