diff mbox

[06/10] drm/i915: Enable vblank_disable_immediate on gen2

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

Commit Message

Ville Syrjala Dec. 14, 2015, 4:23 p.m. UTC
From: Ville Syrjälä <ville.syrjala@linux.intel.com>

Since
commit 4dfd648 ("drm: Use vblank timestamps to guesstimate how many vblanks were missed")
the vblank code can cook up a frame counter value based on
the vblank timestamps (as long as they're accurate), so there's
no longer any need to keep vblank interrupts enabled on gen2
when no one is interested in them. So let's opt into the
immediate disable scheme on gen2 as well.

Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
---
 drivers/gpu/drm/i915/i915_irq.c | 9 +--------
 1 file changed, 1 insertion(+), 8 deletions(-)

Comments

Daniel Vetter Dec. 16, 2015, 10:31 a.m. UTC | #1
On Mon, Dec 14, 2015 at 06:23:45PM +0200, ville.syrjala@linux.intel.com wrote:
> From: Ville Syrjälä <ville.syrjala@linux.intel.com>
> 
> Since
> commit 4dfd648 ("drm: Use vblank timestamps to guesstimate how many vblanks were missed")
> the vblank code can cook up a frame counter value based on
> the vblank timestamps (as long as they're accurate), so there's
> no longer any need to keep vblank interrupts enabled on gen2
> when no one is interested in them. So let's opt into the
> immediate disable scheme on gen2 as well.
> 
> Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>

Yeah makes sense. Userspace that cares can simply ask for a vblank event
in 1000 frames or so, to keep the vblank interrupt enabled.

Reviewed-by: Daniel Vetter <daniel.vetter@ffwll.ch>

> ---
>  drivers/gpu/drm/i915/i915_irq.c | 9 +--------
>  1 file changed, 1 insertion(+), 8 deletions(-)
> 
> diff --git a/drivers/gpu/drm/i915/i915_irq.c b/drivers/gpu/drm/i915/i915_irq.c
> index 37ec8427359a..111edda1e73d 100644
> --- a/drivers/gpu/drm/i915/i915_irq.c
> +++ b/drivers/gpu/drm/i915/i915_irq.c
> @@ -4437,14 +4437,7 @@ void intel_irq_init(struct drm_i915_private *dev_priv)
>  		dev->max_vblank_count = 0xffffff; /* only 24 bits of frame count */
>  	}
>  
> -	/*
> -	 * Opt out of the vblank disable timer on everything except gen2.
> -	 * Gen2 doesn't have a hardware frame counter and so depends on
> -	 * vblank interrupts to produce sane vblank seuquence numbers.
> -	 */
> -	if (!IS_GEN2(dev_priv))
> -		dev->vblank_disable_immediate = true;
> -
> +	dev->vblank_disable_immediate = true;
>  	dev->driver->get_vblank_timestamp = i915_get_vblank_timestamp;
>  	dev->driver->get_scanout_position = i915_get_crtc_scanoutpos;
>  
> -- 
> 2.4.10
> 
> _______________________________________________
> Intel-gfx mailing list
> Intel-gfx@lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/intel-gfx
Chris Wilson Dec. 16, 2015, 10:41 a.m. UTC | #2
On Wed, Dec 16, 2015 at 11:31:31AM +0100, Daniel Vetter wrote:
> On Mon, Dec 14, 2015 at 06:23:45PM +0200, ville.syrjala@linux.intel.com wrote:
> > From: Ville Syrjälä <ville.syrjala@linux.intel.com>
> > 
> > Since
> > commit 4dfd648 ("drm: Use vblank timestamps to guesstimate how many vblanks were missed")
> > the vblank code can cook up a frame counter value based on
> > the vblank timestamps (as long as they're accurate), so there's
> > no longer any need to keep vblank interrupts enabled on gen2
> > when no one is interested in them. So let's opt into the
> > immediate disable scheme on gen2 as well.
> > 
> > Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
> 
> Yeah makes sense. Userspace that cares can simply ask for a vblank event
> in 1000 frames or so, to keep the vblank interrupt enabled.

I prefer my don't do immediate_disable until after we finish the vblank
event.

I have vblank/flip keepalives in userspace - but at the end of the day
they just add work when we can make a change in the kernel to reduce work.
-Chris
diff mbox

Patch

diff --git a/drivers/gpu/drm/i915/i915_irq.c b/drivers/gpu/drm/i915/i915_irq.c
index 37ec8427359a..111edda1e73d 100644
--- a/drivers/gpu/drm/i915/i915_irq.c
+++ b/drivers/gpu/drm/i915/i915_irq.c
@@ -4437,14 +4437,7 @@  void intel_irq_init(struct drm_i915_private *dev_priv)
 		dev->max_vblank_count = 0xffffff; /* only 24 bits of frame count */
 	}
 
-	/*
-	 * Opt out of the vblank disable timer on everything except gen2.
-	 * Gen2 doesn't have a hardware frame counter and so depends on
-	 * vblank interrupts to produce sane vblank seuquence numbers.
-	 */
-	if (!IS_GEN2(dev_priv))
-		dev->vblank_disable_immediate = true;
-
+	dev->vblank_disable_immediate = true;
 	dev->driver->get_vblank_timestamp = i915_get_vblank_timestamp;
 	dev->driver->get_scanout_position = i915_get_crtc_scanoutpos;