[Intel-gfx] [PATCH 2/2] drm/i915: lock event_lock for drm_vblank_off()

Daniel Vetter daniel at ffwll.ch
Wed Oct 31 23:46:08 CET 2012


On Thu, Nov 01, 2012 at 12:03:39AM +0200, Imre Deak wrote:
> drm_vblank_off() requires callers to hold the event_lock.
> 
> Signed-off-by: Imre Deak <imre.deak at intel.com>

Hm, do we put this code through its paces already in flip_test by
scheduling a vblank wait in the future (a second or so), and then
disabling the display?
-Daniel
> ---
>  drivers/gpu/drm/i915/intel_display.c |   15 +++++++++++++++
>  1 file changed, 15 insertions(+)
> 
> diff --git a/drivers/gpu/drm/i915/intel_display.c b/drivers/gpu/drm/i915/intel_display.c
> index b453901..56f1119 100644
> --- a/drivers/gpu/drm/i915/intel_display.c
> +++ b/drivers/gpu/drm/i915/intel_display.c
> @@ -3413,6 +3413,7 @@ static void ironlake_crtc_disable(struct drm_crtc *crtc)
>  	struct intel_encoder *encoder;
>  	int pipe = intel_crtc->pipe;
>  	int plane = intel_crtc->plane;
> +	unsigned long flags;
>  	u32 reg, temp;
>  
>  
> @@ -3423,7 +3424,11 @@ static void ironlake_crtc_disable(struct drm_crtc *crtc)
>  		encoder->disable(encoder);
>  
>  	intel_crtc_wait_for_pending_flips(crtc);
> +
> +	spin_lock_irqsave(&dev->event_lock, flags);
>  	drm_vblank_off(dev, pipe);
> +	spin_unlock_irqrestore(&dev->event_lock, flags);
> +
>  	intel_crtc_update_cursor(crtc, false);
>  
>  	intel_disable_plane(dev_priv, plane, pipe);
> @@ -3495,6 +3500,7 @@ static void haswell_crtc_disable(struct drm_crtc *crtc)
>  	int plane = intel_crtc->plane;
>  	enum transcoder cpu_transcoder = intel_crtc->cpu_transcoder;
>  	bool is_pch_port;
> +	unsigned long flags;
>  
>  	if (!intel_crtc->active)
>  		return;
> @@ -3505,7 +3511,11 @@ static void haswell_crtc_disable(struct drm_crtc *crtc)
>  		encoder->disable(encoder);
>  
>  	intel_crtc_wait_for_pending_flips(crtc);
> +
> +	spin_lock_irqsave(&dev->event_lock, flags);
>  	drm_vblank_off(dev, pipe);
> +	spin_unlock_irqrestore(&dev->event_lock, flags);
> +
>  	intel_crtc_update_cursor(crtc, false);
>  
>  	intel_disable_plane(dev_priv, plane, pipe);
> @@ -3617,6 +3627,7 @@ static void i9xx_crtc_disable(struct drm_crtc *crtc)
>  	struct intel_encoder *encoder;
>  	int pipe = intel_crtc->pipe;
>  	int plane = intel_crtc->plane;
> +	unsigned long flags;
>  
>  
>  	if (!intel_crtc->active)
> @@ -3627,7 +3638,11 @@ static void i9xx_crtc_disable(struct drm_crtc *crtc)
>  
>  	/* Give the overlay scaler a chance to disable if it's on this pipe */
>  	intel_crtc_wait_for_pending_flips(crtc);
> +
> +	spin_lock_irqsave(&dev->event_lock, flags);
>  	drm_vblank_off(dev, pipe);
> +	spin_unlock_irqrestore(&dev->event_lock, flags);
> +
>  	intel_crtc_dpms_overlay(intel_crtc, false);
>  	intel_crtc_update_cursor(crtc, false);
>  
> -- 
> 1.7.9.5
> 
> _______________________________________________
> dri-devel mailing list
> dri-devel at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/dri-devel

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



More information about the Intel-gfx mailing list