Skip to content

Commit

Permalink
drm/i915: Only bump refcnt on objects scheduled for eviction
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Chris Wilson authored and Daniel Vetter committed Feb 27, 2012
1 parent bd45545 commit b670824
Showing 1 changed file with 1 addition and 3 deletions.
4 changes: 1 addition & 3 deletions drivers/gpu/drm/i915/i915_gem_evict.c
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,6 @@ static bool
mark_free(struct drm_i915_gem_object *obj, struct list_head *unwind)
{
list_add(&obj->exec_list, unwind);
drm_gem_object_reference(&obj->base);
return drm_mm_scan_add_block(obj->gtt_space);
}

Expand Down Expand Up @@ -139,7 +138,6 @@ i915_gem_evict_something(struct drm_device *dev, int min_size,
BUG_ON(ret);

list_del_init(&obj->exec_list);
drm_gem_object_unreference(&obj->base);
}

/* We expect the caller to unpin, evict all and try again, or give up.
Expand All @@ -158,10 +156,10 @@ i915_gem_evict_something(struct drm_device *dev, int min_size,
exec_list);
if (drm_mm_scan_remove_block(obj->gtt_space)) {
list_move(&obj->exec_list, &eviction_list);
drm_gem_object_reference(&obj->base);
continue;
}
list_del_init(&obj->exec_list);
drm_gem_object_unreference(&obj->base);
}

/* Unbinding will emit any required flushes */
Expand Down

0 comments on commit b670824

Please sign in to comment.