aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/gpu/drm/i915/i915_drv.c
diff options
context:
space:
mode:
authorChris Wilson <chris@chris-wilson.co.uk>2011-05-12 17:17:09 -0400
committerKeith Packard <keithp@keithp.com>2011-07-13 14:28:07 -0400
commit95736720fc866eadb2ce1789631b907c0f38cb7c (patch)
tree5071fe60b3cdd5951e351e1565121287aa17675a /drivers/gpu/drm/i915/i915_drv.c
parentf5a3d0c4086d1854cbda545092c462b84cba20ce (diff)
drm/i915: Cache GT fifo count for SandyBridge
The read back of the available FIFO entries is vital for system stability, but extremely costly. However, we only need a guide so as to avoid eating into the reserved entries and since we are the only consumer we can cache the read of the count from the last write. Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk> Reviewed-by: Ben Widawsky <ben@bwidawsk.net> Signed-off-by: Keith Packard <keithp@keithp.com>
Diffstat (limited to 'drivers/gpu/drm/i915/i915_drv.c')
-rw-r--r--drivers/gpu/drm/i915/i915_drv.c15
1 files changed, 10 insertions, 5 deletions
diff --git a/drivers/gpu/drm/i915/i915_drv.c b/drivers/gpu/drm/i915/i915_drv.c
index 6ed73ae2133a..d988cc350f66 100644
--- a/drivers/gpu/drm/i915/i915_drv.c
+++ b/drivers/gpu/drm/i915/i915_drv.c
@@ -348,12 +348,17 @@ void gen6_gt_force_wake_put(struct drm_i915_private *dev_priv)
348 348
349void __gen6_gt_wait_for_fifo(struct drm_i915_private *dev_priv) 349void __gen6_gt_wait_for_fifo(struct drm_i915_private *dev_priv)
350{ 350{
351 int loop = 500; 351 if (dev_priv->gt_fifo_count < GT_FIFO_NUM_RESERVED_ENTRIES ) {
352 u32 fifo = I915_READ_NOTRACE(GT_FIFO_FREE_ENTRIES); 352 int loop = 500;
353 while (fifo < 20 && loop--) { 353 u32 fifo = I915_READ_NOTRACE(GT_FIFO_FREE_ENTRIES);
354 udelay(10); 354 while (fifo <= GT_FIFO_NUM_RESERVED_ENTRIES && loop--) {
355 fifo = I915_READ_NOTRACE(GT_FIFO_FREE_ENTRIES); 355 udelay(10);
356 fifo = I915_READ_NOTRACE(GT_FIFO_FREE_ENTRIES);
357 }
358 WARN_ON(loop < 0 && fifo <= GT_FIFO_NUM_RESERVED_ENTRIES);
359 dev_priv->gt_fifo_count = fifo;
356 } 360 }
361 dev_priv->gt_fifo_count--;
357} 362}
358 363
359static int i915_drm_freeze(struct drm_device *dev) 364static int i915_drm_freeze(struct drm_device *dev)