Rather than relying on the hardware to do this correctly, we can
trivially do it ourselves.

This fixes a very reliable crash on d-i-n with all bits enabled during a
cairo-trace replay. The symptoms of the crash is that we continue to
write commands into the render ring buffer past the active head
position, leading to undefined operations.

Signed-off-by: Chris Wilson <ch...@chris-wilson.co.uk>
Cc: sta...@kernel.org
---
 drivers/gpu/drm/i915/intel_ringbuffer.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/drivers/gpu/drm/i915/intel_ringbuffer.c 
b/drivers/gpu/drm/i915/intel_ringbuffer.c
index 3c30dba..90aa9f7 100644
--- a/drivers/gpu/drm/i915/intel_ringbuffer.c
+++ b/drivers/gpu/drm/i915/intel_ringbuffer.c
@@ -46,7 +46,7 @@ struct pipe_control {
 
 static inline int ring_space(struct intel_ring_buffer *ring)
 {
-       int space = (ring->head & HEAD_ADDR) - (ring->tail + 8);
+       int space = (ring->head & (ring->size-1)) - (ring->tail + 8);
        if (space < 0)
                space += ring->size;
        return space;
-- 
1.7.7.2

_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/intel-gfx

Reply via email to