aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/gpu
diff options
context:
space:
mode:
authorDaniel Vetter <daniel.vetter@ffwll.ch>2010-02-19 05:52:00 -0500
committerEric Anholt <eric@anholt.net>2010-02-26 16:23:21 -0500
commit4df2faf4512c2e2ffa6793e055c73a4e7b8b5e36 (patch)
tree8cda947d8231745aa91085e36b210d5bb8d7651b /drivers/gpu
parent63560396536e9eb8858826fcbfc14d4015a41a95 (diff)
drm/i915: reuse i915_gpu_idle helper
We have it, so use it. This required moving the function to avoid a forward declaration. Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch> Signed-off-by: Eric Anholt <eric@anholt.net>
Diffstat (limited to 'drivers/gpu')
-rw-r--r--drivers/gpu/drm/i915/i915_gem.c56
1 files changed, 25 insertions, 31 deletions
diff --git a/drivers/gpu/drm/i915/i915_gem.c b/drivers/gpu/drm/i915/i915_gem.c
index 4b6d427ff7cd..2571d1f543ef 100644
--- a/drivers/gpu/drm/i915/i915_gem.c
+++ b/drivers/gpu/drm/i915/i915_gem.c
@@ -2095,11 +2095,34 @@ i915_gem_find_inactive_object(struct drm_device *dev, int min_size)
2095} 2095}
2096 2096
2097static int 2097static int
2098i915_gpu_idle(struct drm_device *dev)
2099{
2100 drm_i915_private_t *dev_priv = dev->dev_private;
2101 bool lists_empty;
2102 uint32_t seqno;
2103
2104 spin_lock(&dev_priv->mm.active_list_lock);
2105 lists_empty = list_empty(&dev_priv->mm.flushing_list) &&
2106 list_empty(&dev_priv->mm.active_list);
2107 spin_unlock(&dev_priv->mm.active_list_lock);
2108
2109 if (lists_empty)
2110 return 0;
2111
2112 /* Flush everything onto the inactive list. */
2113 i915_gem_flush(dev, I915_GEM_GPU_DOMAINS, I915_GEM_GPU_DOMAINS);
2114 seqno = i915_add_request(dev, NULL, I915_GEM_GPU_DOMAINS);
2115 if (seqno == 0)
2116 return -ENOMEM;
2117
2118 return i915_wait_request(dev, seqno);
2119}
2120
2121static int
2098i915_gem_evict_everything(struct drm_device *dev) 2122i915_gem_evict_everything(struct drm_device *dev)
2099{ 2123{
2100 drm_i915_private_t *dev_priv = dev->dev_private; 2124 drm_i915_private_t *dev_priv = dev->dev_private;
2101 int ret; 2125 int ret;
2102 uint32_t seqno;
2103 bool lists_empty; 2126 bool lists_empty;
2104 2127
2105 spin_lock(&dev_priv->mm.active_list_lock); 2128 spin_lock(&dev_priv->mm.active_list_lock);
@@ -2112,12 +2135,7 @@ i915_gem_evict_everything(struct drm_device *dev)
2112 return -ENOSPC; 2135 return -ENOSPC;
2113 2136
2114 /* Flush everything (on to the inactive lists) and evict */ 2137 /* Flush everything (on to the inactive lists) and evict */
2115 i915_gem_flush(dev, I915_GEM_GPU_DOMAINS, I915_GEM_GPU_DOMAINS); 2138 ret = i915_gpu_idle(dev);
2116 seqno = i915_add_request(dev, NULL, I915_GEM_GPU_DOMAINS);
2117 if (seqno == 0)
2118 return -ENOMEM;
2119
2120 ret = i915_wait_request(dev, seqno);
2121 if (ret) 2139 if (ret)
2122 return ret; 2140 return ret;
2123 2141
@@ -4475,30 +4493,6 @@ i915_gem_evict_from_inactive_list(struct drm_device *dev)
4475 return 0; 4493 return 0;
4476} 4494}
4477 4495
4478static int
4479i915_gpu_idle(struct drm_device *dev)
4480{
4481 drm_i915_private_t *dev_priv = dev->dev_private;
4482 bool lists_empty;
4483 uint32_t seqno;
4484
4485 spin_lock(&dev_priv->mm.active_list_lock);
4486 lists_empty = list_empty(&dev_priv->mm.flushing_list) &&
4487 list_empty(&dev_priv->mm.active_list);
4488 spin_unlock(&dev_priv->mm.active_list_lock);
4489
4490 if (lists_empty)
4491 return 0;
4492
4493 /* Flush everything onto the inactive list. */
4494 i915_gem_flush(dev, I915_GEM_GPU_DOMAINS, I915_GEM_GPU_DOMAINS);
4495 seqno = i915_add_request(dev, NULL, I915_GEM_GPU_DOMAINS);
4496 if (seqno == 0)
4497 return -ENOMEM;
4498
4499 return i915_wait_request(dev, seqno);
4500}
4501
4502int 4496int
4503i915_gem_idle(struct drm_device *dev) 4497i915_gem_idle(struct drm_device *dev)
4504{ 4498{