[Intel-gfx] [PATCH 3/3] drm/i915: hide (seqno-1) in ringbuffer code

Ben Widawsky ben at bwidawsk.net
Wed Apr 11 20:18:21 CEST 2012


Waiting for seqno-1 in our object synchronization code is an
implementation detail given how we've decided to do the waits within the
rest of our code.

Requested-by: Daniel Vetter <daniel.vetter at ffwll.ch>
Signed-off-by: Ben Widawsky <benjamin.widawsky at intel.com>
---
 drivers/gpu/drm/i915/i915_gem.c         |    2 +-
 drivers/gpu/drm/i915/intel_ringbuffer.c |    6 ++++++
 2 files changed, 7 insertions(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/i915/i915_gem.c b/drivers/gpu/drm/i915/i915_gem.c
index 0115b12..71934dd 100644
--- a/drivers/gpu/drm/i915/i915_gem.c
+++ b/drivers/gpu/drm/i915/i915_gem.c
@@ -2002,7 +2002,7 @@ i915_gem_object_sync(struct drm_i915_gem_object *obj,
 	}
 
 
-	ret = to->sync_to(to, from, seqno - 1);
+	ret = to->sync_to(to, from, seqno);
 	if (!ret)
 		from->sync_seqno[idx] = seqno;
 
diff --git a/drivers/gpu/drm/i915/intel_ringbuffer.c b/drivers/gpu/drm/i915/intel_ringbuffer.c
index dfdb613..467b331 100644
--- a/drivers/gpu/drm/i915/intel_ringbuffer.c
+++ b/drivers/gpu/drm/i915/intel_ringbuffer.c
@@ -482,6 +482,12 @@ intel_ring_sync(struct intel_ring_buffer *waiter,
 		  MI_SEMAPHORE_COMPARE |
 		  MI_SEMAPHORE_REGISTER;
 
+	/* Throughout all of the GEM code, seqno passed implies our current
+	 * seqno is >= the last seqno executed. However for hardware the
+	 * comparison is strictly greater than.
+	 */
+	seqno -= 1;
+
 	ret = intel_ring_begin(waiter, 4);
 	if (ret)
 		return ret;
-- 
1.7.10




More information about the Intel-gfx mailing list