intel-gfx.lists.freedesktop.org archive mirror
 help / color / mirror / Atom feed
From: Ben Widawsky <ben@bwidawsk.net>
To: intel-gfx@lists.freedesktop.org
Subject: [PATCH v2 2/5] drm/1915: ringbuffer wait for idle function
Date: Sat, 19 Mar 2011 18:14:27 -0700	[thread overview]
Message-ID: <1300583670-3489-2-git-send-email-ben@bwidawsk.net> (raw)
In-Reply-To: <b9dded$iah4v5@orsmga002.jf.intel.com>

Added a new function which waits for the ringbuffer space to be equal to
(total - 8). This is the empty condition of the ringbuffer, and
equivalent to head==tail.

Also modified two users of this functionality elsewhere in the code.

Signed-off-by: Ben Widawsky <ben@bwidawsk.net>
---
 drivers/gpu/drm/i915/i915_dma.c         |    2 +-
 drivers/gpu/drm/i915/intel_ringbuffer.c |    2 +-
 drivers/gpu/drm/i915/intel_ringbuffer.h |    6 ++++++
 3 files changed, 8 insertions(+), 2 deletions(-)

diff --git a/drivers/gpu/drm/i915/i915_dma.c b/drivers/gpu/drm/i915/i915_dma.c
index e33d9be..cdca465 100644
--- a/drivers/gpu/drm/i915/i915_dma.c
+++ b/drivers/gpu/drm/i915/i915_dma.c
@@ -563,7 +563,7 @@ static int i915_quiescent(struct drm_device *dev)
 	struct intel_ring_buffer *ring = LP_RING(dev->dev_private);
 
 	i915_kernel_lost_context(dev);
-	return intel_wait_ring_buffer(ring, ring->size - 8);
+	return intel_wait_ring_idle(ring);
 }
 
 static int i915_flush_ioctl(struct drm_device *dev, void *data,
diff --git a/drivers/gpu/drm/i915/intel_ringbuffer.c b/drivers/gpu/drm/i915/intel_ringbuffer.c
index 445f27e..0b83059 100644
--- a/drivers/gpu/drm/i915/intel_ringbuffer.c
+++ b/drivers/gpu/drm/i915/intel_ringbuffer.c
@@ -893,7 +893,7 @@ void intel_cleanup_ring_buffer(struct intel_ring_buffer *ring)
 
 	/* Disable the ring buffer. The ring must be idle at this point */
 	dev_priv = ring->dev->dev_private;
-	ret = intel_wait_ring_buffer(ring, ring->size - 8);
+	ret = intel_wait_ring_idle(ring);
 	I915_WRITE_CTL(ring, 0);
 
 	drm_core_ioremapfree(&ring->map, ring->dev);
diff --git a/drivers/gpu/drm/i915/intel_ringbuffer.h b/drivers/gpu/drm/i915/intel_ringbuffer.h
index 3430686..30d0437 100644
--- a/drivers/gpu/drm/i915/intel_ringbuffer.h
+++ b/drivers/gpu/drm/i915/intel_ringbuffer.h
@@ -143,7 +143,13 @@ intel_read_status_page(struct intel_ring_buffer *ring,
 }
 
 void intel_cleanup_ring_buffer(struct intel_ring_buffer *ring);
+
 int __must_check intel_wait_ring_buffer(struct intel_ring_buffer *ring, int n);
+static inline int intel_wait_ring_idle(struct intel_ring_buffer *ring)
+{
+	return intel_wait_ring_buffer(ring, ring->space - 8);
+}
+
 int __must_check intel_ring_begin(struct intel_ring_buffer *ring, int n);
 
 static inline void intel_ring_emit(struct intel_ring_buffer *ring,
-- 
1.7.3.4

  parent reply	other threads:[~2011-03-20  1:14 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-03-18 23:12 [PATCH 0/4] Re-enable RC6 on Ironlake Ben Widawsky
2011-03-18 23:12 ` [PATCH 1/4] drm/i915: fix ilk rc6 teardown locking Ben Widawsky
2011-03-19  7:44   ` Chris Wilson
2011-03-19 18:38     ` [PATCH v2 " Ben Widawsky
2011-03-19 18:46     ` [PATCH " Keith Packard
2011-03-20  1:14     ` [PATCH v2 1/5] " Ben Widawsky
2011-03-20  1:14     ` Ben Widawsky [this message]
2011-03-20  1:14     ` [PATCH v2 3/5] drm/i915: fix rc6 initialization on Ironlake Ben Widawsky
2011-03-20  1:14     ` [PATCH v2 4/5] drm/i915: debugfs for context information Ben Widawsky
2011-03-20  1:14     ` [PATCH v2 5/5] drm/i915: re-enable rc6 for ironlake Ben Widawsky
2011-03-18 23:12 ` [PATCH 2/4] drm/i915: fix rc6 initialization on Ironlake Ben Widawsky
2011-03-19  7:55   ` Chris Wilson
2011-03-20  0:07     ` Ben Widawsky
2011-03-18 23:12 ` [PATCH 3/4] drm/i915: debugfs for context information Ben Widawsky
2011-03-18 23:12 ` [PATCH 4/4] drm/i915: re-enable rc6 for ironlake Ben Widawsky
2011-04-27  7:49   ` Chris Wilson
2011-04-27 21:20     ` Jesse Barnes
2011-04-27 22:03       ` Chris Wilson
2011-04-27 22:49         ` Jesse Barnes
2011-04-28 17:10           ` Ben Widawsky

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1300583670-3489-2-git-send-email-ben@bwidawsk.net \
    --to=ben@bwidawsk.net \
    --cc=intel-gfx@lists.freedesktop.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).