[gem] Rename the GTT LRU lists to active (executing) and inactive (idle).

main
Eric Anholt 2008-05-15 09:37:49 -07:00
parent aafafe507b
commit 3ab152da66
3 changed files with 34 additions and 34 deletions

View File

@ -170,8 +170,8 @@ i915_gem_object_wait_rendering(struct drm_gem_object *obj)
drm_gem_object_reference(obj); drm_gem_object_reference(obj);
/* Move from whatever list we were on to the tail of execution. /* Move from whatever list we were on to the tail of execution.
*/ */
list_move_tail(&obj_priv->gtt_lru_entry, list_move_tail(&obj_priv->list,
&dev_priv->mm.execution_list); &dev_priv->mm.active_list);
obj_priv->last_rendering_cookie = i915_emit_irq(dev); obj_priv->last_rendering_cookie = i915_emit_irq(dev);
BUG_ON(obj_priv->last_rendering_cookie == 0); BUG_ON(obj_priv->last_rendering_cookie == 0);
#if WATCH_LRU #if WATCH_LRU
@ -197,8 +197,8 @@ i915_gem_object_wait_rendering(struct drm_gem_object *obj)
* 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.
*/ */
if (obj_priv->pin_count == 0) if (obj_priv->pin_count == 0)
list_move_tail(&obj_priv->gtt_lru_entry, list_move_tail(&obj_priv->list,
&dev_priv->mm.gtt_lru); &dev_priv->mm.inactive_list);
#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);
@ -245,8 +245,8 @@ i915_gem_object_unbind(struct drm_gem_object *obj)
obj_priv->gtt_space = NULL; obj_priv->gtt_space = NULL;
/* Remove ourselves from the LRU list if present. */ /* Remove ourselves from the LRU list if present. */
if (!list_empty(&obj_priv->gtt_lru_entry)) { if (!list_empty(&obj_priv->list)) {
list_del_init(&obj_priv->gtt_lru_entry); list_del_init(&obj_priv->list);
if (obj_priv->last_rendering_cookie) { if (obj_priv->last_rendering_cookie) {
DRM_ERROR("Failed to wait on buffer when unbinding, " DRM_ERROR("Failed to wait on buffer when unbinding, "
"continued anyway.\n"); "continued anyway.\n");
@ -309,14 +309,14 @@ i915_dump_lru(struct drm_device *dev, const char *where)
struct drm_i915_gem_object *obj_priv; struct drm_i915_gem_object *obj_priv;
DRM_INFO("GTT execution list %s {\n", where); DRM_INFO("GTT execution list %s {\n", where);
list_for_each_entry(obj_priv, &dev_priv->mm.execution_list, list_for_each_entry(obj_priv, &dev_priv->mm.active_list,
gtt_lru_entry) list)
{ {
DRM_INFO(" %p: %08x\n", obj_priv, DRM_INFO(" %p: %08x\n", obj_priv,
obj_priv->last_rendering_cookie); obj_priv->last_rendering_cookie);
} }
DRM_INFO("GTT LRU %s {\n", where); DRM_INFO("GTT LRU %s {\n", where);
list_for_each_entry(obj_priv, &dev_priv->mm.gtt_lru, gtt_lru_entry) { list_for_each_entry(obj_priv, &dev_priv->mm.inactive_list, list) {
DRM_INFO(" %p: %08x\n", obj_priv, DRM_INFO(" %p: %08x\n", obj_priv,
obj_priv->last_rendering_cookie); obj_priv->last_rendering_cookie);
} }
@ -333,16 +333,16 @@ i915_gem_evict_something(struct drm_device *dev)
int ret; int ret;
/* Find the LRU buffer. */ /* Find the LRU buffer. */
if (!list_empty(&dev_priv->mm.gtt_lru)) { if (!list_empty(&dev_priv->mm.inactive_list)) {
obj_priv = list_first_entry(&dev_priv->mm.gtt_lru, obj_priv = list_first_entry(&dev_priv->mm.inactive_list,
struct drm_i915_gem_object, struct drm_i915_gem_object,
gtt_lru_entry); list);
} else if (!list_empty(&dev_priv->mm.execution_list)) { } else if (!list_empty(&dev_priv->mm.active_list)) {
/* If there's nothing unused and ready, grab the first /* If there's nothing unused and ready, grab the first
* unpinned object from the currently executing list. * unpinned object from the currently executing list.
*/ */
list_for_each_entry(obj_priv, &dev_priv->mm.execution_list, list_for_each_entry(obj_priv, &dev_priv->mm.active_list,
gtt_lru_entry) list)
if (obj_priv->pin_count == 0) if (obj_priv->pin_count == 0)
break; break;
if (!obj_priv) if (!obj_priv)
@ -447,8 +447,8 @@ i915_gem_object_bind_to_gtt(struct drm_gem_object *obj, unsigned alignment)
#if WATCH_LRU #if WATCH_LRU
DRM_INFO("%s: GTT full, evicting something\n", __func__); DRM_INFO("%s: GTT full, evicting something\n", __func__);
#endif #endif
if (list_empty(&dev_priv->mm.gtt_lru) && if (list_empty(&dev_priv->mm.inactive_list) &&
list_empty(&dev_priv->mm.execution_list)) { list_empty(&dev_priv->mm.active_list)) {
DRM_ERROR("GTT full, but LRU list empty\n"); DRM_ERROR("GTT full, but LRU list empty\n");
return -ENOMEM; return -ENOMEM;
} }
@ -835,10 +835,10 @@ i915_gem_wait_space(struct drm_device *dev)
int ret = 0; int ret = 0;
while (ring->space + 1024 < dev_priv->ring.Size && while (ring->space + 1024 < dev_priv->ring.Size &&
!list_empty(&dev_priv->mm.execution_list)) { !list_empty(&dev_priv->mm.active_list)) {
obj_priv = list_first_entry(&dev_priv->mm.execution_list, obj_priv = list_first_entry(&dev_priv->mm.active_list,
struct drm_i915_gem_object, struct drm_i915_gem_object,
gtt_lru_entry); list);
if (obj_priv == last_priv) if (obj_priv == last_priv)
break; break;
ret = i915_gem_object_wait_rendering(obj_priv->obj); ret = i915_gem_object_wait_rendering(obj_priv->obj);
@ -984,8 +984,8 @@ i915_gem_execbuffer(struct drm_device *dev, void *data,
obj_priv->last_rendering_cookie = cookie; obj_priv->last_rendering_cookie = cookie;
BUG_ON(obj_priv->last_rendering_cookie == 0); BUG_ON(obj_priv->last_rendering_cookie == 0);
/* Move our buffer to the tail of the execution list. */ /* Move our buffer to the tail of the execution list. */
list_move_tail(&obj_priv->gtt_lru_entry, list_move_tail(&obj_priv->list,
&dev_priv->mm.execution_list); &dev_priv->mm.active_list);
#if WATCH_LRU #if WATCH_LRU
DRM_INFO("%s: move to exec list %p\n", __func__, obj); DRM_INFO("%s: move to exec list %p\n", __func__, obj);
#endif #endif
@ -1083,7 +1083,7 @@ int i915_gem_init_object(struct drm_gem_object *obj)
obj->driver_private = obj_priv; obj->driver_private = obj_priv;
obj_priv->obj = obj; obj_priv->obj = obj;
INIT_LIST_HEAD(&obj_priv->gtt_lru_entry); INIT_LIST_HEAD(&obj_priv->list);
return 0; return 0;
} }
@ -1138,14 +1138,14 @@ i915_gem_lastclose(struct drm_device *dev)
* close, this is also the last ref and they'll go away. * close, this is also the last ref and they'll go away.
*/ */
while (!list_empty(&dev_priv->mm.execution_list)) { while (!list_empty(&dev_priv->mm.active_list)) {
struct drm_i915_gem_object *obj_priv; struct drm_i915_gem_object *obj_priv;
obj_priv = list_first_entry(&dev_priv->mm.execution_list, obj_priv = list_first_entry(&dev_priv->mm.active_list,
struct drm_i915_gem_object, struct drm_i915_gem_object,
gtt_lru_entry); list);
list_del_init(&obj_priv->gtt_lru_entry); list_del_init(&obj_priv->list);
obj_priv->last_rendering_cookie = 0; obj_priv->last_rendering_cookie = 0;
obj_priv->obj->write_domain = 0; obj_priv->obj->write_domain = 0;
drm_gem_object_unreference(obj_priv->obj); drm_gem_object_unreference(obj_priv->obj);

View File

@ -1051,8 +1051,8 @@ int i915_driver_load(struct drm_device *dev, unsigned long flags)
ret = drm_addmap(dev, base, size, _DRM_REGISTERS, ret = drm_addmap(dev, base, size, _DRM_REGISTERS,
_DRM_KERNEL | _DRM_DRIVER, &dev_priv->mmio_map); _DRM_KERNEL | _DRM_DRIVER, &dev_priv->mmio_map);
INIT_LIST_HEAD(&dev_priv->mm.gtt_lru); INIT_LIST_HEAD(&dev_priv->mm.active_list);
INIT_LIST_HEAD(&dev_priv->mm.execution_list); INIT_LIST_HEAD(&dev_priv->mm.inactive_list);
#ifdef __linux__ #ifdef __linux__
#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,25) #if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,25)

View File

@ -248,9 +248,9 @@ typedef struct drm_i915_private {
* List of objects currently involved in rendering from the * List of objects currently involved in rendering from the
* ringbuffer. * ringbuffer.
*/ */
struct list_head execution_list; struct list_head active_list;
/** LRU List of non-executing objects still in the GTT. */ /** LRU List of non-executing objects still in the GTT. */
struct list_head gtt_lru; struct list_head inactive_list;
} mm; } mm;
} drm_i915_private_t; } drm_i915_private_t;
@ -268,8 +268,8 @@ struct drm_i915_gem_object {
/** Current space allocated to this object in the GTT, if any. */ /** Current space allocated to this object in the GTT, if any. */
struct drm_memrange_node *gtt_space; struct drm_memrange_node *gtt_space;
/** This object's place on the GTT LRU list */ /** This object's place on the active or inactive lists */
struct list_head gtt_lru_entry; struct list_head list;
/** AGP memory structure for our GTT binding. */ /** AGP memory structure for our GTT binding. */
DRM_AGP_MEM *agp_mem; DRM_AGP_MEM *agp_mem;