diff options
author | Mika Kuoppala <mika.kuoppala@linux.intel.com> | 2012-12-04 08:12:04 -0500 |
---|---|---|
committer | Daniel Vetter <daniel.vetter@ffwll.ch> | 2012-12-06 07:14:34 -0500 |
commit | 498d2ac15ce0fc08edb005a7faf9ed6b5aa028d8 (patch) | |
tree | 64128e5fd2809354ab5ca8bfb8080f0d63f4095f | |
parent | cbcc80dff3896015385c67d6be0beb3399999e5c (diff) |
drm/i915: Add intel_ring_handle_seqno wrap
If there are pre-wrap values in semaphore-mbox registers after wrap,
syncing against some after-wrap request will complete immediately.
Fix this by emitting ring commands to set mbox registers to zero
when the wrap happens.
v2: Use __intel_ring_begin to emit ring commands, from
Chris Wilson.
Signed-off-by: Mika Kuoppala <mika.kuoppala@intel.com>
Reviewed-by: Chris Wilson <chris@chris-wilson.co.uk>
[danvet: Add a small comment to handle_seqno_wrap.]
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
-rw-r--r-- | drivers/gpu/drm/i915/i915_gem.c | 4 | ||||
-rw-r--r-- | drivers/gpu/drm/i915/intel_ringbuffer.c | 22 | ||||
-rw-r--r-- | drivers/gpu/drm/i915/intel_ringbuffer.h | 2 |
3 files changed, 27 insertions, 1 deletions
diff --git a/drivers/gpu/drm/i915/i915_gem.c b/drivers/gpu/drm/i915/i915_gem.c index cb941448c2bc..02d315164aa9 100644 --- a/drivers/gpu/drm/i915/i915_gem.c +++ b/drivers/gpu/drm/i915/i915_gem.c | |||
@@ -1952,6 +1952,10 @@ i915_gem_handle_seqno_wrap(struct drm_device *dev) | |||
1952 | 1952 | ||
1953 | i915_gem_retire_requests(dev); | 1953 | i915_gem_retire_requests(dev); |
1954 | for_each_ring(ring, dev_priv, i) { | 1954 | for_each_ring(ring, dev_priv, i) { |
1955 | ret = intel_ring_handle_seqno_wrap(ring); | ||
1956 | if (ret) | ||
1957 | return ret; | ||
1958 | |||
1955 | for (j = 0; j < ARRAY_SIZE(ring->sync_seqno); j++) | 1959 | for (j = 0; j < ARRAY_SIZE(ring->sync_seqno); j++) |
1956 | ring->sync_seqno[j] = 0; | 1960 | ring->sync_seqno[j] = 0; |
1957 | } | 1961 | } |
diff --git a/drivers/gpu/drm/i915/intel_ringbuffer.c b/drivers/gpu/drm/i915/intel_ringbuffer.c index 01a660a7c167..0d03dc649c5e 100644 --- a/drivers/gpu/drm/i915/intel_ringbuffer.c +++ b/drivers/gpu/drm/i915/intel_ringbuffer.c | |||
@@ -1402,6 +1402,28 @@ int intel_ring_begin(struct intel_ring_buffer *ring, | |||
1402 | return __intel_ring_begin(ring, num_dwords * sizeof(uint32_t)); | 1402 | return __intel_ring_begin(ring, num_dwords * sizeof(uint32_t)); |
1403 | } | 1403 | } |
1404 | 1404 | ||
1405 | int intel_ring_handle_seqno_wrap(struct intel_ring_buffer *ring) | ||
1406 | { | ||
1407 | int ret; | ||
1408 | |||
1409 | BUG_ON(ring->outstanding_lazy_request); | ||
1410 | |||
1411 | if (INTEL_INFO(ring->dev)->gen < 6) | ||
1412 | return 0; | ||
1413 | |||
1414 | ret = __intel_ring_begin(ring, 6 * sizeof(uint32_t)); | ||
1415 | if (ret) | ||
1416 | return ret; | ||
1417 | |||
1418 | /* Leaving a stale, pre-wrap seqno behind in the mboxes will result in | ||
1419 | * post-wrap semaphore waits completing immediately. Clear them. */ | ||
1420 | update_mboxes(ring, ring->signal_mbox[0]); | ||
1421 | update_mboxes(ring, ring->signal_mbox[1]); | ||
1422 | intel_ring_advance(ring); | ||
1423 | |||
1424 | return 0; | ||
1425 | } | ||
1426 | |||
1405 | void intel_ring_advance(struct intel_ring_buffer *ring) | 1427 | void intel_ring_advance(struct intel_ring_buffer *ring) |
1406 | { | 1428 | { |
1407 | struct drm_i915_private *dev_priv = ring->dev->dev_private; | 1429 | struct drm_i915_private *dev_priv = ring->dev->dev_private; |
diff --git a/drivers/gpu/drm/i915/intel_ringbuffer.h b/drivers/gpu/drm/i915/intel_ringbuffer.h index d4b7416fa1b0..b4a533e53fd1 100644 --- a/drivers/gpu/drm/i915/intel_ringbuffer.h +++ b/drivers/gpu/drm/i915/intel_ringbuffer.h | |||
@@ -196,7 +196,7 @@ static inline void intel_ring_emit(struct intel_ring_buffer *ring, | |||
196 | } | 196 | } |
197 | void intel_ring_advance(struct intel_ring_buffer *ring); | 197 | void intel_ring_advance(struct intel_ring_buffer *ring); |
198 | int __must_check intel_ring_idle(struct intel_ring_buffer *ring); | 198 | int __must_check intel_ring_idle(struct intel_ring_buffer *ring); |
199 | 199 | int __must_check intel_ring_handle_seqno_wrap(struct intel_ring_buffer *ring); | |
200 | int intel_ring_flush_all_caches(struct intel_ring_buffer *ring); | 200 | int intel_ring_flush_all_caches(struct intel_ring_buffer *ring); |
201 | int intel_ring_invalidate_all_caches(struct intel_ring_buffer *ring); | 201 | int intel_ring_invalidate_all_caches(struct intel_ring_buffer *ring); |
202 | 202 | ||