Intel-GFX Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Mika Kuoppala <mika.kuoppala@linux.intel.com>
To: intel-gfx@lists.freedesktop.org
Subject: [PATCH 3/6] drm/i915: Don't emit semaphore wait if wrap happened
Date: Tue,  4 Dec 2012 15:12:02 +0200	[thread overview]
Message-ID: <1354626725-8521-4-git-send-email-mika.kuoppala@intel.com> (raw)
In-Reply-To: <1354626725-8521-1-git-send-email-mika.kuoppala@intel.com>

If wrap just happened we need to prevent emitting waits for
pre wrap values. Detect this and emit no-ops instead.

v2: Use olr > seqno to detect wrap instead of *seqno == 0
as suggested by Chris Wilson.

Signed-off-by: Mika Kuoppala <mika.kuoppala@intel.com>
---
 drivers/gpu/drm/i915/intel_ringbuffer.c |   21 ++++++++++++++++-----
 1 file changed, 16 insertions(+), 5 deletions(-)

diff --git a/drivers/gpu/drm/i915/intel_ringbuffer.c b/drivers/gpu/drm/i915/intel_ringbuffer.c
index 36e1e13a..2305af5 100644
--- a/drivers/gpu/drm/i915/intel_ringbuffer.c
+++ b/drivers/gpu/drm/i915/intel_ringbuffer.c
@@ -626,11 +626,22 @@ gen6_ring_sync(struct intel_ring_buffer *waiter,
 	if (ret)
 		return ret;
 
-	intel_ring_emit(waiter,
-			dw1 | signaller->semaphore_register[waiter->id]);
-	intel_ring_emit(waiter, seqno);
-	intel_ring_emit(waiter, 0);
-	intel_ring_emit(waiter, MI_NOOP);
+	BUG_ON(!waiter->outstanding_lazy_request);
+
+	/* If seqno wrap happened, omit the wait with no-ops */
+	if (likely(waiter->outstanding_lazy_request > seqno)) {
+		intel_ring_emit(waiter,
+				dw1 |
+				signaller->semaphore_register[waiter->id]);
+		intel_ring_emit(waiter, seqno);
+		intel_ring_emit(waiter, 0);
+		intel_ring_emit(waiter, MI_NOOP);
+	} else {
+		intel_ring_emit(waiter, MI_NOOP);
+		intel_ring_emit(waiter, MI_NOOP);
+		intel_ring_emit(waiter, MI_NOOP);
+		intel_ring_emit(waiter, MI_NOOP);
+	}
 	intel_ring_advance(waiter);
 
 	return 0;
-- 
1.7.9.5

  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 ` Mika Kuoppala [this message]
2012-12-05 20:44   ` [PATCH 3/6] drm/i915: Don't emit semaphore wait if wrap happened 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 ` [PATCH 4/6] drm/i915: Split intel_ring_begin Mika Kuoppala
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-4-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