diff mbox

Detect wraparound using next-seqno rather than waiter->olr

Message ID 1354803150-29502-1-git-send-email-chris@chris-wilson.co.uk (mailing list archive)
State New, archived
Headers show

Commit Message

Chris Wilson Dec. 6, 2012, 2:12 p.m. UTC
As the olr may have been allocated long in advance for a much earlier
write to the ring, waiter->olr may genuinely be less than the semaphore
seqno. So use the global next_seqno for wraparound detection instead.
---
 drivers/gpu/drm/i915/intel_ringbuffer.c |    8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)
diff mbox

Patch

diff --git a/drivers/gpu/drm/i915/intel_ringbuffer.c b/drivers/gpu/drm/i915/intel_ringbuffer.c
index d5d5177..29f9e2c 100644
--- a/drivers/gpu/drm/i915/intel_ringbuffer.c
+++ b/drivers/gpu/drm/i915/intel_ringbuffer.c
@@ -595,6 +595,12 @@  gen6_add_request(struct intel_ring_buffer *ring)
 	return 0;
 }
 
+static inline u32 i915_gem_next_seqno(struct drm_device *dev)
+{
+	struct drm_i915_private *dev_priv = dev->dev_private;
+	return dev_priv->next_seqno;
+}
+
 /**
  * intel_ring_sync - sync the waiter to the signaller on seqno
  *
@@ -628,7 +634,7 @@  gen6_ring_sync(struct intel_ring_buffer *waiter,
 	BUG_ON(!waiter->outstanding_lazy_request);
 
 	/* If seqno wrap happened, omit the wait with no-ops */
-	if (likely(waiter->outstanding_lazy_request > seqno)) {
+	if (likely(i915_gem_next_seqno(waiter->dev) > seqno)) {
 		intel_ring_emit(waiter,
 				dw1 |
 				signaller->semaphore_register[waiter->id]);