diff options
author | Keith Packard <keithp@keithp.com> | 2008-05-10 22:04:39 -0700 |
---|---|---|
committer | Keith Packard <keithp@keithp.com> | 2008-05-10 22:04:39 -0700 |
commit | 1b0bf301431e76712de1ee43681bc818383b2e56 (patch) | |
tree | 6a7b9d8ba267c42eb6b7813e91ef6bfa09a9ec85 | |
parent | 1f9eaceb71792879a3ecb0046b64dbf65b870d50 (diff) |
[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.
-rw-r--r-- | linux-core/i915_gem.c | 20 |
1 files changed, 13 insertions, 7 deletions
diff --git a/linux-core/i915_gem.c b/linux-core/i915_gem.c index 0cacc65b..90d1d52b 100644 --- a/linux-core/i915_gem.c +++ b/linux-core/i915_gem.c @@ -192,11 +192,14 @@ i915_gem_object_wait_rendering(struct drm_gem_object *obj) /* Clear it now that we know it's passed. */ obj_priv->last_rendering_cookie = 0; + /* We were on the execution list since we had a cookie. * Move to the tail of the LRU list now since we're done. */ - list_move_tail(&obj_priv->gtt_lru_entry, - &dev_priv->mm.gtt_lru); + if (obj_priv->pin_count == 0) + list_move_tail(&obj_priv->gtt_lru_entry, + &dev_priv->mm.gtt_lru); + #if WATCH_LRU DRM_INFO("%s: wait moves to lru list %p\n", __func__, obj); #endif @@ -335,12 +338,15 @@ i915_gem_evict_something(struct drm_device *dev) struct drm_i915_gem_object, gtt_lru_entry); } else if (!list_empty(&dev_priv->mm.execution_list)) { - /* If there's nothing unused and ready, grab the LRU - * from the currently executing list. + /* If there's nothing unused and ready, grab the first + * unpinned object from the currently executing list. */ - obj_priv = list_first_entry(&dev_priv->mm.execution_list, - struct drm_i915_gem_object, - gtt_lru_entry); + list_for_each_entry(obj_priv, &dev_priv->mm.execution_list, + gtt_lru_entry) + if (obj_priv->pin_count == 0) + break; + if (!obj_priv) + return -ENOMEM; } else { return -ENOMEM; } |