diff mbox

[v2,9/9] drm/i915: Leave interrupts enabled while disabling crtcs during suspend

Message ID 1401104792-26560-10-git-send-email-ville.syrjala@linux.intel.com (mailing list archive)
State New, archived
Headers show

Commit Message

Ville Syrjälä May 26, 2014, 11:46 a.m. UTC
From: Ville Syrjälä <ville.syrjala@linux.intel.com>

The new watermaek update mechanism requires interrupts to work
correctly. Because of this we need interrupts while disabling crtcs
during suspend. So move the irq disable to happen a bit later.

This also avoid clobbering the vblank.last count in case the
vblank interrupt was already disabled earlier by the timer.
In that case drm_vblank_off() will need .last to be correct so
that it can update the user visible vblank counter value
approapriately.

v2: Note vblank counter in commit message

Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
---
 drivers/gpu/drm/i915/i915_drv.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

Comments

Daniel Vetter May 26, 2014, 3:49 p.m. UTC | #1
On Mon, May 26, 2014 at 02:46:32PM +0300, ville.syrjala@linux.intel.com wrote:
> From: Ville Syrjälä <ville.syrjala@linux.intel.com>
> 
> The new watermaek update mechanism requires interrupts to work
> correctly. Because of this we need interrupts while disabling crtcs
> during suspend. So move the irq disable to happen a bit later.
> 
> This also avoid clobbering the vblank.last count in case the
> vblank interrupt was already disabled earlier by the timer.
> In that case drm_vblank_off() will need .last to be correct so
> that it can update the user visible vblank counter value
> approapriately.
> 
> v2: Note vblank counter in commit message
> 
> Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>

First round of this patch had a question from me whether we have
sufficient amounts of WARN_ON(! or !!dev->irqs_enabled) sprinkled all over
the place ... Do we have that?

I'm specifically thinking of places where we cancel some work/time
lauchned by interrupts and must have the guarantee in place that it can't
rearm.

Otoh we have places where we absolutely want interrupts to still work,
e.g. in gpu_idle.

Sprinkling some modeset amounts of WARNS in a follow-up would make me
really happy.
-Daniel

> ---
>  drivers/gpu/drm/i915/i915_drv.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/gpu/drm/i915/i915_drv.c b/drivers/gpu/drm/i915/i915_drv.c
> index 4619c9e..21554a0 100644
> --- a/drivers/gpu/drm/i915/i915_drv.c
> +++ b/drivers/gpu/drm/i915/i915_drv.c
> @@ -524,7 +524,6 @@ static int i915_drm_freeze(struct drm_device *dev)
>  			return error;
>  		}
>  
> -		drm_irq_uninstall(dev);
>  		dev_priv->enable_hotplug_processing = false;
>  
>  		intel_disable_gt_powersave(dev);
> @@ -541,6 +540,8 @@ static int i915_drm_freeze(struct drm_device *dev)
>  		}
>  		mutex_unlock(&dev->mode_config.mutex);
>  
> +		drm_irq_uninstall(dev);
> +
>  		intel_modeset_suspend_hw(dev);
>  	}
>  
> -- 
> 1.8.5.5
> 
> _______________________________________________
> Intel-gfx mailing list
> Intel-gfx@lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/intel-gfx
Matt Roper June 20, 2014, 6:10 p.m. UTC | #2
On Mon, May 26, 2014 at 02:46:32PM +0300, ville.syrjala@linux.intel.com wrote:
> From: Ville Syrjälä <ville.syrjala@linux.intel.com>
> 
> The new watermaek update mechanism requires interrupts to work

s/watermaek/watermark/

> correctly. Because of this we need interrupts while disabling crtcs
> during suspend. So move the irq disable to happen a bit later.

I'm not super familiar with this code, so I might be missing something,
but won't this cause us to call drm_irq_uninstall() and then potentially
dev->driver->get_vblank_counter() while the pipe is disabled (which will
result in get_vblank_counter() returning 0)?

Also, does it cause any problems if if our interrupt handler races with
intel_disable_pipe()?


Matt

> 
> This also avoid clobbering the vblank.last count in case the
> vblank interrupt was already disabled earlier by the timer.
> In that case drm_vblank_off() will need .last to be correct so
> that it can update the user visible vblank counter value
> approapriately.
> 
> v2: Note vblank counter in commit message
> 
> Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
> ---
>  drivers/gpu/drm/i915/i915_drv.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/gpu/drm/i915/i915_drv.c b/drivers/gpu/drm/i915/i915_drv.c
> index 4619c9e..21554a0 100644
> --- a/drivers/gpu/drm/i915/i915_drv.c
> +++ b/drivers/gpu/drm/i915/i915_drv.c
> @@ -524,7 +524,6 @@ static int i915_drm_freeze(struct drm_device *dev)
>  			return error;
>  		}
>  
> -		drm_irq_uninstall(dev);
>  		dev_priv->enable_hotplug_processing = false;
>  
>  		intel_disable_gt_powersave(dev);
> @@ -541,6 +540,8 @@ static int i915_drm_freeze(struct drm_device *dev)
>  		}
>  		mutex_unlock(&dev->mode_config.mutex);
>  
> +		drm_irq_uninstall(dev);
> +
>  		intel_modeset_suspend_hw(dev);
>  	}
>  
> -- 
> 1.8.5.5
> 
> _______________________________________________
> Intel-gfx mailing list
> Intel-gfx@lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/intel-gfx
diff mbox

Patch

diff --git a/drivers/gpu/drm/i915/i915_drv.c b/drivers/gpu/drm/i915/i915_drv.c
index 4619c9e..21554a0 100644
--- a/drivers/gpu/drm/i915/i915_drv.c
+++ b/drivers/gpu/drm/i915/i915_drv.c
@@ -524,7 +524,6 @@  static int i915_drm_freeze(struct drm_device *dev)
 			return error;
 		}
 
-		drm_irq_uninstall(dev);
 		dev_priv->enable_hotplug_processing = false;
 
 		intel_disable_gt_powersave(dev);
@@ -541,6 +540,8 @@  static int i915_drm_freeze(struct drm_device *dev)
 		}
 		mutex_unlock(&dev->mode_config.mutex);
 
+		drm_irq_uninstall(dev);
+
 		intel_modeset_suspend_hw(dev);
 	}