From: Mika Kuoppala <mika.kuoppala@linux.intel.com>
To: intel-gfx@lists.freedesktop.org
Subject: [PATCH 4/6] drm/i915: Split intel_ring_begin
Date: Tue, 4 Dec 2012 15:12:03 +0200 [thread overview]
Message-ID: <1354626725-8521-5-git-send-email-mika.kuoppala@intel.com> (raw)
In-Reply-To: <1354626725-8521-1-git-send-email-mika.kuoppala@intel.com>
In preparation for handling ring seqno wrapping, split
intel_ring_begin into helper part which doesn't allocate
seqno.
Signed-off-by: Mika Kuoppala <mika.kuoppala@intel.com>
---
drivers/gpu/drm/i915/intel_ringbuffer.c | 37 ++++++++++++++++++-------------
1 file changed, 22 insertions(+), 15 deletions(-)
diff --git a/drivers/gpu/drm/i915/intel_ringbuffer.c b/drivers/gpu/drm/i915/intel_ringbuffer.c
index 2305af5..9342bb2 100644
--- a/drivers/gpu/drm/i915/intel_ringbuffer.c
+++ b/drivers/gpu/drm/i915/intel_ringbuffer.c
@@ -1374,11 +1374,31 @@ intel_ring_alloc_seqno(struct intel_ring_buffer *ring)
return i915_gem_get_seqno(ring->dev, &ring->outstanding_lazy_request);
}
+static int __intel_ring_begin(struct intel_ring_buffer *ring,
+ int bytes)
+{
+ int ret;
+
+ if (unlikely(ring->tail + bytes > ring->effective_size)) {
+ ret = intel_wrap_ring_buffer(ring);
+ if (unlikely(ret))
+ return ret;
+ }
+
+ if (unlikely(ring->space < bytes)) {
+ ret = ring_wait_for_space(ring, bytes);
+ if (unlikely(ret))
+ return ret;
+ }
+
+ ring->space -= bytes;
+ return 0;
+}
+
int intel_ring_begin(struct intel_ring_buffer *ring,
int num_dwords)
{
drm_i915_private_t *dev_priv = ring->dev->dev_private;
- int n = 4*num_dwords;
int ret;
ret = i915_gem_check_wedge(dev_priv, dev_priv->mm.interruptible);
@@ -1390,20 +1410,7 @@ int intel_ring_begin(struct intel_ring_buffer *ring,
if (ret)
return ret;
- if (unlikely(ring->tail + n > ring->effective_size)) {
- ret = intel_wrap_ring_buffer(ring);
- if (unlikely(ret))
- return ret;
- }
-
- if (unlikely(ring->space < n)) {
- ret = ring_wait_for_space(ring, n);
- if (unlikely(ret))
- return ret;
- }
-
- ring->space -= n;
- return 0;
+ return __intel_ring_begin(ring, num_dwords * sizeof(uint32_t));
}
void intel_ring_advance(struct intel_ring_buffer *ring)
--
1.7.9.5
next prev parent reply other threads:[~2012-12-04 13:12 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-12-04 13:11 [PATCH 0/6] ring seqno wrap handling Mika Kuoppala
2012-12-04 13:12 ` [PATCH 1/6] drm/i915: Add debugfs entry to read/write next_seqno Mika Kuoppala
2012-12-04 13:12 ` [PATCH 2/6] drm/i915: Fix debugfs seqno info print to use uint Mika Kuoppala
2012-12-04 13:12 ` [PATCH 3/6] drm/i915: Don't emit semaphore wait if wrap happened Mika Kuoppala
2012-12-05 20:44 ` Paulo Zanoni
2012-12-06 8:51 ` Daniel Vetter
2012-12-06 11:41 ` Paulo Zanoni
2012-12-06 12:14 ` Daniel Vetter
2012-12-06 12:24 ` Chris Wilson
2012-12-06 14:12 ` [PATCH] Detect wraparound using next-seqno rather than waiter->olr Chris Wilson
2012-12-04 13:12 ` Mika Kuoppala [this message]
2012-12-04 13:12 ` [PATCH 5/6] drm/i915: Add intel_ring_handle_seqno wrap Mika Kuoppala
2012-12-04 13:12 ` [PATCH 6/6] drm/i915: Set initial seqno value close to wrap boundary Mika Kuoppala
2012-12-04 14:05 ` [PATCH 0/6] ring seqno wrap handling Chris Wilson
2012-12-04 22:03 ` Daniel Vetter
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=1354626725-8521-5-git-send-email-mika.kuoppala@intel.com \
--to=mika.kuoppala@linux.intel.com \
--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