diff options
author | Chris Wilson <chris@chris-wilson.co.uk> | 2012-04-24 13:22:52 -0400 |
---|---|---|
committer | Daniel Vetter <daniel.vetter@ffwll.ch> | 2012-05-03 05:18:10 -0400 |
commit | a39d7efc6200d05b9ca3cfeec5dd82f6dd03f4e8 (patch) | |
tree | 2876da1a00718a73a7817154583a85ccae667414 /drivers/gpu/drm | |
parent | 8325a09dd0b138484ccff66b2987f49fa3813ec8 (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')
-rw-r--r-- | drivers/gpu/drm/i915/i915_drv.h | 5 | ||||
-rw-r--r-- | drivers/gpu/drm/i915/i915_gem.c | 9 | ||||
-rw-r--r-- | drivers/gpu/drm/i915/i915_gem_evict.c | 21 |
3 files changed, 9 insertions, 26 deletions
diff --git a/drivers/gpu/drm/i915/i915_drv.h b/drivers/gpu/drm/i915/i915_drv.h index c1440137002a..57f60fa719f4 100644 --- a/drivers/gpu/drm/i915/i915_drv.h +++ b/drivers/gpu/drm/i915/i915_drv.h | |||
@@ -1370,10 +1370,7 @@ void i915_gem_init_global_gtt(struct drm_device *dev, | |||
1370 | /* i915_gem_evict.c */ | 1370 | /* i915_gem_evict.c */ |
1371 | int __must_check i915_gem_evict_something(struct drm_device *dev, int min_size, | 1371 | int __must_check i915_gem_evict_something(struct drm_device *dev, int min_size, |
1372 | unsigned alignment, bool mappable); | 1372 | unsigned alignment, bool mappable); |
1373 | int __must_check i915_gem_evict_everything(struct drm_device *dev, | 1373 | int i915_gem_evict_everything(struct drm_device *dev, bool purgeable_only); |
1374 | bool purgeable_only); | ||
1375 | int __must_check i915_gem_evict_inactive(struct drm_device *dev, | ||
1376 | bool purgeable_only); | ||
1377 | 1374 | ||
1378 | /* i915_gem_tiling.c */ | 1375 | /* i915_gem_tiling.c */ |
1379 | void i915_gem_detect_bit_6_swizzle(struct drm_device *dev); | 1376 | void i915_gem_detect_bit_6_swizzle(struct drm_device *dev); |
diff --git a/drivers/gpu/drm/i915/i915_gem.c b/drivers/gpu/drm/i915/i915_gem.c index ad2a6924d9ce..2fc7c55e0e05 100644 --- a/drivers/gpu/drm/i915/i915_gem.c +++ b/drivers/gpu/drm/i915/i915_gem.c | |||
@@ -3455,13 +3455,8 @@ i915_gem_idle(struct drm_device *dev) | |||
3455 | } | 3455 | } |
3456 | 3456 | ||
3457 | /* Under UMS, be paranoid and evict. */ | 3457 | /* Under UMS, be paranoid and evict. */ |
3458 | if (!drm_core_check_feature(dev, DRIVER_MODESET)) { | 3458 | if (!drm_core_check_feature(dev, DRIVER_MODESET)) |
3459 | ret = i915_gem_evict_inactive(dev, false); | 3459 | i915_gem_evict_everything(dev, false); |
3460 | if (ret) { | ||
3461 | mutex_unlock(&dev->struct_mutex); | ||
3462 | return ret; | ||
3463 | } | ||
3464 | } | ||
3465 | 3460 | ||
3466 | i915_gem_reset_fences(dev); | 3461 | i915_gem_reset_fences(dev); |
3467 | 3462 | ||
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 | |||
166 | i915_gem_evict_everything(struct drm_device *dev, bool purgeable_only) | 166 | i915_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. */ | ||
191 | int | ||
192 | i915_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 | } |