All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] drm/i915: Mask the ring->head offset using the ring->size
@ 2011-11-08 23:13 Chris Wilson
  2012-01-17 10:59 ` Daniel Vetter
  0 siblings, 1 reply; 4+ messages in thread
From: Chris Wilson @ 2011-11-08 23:13 UTC (permalink / raw)
  To: intel-gfx; +Cc: stable

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 <chris@chris-wilson.co.uk>
Cc: stable@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

^ permalink raw reply related	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2012-02-08 12:49 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-11-08 23:13 [PATCH] drm/i915: Mask the ring->head offset using the ring->size Chris Wilson
2012-01-17 10:59 ` Daniel Vetter
2012-01-17 11:14   ` Chris Wilson
2012-02-08 12:49     ` Chris Wilson

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.