aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/gpu/drm/i915
diff options
context:
space:
mode:
authorChris Wilson <chris@chris-wilson.co.uk>2012-02-23 19:27:21 -0500
committerDaniel Vetter <daniel.vetter@ffwll.ch>2012-02-27 11:32:14 -0500
commitb67082425350a0a47cde7ebfb7914a72c4c97d0f (patch)
tree7d6c9c57dd9324378e67f53f785be3ef2e05d48a /drivers/gpu/drm/i915
parentbd45545f7405eab9093da84715f19c6385a57662 (diff)
drm/i915: Only bump refcnt on objects scheduled for eviction
Incrementing the reference count on all objects walked when searching for space in the aperture is a non-neglible amount of overhead. In fact, we only need to hold on to a reference for objects that we will evict, so we can therefore delay the referencing until we find a suitable hole and only add those objects that fall inside. 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')
-rw-r--r--drivers/gpu/drm/i915/i915_gem_evict.c4
1 files changed, 1 insertions, 3 deletions
diff --git a/drivers/gpu/drm/i915/i915_gem_evict.c b/drivers/gpu/drm/i915/i915_gem_evict.c
index 097119caa36a..6ba4be52936b 100644
--- a/drivers/gpu/drm/i915/i915_gem_evict.c
+++ b/drivers/gpu/drm/i915/i915_gem_evict.c
@@ -36,7 +36,6 @@ static bool
36mark_free(struct drm_i915_gem_object *obj, struct list_head *unwind) 36mark_free(struct drm_i915_gem_object *obj, struct list_head *unwind)
37{ 37{
38 list_add(&obj->exec_list, unwind); 38 list_add(&obj->exec_list, unwind);
39 drm_gem_object_reference(&obj->base);
40 return drm_mm_scan_add_block(obj->gtt_space); 39 return drm_mm_scan_add_block(obj->gtt_space);
41} 40}
42 41
@@ -139,7 +138,6 @@ i915_gem_evict_something(struct drm_device *dev, int min_size,
139 BUG_ON(ret); 138 BUG_ON(ret);
140 139
141 list_del_init(&obj->exec_list); 140 list_del_init(&obj->exec_list);
142 drm_gem_object_unreference(&obj->base);
143 } 141 }
144 142
145 /* We expect the caller to unpin, evict all and try again, or give up. 143 /* We expect the caller to unpin, evict all and try again, or give up.
@@ -158,10 +156,10 @@ found:
158 exec_list); 156 exec_list);
159 if (drm_mm_scan_remove_block(obj->gtt_space)) { 157 if (drm_mm_scan_remove_block(obj->gtt_space)) {
160 list_move(&obj->exec_list, &eviction_list); 158 list_move(&obj->exec_list, &eviction_list);
159 drm_gem_object_reference(&obj->base);
161 continue; 160 continue;
162 } 161 }
163 list_del_init(&obj->exec_list); 162 list_del_init(&obj->exec_list);
164 drm_gem_object_unreference(&obj->base);
165 } 163 }
166 164
167 /* Unbinding will emit any required flushes */ 165 /* Unbinding will emit any required flushes */