[PATCH 2/2] drm: WARN if drm_handle_vblank is called errornously

Daniel Vetter daniel at ffwll.ch
Mon Feb 23 01:52:45 PST 2015


On Sun, Feb 22, 2015 at 03:11:20PM +0100, Daniel Vetter wrote:
> KMS drivers are in full control of their irq and vblank handling, if
> they get a vblank interrupt before drm_vblank_init or after
> drm_vblank_cleanup that's just a driver bug.
> 
> For ums driver there's only r128 and radeon which support vblank, and
> they call drm_vblank_init in their driver load functions. Which again
> means that userspace can do whatever it wants with interrupt, vblank
> structures will always be there.
> 
> So this should never happen, let's catch driver issues with a WARN_ON.
> Motivated by some discussions with Imre.
> 
> v2: Use WARN_ON_ONCE as suggested by Imre.
> 
> Cc: Imre Deak <imre.deak at intel.com>
> Reviewed-by: Imre Deak <imre.deak at intel.com>
> Signed-off-by: Daniel Vetter <daniel.vetter at intel.com>

Merged the entire series to dinq with Dave's irc-ack for the core bits.
Thanks a lot for the review feedback.
-Daniel

> ---
>  drivers/gpu/drm/drm_irq.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/gpu/drm/drm_irq.c b/drivers/gpu/drm/drm_irq.c
> index 3c18e522cc3b..dbece03979f3 100644
> --- a/drivers/gpu/drm/drm_irq.c
> +++ b/drivers/gpu/drm/drm_irq.c
> @@ -1682,7 +1682,7 @@ bool drm_handle_vblank(struct drm_device *dev, int crtc)
>  	struct timeval tvblank;
>  	unsigned long irqflags;
>  
> -	if (!dev->num_crtcs)
> +	if (WARN_ON_ONCE(!dev->num_crtcs))
>  		return false;
>  
>  	if (WARN_ON(crtc >= dev->num_crtcs))
> -- 
> 1.9.3
> 

-- 
Daniel Vetter
Software Engineer, Intel Corporation
+41 (0) 79 365 57 48 - http://blog.ffwll.ch


More information about the dri-devel mailing list