aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/gpu/drm/i915/intel_ringbuffer.h
diff options
context:
space:
mode:
authorChris Wilson <chris@chris-wilson.co.uk>2012-11-27 11:22:52 -0500
committerDaniel Vetter <daniel.vetter@ffwll.ch>2012-11-29 05:43:52 -0500
commit9d7730914f4cd496e356acfab95b41075aa8eae8 (patch)
tree509e4ad7d5b7f32e3118fca228ce2f034403d634 /drivers/gpu/drm/i915/intel_ringbuffer.h
parent45e2b5f640b3766da3eda48f6c35f088155c06f3 (diff)
drm/i915: Preallocate next seqno before touching the ring
Based on the work by Mika Kuoppala, we realised that we need to handle seqno wraparound prior to committing our changes to the ring. The most obvious point then is to grab the seqno inside intel_ring_begin(), and then to reuse that seqno for all ring operations until the next request. As intel_ring_begin() can fail, the callers must already be prepared to handle such failure and so we can safely add further checks. This patch looks like it should be split up into the interface changes and the tweaks to move seqno wrapping from the execbuffer into the core seqno increment. However, I found no easy way to break it into incremental steps without introducing further broken behaviour. v2: Mika found a silly mistake and a subtle error in the existing code; inside i915_gem_retire_requests() we were resetting the sync_seqno of the target ring based on the seqno from this ring - which are only related by the order of their allocation, not retirement. Hence we were applying the optimisation that the rings were synchronised too early, fortunately the only real casualty there is the handling of seqno wrapping. v3: Do not forget to reset the sync_seqno upon module reinitialisation, ala resume. Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk> Cc: Mika Kuoppala <mika.kuoppala@intel.com> Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=863861 Reviewed-by: Mika Kuoppala <mika.kuoppala@intel.com> [v2] Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Diffstat (limited to 'drivers/gpu/drm/i915/intel_ringbuffer.h')
-rw-r--r--drivers/gpu/drm/i915/intel_ringbuffer.h10
1 files changed, 7 insertions, 3 deletions
diff --git a/drivers/gpu/drm/i915/intel_ringbuffer.h b/drivers/gpu/drm/i915/intel_ringbuffer.h
index 5af65b89765f..0e613026d003 100644
--- a/drivers/gpu/drm/i915/intel_ringbuffer.h
+++ b/drivers/gpu/drm/i915/intel_ringbuffer.h
@@ -70,8 +70,7 @@ struct intel_ring_buffer {
70 int __must_check (*flush)(struct intel_ring_buffer *ring, 70 int __must_check (*flush)(struct intel_ring_buffer *ring,
71 u32 invalidate_domains, 71 u32 invalidate_domains,
72 u32 flush_domains); 72 u32 flush_domains);
73 int (*add_request)(struct intel_ring_buffer *ring, 73 int (*add_request)(struct intel_ring_buffer *ring);
74 u32 *seqno);
75 /* Some chipsets are not quite as coherent as advertised and need 74 /* Some chipsets are not quite as coherent as advertised and need
76 * an expensive kick to force a true read of the up-to-date seqno. 75 * an expensive kick to force a true read of the up-to-date seqno.
77 * However, the up-to-date seqno is not always required and the last 76 * However, the up-to-date seqno is not always required and the last
@@ -205,7 +204,6 @@ static inline void intel_ring_emit(struct intel_ring_buffer *ring,
205 204
206void intel_ring_advance(struct intel_ring_buffer *ring); 205void intel_ring_advance(struct intel_ring_buffer *ring);
207 206
208u32 intel_ring_get_seqno(struct intel_ring_buffer *ring);
209int intel_ring_flush_all_caches(struct intel_ring_buffer *ring); 207int intel_ring_flush_all_caches(struct intel_ring_buffer *ring);
210int intel_ring_invalidate_all_caches(struct intel_ring_buffer *ring); 208int intel_ring_invalidate_all_caches(struct intel_ring_buffer *ring);
211 209
@@ -221,6 +219,12 @@ static inline u32 intel_ring_get_tail(struct intel_ring_buffer *ring)
221 return ring->tail; 219 return ring->tail;
222} 220}
223 221
222static inline u32 intel_ring_get_seqno(struct intel_ring_buffer *ring)
223{
224 BUG_ON(ring->outstanding_lazy_request == 0);
225 return ring->outstanding_lazy_request;
226}
227
224static inline void i915_trace_irq_get(struct intel_ring_buffer *ring, u32 seqno) 228static inline void i915_trace_irq_get(struct intel_ring_buffer *ring, u32 seqno)
225{ 229{
226 if (ring->trace_irq_seqno == 0 && ring->irq_get(ring)) 230 if (ring->trace_irq_seqno == 0 && ring->irq_get(ring))