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

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

 



On Wed, 2012-10-31 at 23:46 +0100, Daniel Vetter wrote:
> 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?

There isn't such a test case yet, but this bug is triggered with what we
have already, the 'wait-for-vblank + dpms off' test. But it might make
sense to delay the vblank as you say, in case disabling takes a long
time and the vblank arrives before we get to drm_vblank_off(). I can add
something for that.

--Imre

> -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
> 




[Index of Archives]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]
  Powered by Linux