[intel-GEM] exec list can contain pinned, lru cannot.

The exec list contains all objects, in order of use. The lru list contains
only unpinned objects ready to be evicted. This required two changes -- the
first was to not migrate pinned objects from exec to lru, the second was to
search for the first unpinned object in the exec list when doing eviction.
main
Keith Packard 2008-05-10 22:04:39 -07:00
parent 1f9eaceb71
commit 1b0bf30143
1 changed files with 13 additions and 7 deletions

View File

@ -192,11 +192,14 @@ i915_gem_object_wait_rendering(struct drm_gem_object *obj)
/* Clear it now that we know it's passed. */ /* Clear it now that we know it's passed. */
obj_priv->last_rendering_cookie = 0; obj_priv->last_rendering_cookie = 0;
/* We were on the execution list since we had a cookie. /* We were on the execution list since we had a cookie.
* Move to the tail of the LRU list now since we're done. * Move to the tail of the LRU list now since we're done.
*/ */
list_move_tail(&obj_priv->gtt_lru_entry, if (obj_priv->pin_count == 0)
&dev_priv->mm.gtt_lru); list_move_tail(&obj_priv->gtt_lru_entry,
&dev_priv->mm.gtt_lru);
#if WATCH_LRU #if WATCH_LRU
DRM_INFO("%s: wait moves to lru list %p\n", __func__, obj); DRM_INFO("%s: wait moves to lru list %p\n", __func__, obj);
#endif #endif
@ -335,12 +338,15 @@ i915_gem_evict_something(struct drm_device *dev)
struct drm_i915_gem_object, struct drm_i915_gem_object,
gtt_lru_entry); gtt_lru_entry);
} else if (!list_empty(&dev_priv->mm.execution_list)) { } else if (!list_empty(&dev_priv->mm.execution_list)) {
/* If there's nothing unused and ready, grab the LRU /* If there's nothing unused and ready, grab the first
* from the currently executing list. * unpinned object from the currently executing list.
*/ */
obj_priv = list_first_entry(&dev_priv->mm.execution_list, list_for_each_entry(obj_priv, &dev_priv->mm.execution_list,
struct drm_i915_gem_object, gtt_lru_entry)
gtt_lru_entry); if (obj_priv->pin_count == 0)
break;
if (!obj_priv)
return -ENOMEM;
} else { } else {
return -ENOMEM; return -ENOMEM;
} }