aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/gpu/drm/i915/i915_gem_evict.c
diff options
context:
space:
mode:
authorChris Wilson <chris@chris-wilson.co.uk>2012-04-24 13:22:52 -0400
committerDaniel Vetter <daniel.vetter@ffwll.ch>2012-05-03 05:18:10 -0400
commita39d7efc6200d05b9ca3cfeec5dd82f6dd03f4e8 (patch)
tree2876da1a00718a73a7817154583a85ccae667414 /drivers/gpu/drm/i915/i915_gem_evict.c
parent8325a09dd0b138484ccff66b2987f49fa3813ec8 (diff)
drm/i915: Remove i915_gem_evict_inactive()
This was only used by one external caller who would just be as happy with evict-everything, so perform the replacement and make the function private. In the process we note that unbinding the inactive list should not fail, and make it a warning instead. Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk> Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Diffstat (limited to 'drivers/gpu/drm/i915/i915_gem_evict.c')
-rw-r--r--drivers/gpu/drm/i915/i915_gem_evict.c21
1 files changed, 6 insertions, 15 deletions
diff --git a/drivers/gpu/drm/i915/i915_gem_evict.c b/drivers/gpu/drm/i915/i915_gem_evict.c
index 21a82710f4b2..399a3a8946b3 100644
--- a/drivers/gpu/drm/i915/i915_gem_evict.c
+++ b/drivers/gpu/drm/i915/i915_gem_evict.c
@@ -166,8 +166,9 @@ int
166i915_gem_evict_everything(struct drm_device *dev, bool purgeable_only) 166i915_gem_evict_everything(struct drm_device *dev, bool purgeable_only)
167{ 167{
168 drm_i915_private_t *dev_priv = dev->dev_private; 168 drm_i915_private_t *dev_priv = dev->dev_private;
169 int ret; 169 struct drm_i915_gem_object *obj, *next;
170 bool lists_empty; 170 bool lists_empty;
171 int ret;
171 172
172 lists_empty = (list_empty(&dev_priv->mm.inactive_list) && 173 lists_empty = (list_empty(&dev_priv->mm.inactive_list) &&
173 list_empty(&dev_priv->mm.flushing_list) && 174 list_empty(&dev_priv->mm.flushing_list) &&
@@ -184,24 +185,14 @@ i915_gem_evict_everything(struct drm_device *dev, bool purgeable_only)
184 185
185 BUG_ON(!list_empty(&dev_priv->mm.flushing_list)); 186 BUG_ON(!list_empty(&dev_priv->mm.flushing_list));
186 187
187 return i915_gem_evict_inactive(dev, purgeable_only); 188 /* Having flushed everything, unbind() should never raise an error */
188}
189
190/** Unbinds all inactive objects. */
191int
192i915_gem_evict_inactive(struct drm_device *dev, bool purgeable_only)
193{
194 drm_i915_private_t *dev_priv = dev->dev_private;
195 struct drm_i915_gem_object *obj, *next;
196
197 list_for_each_entry_safe(obj, next, 189 list_for_each_entry_safe(obj, next,
198 &dev_priv->mm.inactive_list, mm_list) { 190 &dev_priv->mm.inactive_list, mm_list) {
199 if (!purgeable_only || obj->madv != I915_MADV_WILLNEED) { 191 if (!purgeable_only || obj->madv != I915_MADV_WILLNEED) {
200 int ret = i915_gem_object_unbind(obj); 192 if (obj->pin_count == 0)
201 if (ret) 193 WARN_ON(i915_gem_object_unbind(obj));
202 return ret;
203 } 194 }
204 } 195 }
205 196
206 return 0; 197 return ret;
207} 198}