|
@@ -166,8 +166,9 @@ int
|
|
|
i915_gem_evict_everything(struct drm_device *dev, bool purgeable_only)
|
|
|
{
|
|
|
drm_i915_private_t *dev_priv = dev->dev_private;
|
|
|
- int ret;
|
|
|
+ struct drm_i915_gem_object *obj, *next;
|
|
|
bool lists_empty;
|
|
|
+ int ret;
|
|
|
|
|
|
lists_empty = (list_empty(&dev_priv->mm.inactive_list) &&
|
|
|
list_empty(&dev_priv->mm.flushing_list) &&
|
|
@@ -184,24 +185,14 @@ i915_gem_evict_everything(struct drm_device *dev, bool purgeable_only)
|
|
|
|
|
|
BUG_ON(!list_empty(&dev_priv->mm.flushing_list));
|
|
|
|
|
|
- return i915_gem_evict_inactive(dev, purgeable_only);
|
|
|
-}
|
|
|
-
|
|
|
-/** Unbinds all inactive objects. */
|
|
|
-int
|
|
|
-i915_gem_evict_inactive(struct drm_device *dev, bool purgeable_only)
|
|
|
-{
|
|
|
- drm_i915_private_t *dev_priv = dev->dev_private;
|
|
|
- struct drm_i915_gem_object *obj, *next;
|
|
|
-
|
|
|
+ /* Having flushed everything, unbind() should never raise an error */
|
|
|
list_for_each_entry_safe(obj, next,
|
|
|
&dev_priv->mm.inactive_list, mm_list) {
|
|
|
if (!purgeable_only || obj->madv != I915_MADV_WILLNEED) {
|
|
|
- int ret = i915_gem_object_unbind(obj);
|
|
|
- if (ret)
|
|
|
- return ret;
|
|
|
+ if (obj->pin_count == 0)
|
|
|
+ WARN_ON(i915_gem_object_unbind(obj));
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- return 0;
|
|
|
+ return ret;
|
|
|
}
|