Re: [PATCH] drm/atomic-helper: Do not assume vblank is always present

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

 



Hello Zack,

Thanks for your patch.

Zack Rusin <zack@xxxxxxx> writes:

> From: Zack Rusin <zackr@xxxxxxxxxx>
>
> Many drivers (in particular all of the virtualized drivers) do not
> implement vblank handling. Assuming vblank is always present
> leads to crashes.
>
> Fix the crashes by making sure the device supports vblank before using
> it.
>

[...]

> diff --git a/drivers/gpu/drm/drm_vblank.c b/drivers/gpu/drm/drm_vblank.c
> index 299fa2a19a90..6438aeb1c65f 100644
> --- a/drivers/gpu/drm/drm_vblank.c
> +++ b/drivers/gpu/drm/drm_vblank.c
> @@ -997,12 +997,16 @@ int drm_crtc_next_vblank_start(struct drm_crtc *crtc, ktime_t *vblanktime)
>  {
>  	unsigned int pipe = drm_crtc_index(crtc);
>  	struct drm_vblank_crtc *vblank = &crtc->dev->vblank[pipe];
> -	struct drm_display_mode *mode = &vblank->hwmode;
> +	struct drm_display_mode *mode;
>  	u64 vblank_start;
>  
> +	if (!drm_dev_has_vblank(crtc->dev))
> +		return -EINVAL;
> +
>  	if (!vblank->framedur_ns || !vblank->linedur_ns)
>  		return -EINVAL;
>  
> +	mode = &vblank->hwmode;
>  	if (!drm_crtc_get_last_vbltimestamp(crtc, vblanktime, false))
>  		return -EINVAL;
>  

Rob already posted more or less the same fix:

https://lore.kernel.org/lkml/CAF6AEGsdT95-uAKcv2+hdMLKd2xwfPeN+FMuDTRMc-Ps7WbRjw@xxxxxxxxxxxxxx/T/

-- 
Best regards,

Javier Martinez Canillas
Core Platforms
Red Hat




[Index of Archives]     [Linux DRI Users]     [Linux Intel Graphics]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [XFree86]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [XFree86]
  Powered by Linux