aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2011-01-20 16:19:55 -0500
committerLinus Torvalds <torvalds@linux-foundation.org>2011-01-20 19:18:25 -0500
commitd7b9935a347ae954be907ea3d5eb4564ff124c53 (patch)
treee830f6ce1e65300db9d6b00b94a9d144fc95c72f
parentb23fffd778c312b8fb258d342051fcbdf6712128 (diff)
i915: Fix i915 suspend delay
During system suspend, the "wait for ring buffer to empty" loop would always time out after three seconds, because the faster cached ring buffer head read would always return zero. Force the slow-and-careful PIO read on all but the first iterations of the loop to fix it. This also removes the unused (and useless) 'actual_head' variable that tried to approximate doing this, but did it incorrectly. Cc: Chris Wilson <chris@chris-wilson.co.uk> Cc: Rafael J. Wysocki <rjw@sisk.pl> Cc: Jesse Barnes <jbarnes@virtuousgeek.org> Cc: Dave Airlie <airlied@linux.ie> Cc: DRI mailing list <dri-devel@lists.freedesktop.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
-rw-r--r--drivers/gpu/drm/i915/intel_ringbuffer.c5
-rw-r--r--drivers/gpu/drm/i915/intel_ringbuffer.h1
2 files changed, 3 insertions, 3 deletions
diff --git a/drivers/gpu/drm/i915/intel_ringbuffer.c b/drivers/gpu/drm/i915/intel_ringbuffer.c
index 03e337072517..f6b9baa6a63d 100644
--- a/drivers/gpu/drm/i915/intel_ringbuffer.c
+++ b/drivers/gpu/drm/i915/intel_ringbuffer.c
@@ -928,6 +928,7 @@ static int intel_wrap_ring_buffer(struct intel_ring_buffer *ring)
928 928
929int intel_wait_ring_buffer(struct intel_ring_buffer *ring, int n) 929int intel_wait_ring_buffer(struct intel_ring_buffer *ring, int n)
930{ 930{
931 int reread = 0;
931 struct drm_device *dev = ring->dev; 932 struct drm_device *dev = ring->dev;
932 struct drm_i915_private *dev_priv = dev->dev_private; 933 struct drm_i915_private *dev_priv = dev->dev_private;
933 unsigned long end; 934 unsigned long end;
@@ -940,9 +941,8 @@ int intel_wait_ring_buffer(struct intel_ring_buffer *ring, int n)
940 * fallback to the slow and accurate path. 941 * fallback to the slow and accurate path.
941 */ 942 */
942 head = intel_read_status_page(ring, 4); 943 head = intel_read_status_page(ring, 4);
943 if (head < ring->actual_head) 944 if (reread)
944 head = I915_READ_HEAD(ring); 945 head = I915_READ_HEAD(ring);
945 ring->actual_head = head;
946 ring->head = head & HEAD_ADDR; 946 ring->head = head & HEAD_ADDR;
947 ring->space = ring->head - (ring->tail + 8); 947 ring->space = ring->head - (ring->tail + 8);
948 if (ring->space < 0) 948 if (ring->space < 0)
@@ -961,6 +961,7 @@ int intel_wait_ring_buffer(struct intel_ring_buffer *ring, int n)
961 msleep(1); 961 msleep(1);
962 if (atomic_read(&dev_priv->mm.wedged)) 962 if (atomic_read(&dev_priv->mm.wedged))
963 return -EAGAIN; 963 return -EAGAIN;
964 reread = 1;
964 } while (!time_after(jiffies, end)); 965 } while (!time_after(jiffies, end));
965 trace_i915_ring_wait_end (dev); 966 trace_i915_ring_wait_end (dev);
966 return -EBUSY; 967 return -EBUSY;
diff --git a/drivers/gpu/drm/i915/intel_ringbuffer.h b/drivers/gpu/drm/i915/intel_ringbuffer.h
index be9087e4c9be..5b0abfa881fc 100644
--- a/drivers/gpu/drm/i915/intel_ringbuffer.h
+++ b/drivers/gpu/drm/i915/intel_ringbuffer.h
@@ -47,7 +47,6 @@ struct intel_ring_buffer {
47 struct drm_device *dev; 47 struct drm_device *dev;
48 struct drm_i915_gem_object *obj; 48 struct drm_i915_gem_object *obj;
49 49
50 u32 actual_head;
51 u32 head; 50 u32 head;
52 u32 tail; 51 u32 tail;
53 int space; 52 int space;