diff mbox

[2/2,v2] drm/i915: Disable blt tracking of fbc when not used

Message ID 1383350661-7570-1-git-send-email-benjamin.widawsky@intel.com (mailing list archive)
State New, archived
Headers show

Commit Message

Ben Widawsky Nov. 2, 2013, 12:04 a.m. UTC
When not blitting to scanout, we can save some power by not tracking
blits, and more importantly, unnecessarily invalidating lines which we
don't care a bout.

These instructions are explicitly spelled out in the spec, but it is how
I expect it to work. Unfortunately, I do not have power data for this.

v2: Don't advance the ring twice (Stéphane)
Rename extra_dwords to dwrods (Stéphane)

Cc: Stéphane Marchesin <marcheu@chromium.org>
Signed-off-by: Ben Widawsky <ben@bwidawsk.net>
---
 drivers/gpu/drm/i915/intel_ringbuffer.c | 20 +++++++++++++++++---
 1 file changed, 17 insertions(+), 3 deletions(-)

Comments

Stéphane Marchesin Nov. 2, 2013, 12:55 a.m. UTC | #1
On Fri, Nov 1, 2013 at 5:04 PM, Ben Widawsky
<benjamin.widawsky@intel.com> wrote:
> When not blitting to scanout, we can save some power by not tracking
> blits, and more importantly, unnecessarily invalidating lines which we
> don't care a bout.
>
> These instructions are explicitly spelled out in the spec, but it is how
> I expect it to work. Unfortunately, I do not have power data for this.
>
> v2: Don't advance the ring twice (Stéphane)
> Rename extra_dwords to dwrods (Stéphane)
>
> Cc: Stéphane Marchesin <marcheu@chromium.org>
> Signed-off-by: Ben Widawsky <ben@bwidawsk.net>

For both:
Tested-by: Stéphane Marchesin <marcheu@chromium.org>
Reviewed-by: Stéphane Marchesin <marcheu@chromium.org>

Stéphane

> ---
>  drivers/gpu/drm/i915/intel_ringbuffer.c | 20 +++++++++++++++++---
>  1 file changed, 17 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/gpu/drm/i915/intel_ringbuffer.c b/drivers/gpu/drm/i915/intel_ringbuffer.c
> index ddd7681..8c6e9b2 100644
> --- a/drivers/gpu/drm/i915/intel_ringbuffer.c
> +++ b/drivers/gpu/drm/i915/intel_ringbuffer.c
> @@ -296,7 +296,8 @@ static int gen6_ring_fbc_flush(struct intel_ring_buffer *ring)
>                         _MASKED_BIT_ENABLE(GEN6_BLITTER_FBC_NOTIFY));
>         intel_ring_advance(ring);
>
> -       ring->fbc_dirty = false;
> +       /* We'll mark the fbc clean only after the operation has completed so we
> +        * can track when to disable the bit above */
>         return 0;
>  }
>
> @@ -642,11 +643,13 @@ gen6_add_request(struct intel_ring_buffer *ring)
>         struct drm_device *dev = ring->dev;
>         struct drm_i915_private *dev_priv = dev->dev_private;
>         struct intel_ring_buffer *useless;
> -       int i, ret;
> +       int i, ret, dwords = 4;
>
> +       if (ring->fbc_dirty && ring->id == BCS)
> +               dwords += 4;
>         ret = intel_ring_begin(ring, ((I915_NUM_RINGS-1) *
>                                       MBOX_UPDATE_DWORDS) +
> -                                     4);
> +                                     dwords);
>         if (ret)
>                 return ret;
>  #undef MBOX_UPDATE_DWORDS
> @@ -661,6 +664,17 @@ gen6_add_request(struct intel_ring_buffer *ring)
>         intel_ring_emit(ring, I915_GEM_HWS_INDEX << MI_STORE_DWORD_INDEX_SHIFT);
>         intel_ring_emit(ring, ring->outstanding_lazy_seqno);
>         intel_ring_emit(ring, MI_USER_INTERRUPT);
> +
> +       if (ring->fbc_dirty && ring->id == BCS) {
> +               intel_ring_emit(ring, MI_NOOP);
> +               intel_ring_emit(ring, MI_LOAD_REGISTER_IMM(1));
> +               intel_ring_emit(ring, GEN6_BLITTER_ECOSKPD);
> +               intel_ring_emit(ring,
> +                               _MASKED_BIT_DISABLE(GEN6_BLITTER_FBC_NOTIFY));
> +
> +               ring->fbc_dirty = false;
> +       }
> +
>         __intel_ring_advance(ring);
>
>         return 0;
> --
> 1.8.4.2
>
diff mbox

Patch

diff --git a/drivers/gpu/drm/i915/intel_ringbuffer.c b/drivers/gpu/drm/i915/intel_ringbuffer.c
index ddd7681..8c6e9b2 100644
--- a/drivers/gpu/drm/i915/intel_ringbuffer.c
+++ b/drivers/gpu/drm/i915/intel_ringbuffer.c
@@ -296,7 +296,8 @@  static int gen6_ring_fbc_flush(struct intel_ring_buffer *ring)
 			_MASKED_BIT_ENABLE(GEN6_BLITTER_FBC_NOTIFY));
 	intel_ring_advance(ring);
 
-	ring->fbc_dirty = false;
+	/* We'll mark the fbc clean only after the operation has completed so we
+	 * can track when to disable the bit above */
 	return 0;
 }
 
@@ -642,11 +643,13 @@  gen6_add_request(struct intel_ring_buffer *ring)
 	struct drm_device *dev = ring->dev;
 	struct drm_i915_private *dev_priv = dev->dev_private;
 	struct intel_ring_buffer *useless;
-	int i, ret;
+	int i, ret, dwords = 4;
 
+	if (ring->fbc_dirty && ring->id == BCS)
+		dwords += 4;
 	ret = intel_ring_begin(ring, ((I915_NUM_RINGS-1) *
 				      MBOX_UPDATE_DWORDS) +
-				      4);
+				      dwords);
 	if (ret)
 		return ret;
 #undef MBOX_UPDATE_DWORDS
@@ -661,6 +664,17 @@  gen6_add_request(struct intel_ring_buffer *ring)
 	intel_ring_emit(ring, I915_GEM_HWS_INDEX << MI_STORE_DWORD_INDEX_SHIFT);
 	intel_ring_emit(ring, ring->outstanding_lazy_seqno);
 	intel_ring_emit(ring, MI_USER_INTERRUPT);
+
+	if (ring->fbc_dirty && ring->id == BCS) {
+		intel_ring_emit(ring, MI_NOOP);
+		intel_ring_emit(ring, MI_LOAD_REGISTER_IMM(1));
+		intel_ring_emit(ring, GEN6_BLITTER_ECOSKPD);
+		intel_ring_emit(ring,
+				_MASKED_BIT_DISABLE(GEN6_BLITTER_FBC_NOTIFY));
+
+		ring->fbc_dirty = false;
+	}
+
 	__intel_ring_advance(ring);
 
 	return 0;