mirror of
https://github.com/torvalds/linux.git
synced 2024-11-08 13:11:45 +00:00
drm/i915: Track pinned objects
Keep a list of pinned objects and display it via debugfs. Now all objects that exist in the GTT are always tracked on one of the active, flushing, inactive or pinned lists. Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
This commit is contained in:
parent
265db9585e
commit
f13d3f7311
@ -40,10 +40,13 @@
|
||||
|
||||
#if defined(CONFIG_DEBUG_FS)
|
||||
|
||||
#define RENDER_LIST 1
|
||||
#define BSD_LIST 2
|
||||
#define FLUSHING_LIST 3
|
||||
#define INACTIVE_LIST 4
|
||||
enum {
|
||||
RENDER_LIST,
|
||||
BSD_LIST,
|
||||
FLUSHING_LIST,
|
||||
INACTIVE_LIST,
|
||||
PINNED_LIST
|
||||
};
|
||||
|
||||
static const char *yesno(int v)
|
||||
{
|
||||
@ -150,6 +153,10 @@ static int i915_gem_object_list_info(struct seq_file *m, void *data)
|
||||
seq_printf(m, "Inactive:\n");
|
||||
head = &dev_priv->mm.inactive_list;
|
||||
break;
|
||||
case PINNED_LIST:
|
||||
seq_printf(m, "Pinned:\n");
|
||||
head = &dev_priv->mm.pinned_list;
|
||||
break;
|
||||
case FLUSHING_LIST:
|
||||
seq_printf(m, "Flushing:\n");
|
||||
head = &dev_priv->mm.flushing_list;
|
||||
@ -983,6 +990,7 @@ static struct drm_info_list i915_debugfs_list[] = {
|
||||
{"i915_gem_bsd_active", i915_gem_object_list_info, 0, (void *) BSD_LIST},
|
||||
{"i915_gem_flushing", i915_gem_object_list_info, 0, (void *) FLUSHING_LIST},
|
||||
{"i915_gem_inactive", i915_gem_object_list_info, 0, (void *) INACTIVE_LIST},
|
||||
{"i915_gem_pinned", i915_gem_object_list_info, 0, (void *) PINNED_LIST},
|
||||
{"i915_gem_pageflip", i915_gem_pageflip_info, 0},
|
||||
{"i915_gem_request", i915_gem_request_info, 0},
|
||||
{"i915_gem_seqno", i915_gem_seqno_info, 0},
|
||||
|
@ -569,6 +569,12 @@ typedef struct drm_i915_private {
|
||||
*/
|
||||
struct list_head inactive_list;
|
||||
|
||||
/**
|
||||
* LRU list of objects which are not in the ringbuffer but
|
||||
* are still pinned in the GTT.
|
||||
*/
|
||||
struct list_head pinned_list;
|
||||
|
||||
/** LRU list of objects with fence regs on them. */
|
||||
struct list_head fence_list;
|
||||
|
||||
|
@ -1051,7 +1051,6 @@ i915_gem_set_domain_ioctl(struct drm_device *dev, void *data,
|
||||
ret = i915_gem_object_set_to_cpu_domain(obj, write_domain != 0);
|
||||
}
|
||||
|
||||
|
||||
/* Maintain LRU order of "inactive" objects */
|
||||
if (ret == 0 && i915_gem_object_is_inactive(obj_priv))
|
||||
list_move_tail(&obj_priv->list, &dev_priv->mm.inactive_list);
|
||||
@ -1552,7 +1551,7 @@ i915_gem_object_move_to_inactive(struct drm_gem_object *obj)
|
||||
|
||||
i915_verify_inactive(dev, __FILE__, __LINE__);
|
||||
if (obj_priv->pin_count != 0)
|
||||
list_del_init(&obj_priv->list);
|
||||
list_move_tail(&obj_priv->list, &dev_priv->mm.pinned_list);
|
||||
else
|
||||
list_move_tail(&obj_priv->list, &dev_priv->mm.inactive_list);
|
||||
|
||||
@ -2044,9 +2043,7 @@ i915_gem_object_unbind(struct drm_gem_object *obj)
|
||||
obj_priv->gtt_space = NULL;
|
||||
}
|
||||
|
||||
/* Remove ourselves from the LRU list if present. */
|
||||
if (!list_empty(&obj_priv->list))
|
||||
list_del_init(&obj_priv->list);
|
||||
list_del_init(&obj_priv->list);
|
||||
|
||||
if (i915_gem_object_is_purgeable(obj_priv))
|
||||
i915_gem_object_truncate(obj);
|
||||
@ -4030,6 +4027,7 @@ int
|
||||
i915_gem_object_pin(struct drm_gem_object *obj, uint32_t alignment)
|
||||
{
|
||||
struct drm_device *dev = obj->dev;
|
||||
struct drm_i915_private *dev_priv = dev->dev_private;
|
||||
struct drm_i915_gem_object *obj_priv = to_intel_bo(obj);
|
||||
int ret;
|
||||
|
||||
@ -4065,9 +4063,9 @@ i915_gem_object_pin(struct drm_gem_object *obj, uint32_t alignment)
|
||||
if (obj_priv->pin_count == 1) {
|
||||
atomic_inc(&dev->pin_count);
|
||||
atomic_add(obj->size, &dev->pin_memory);
|
||||
if (!obj_priv->active &&
|
||||
(obj->write_domain & I915_GEM_GPU_DOMAINS) == 0)
|
||||
list_del_init(&obj_priv->list);
|
||||
if (!obj_priv->active)
|
||||
list_move_tail(&obj_priv->list,
|
||||
&dev_priv->mm.pinned_list);
|
||||
}
|
||||
i915_verify_inactive(dev, __FILE__, __LINE__);
|
||||
|
||||
@ -4091,8 +4089,7 @@ i915_gem_object_unpin(struct drm_gem_object *obj)
|
||||
* the inactive list
|
||||
*/
|
||||
if (obj_priv->pin_count == 0) {
|
||||
if (!obj_priv->active &&
|
||||
(obj->write_domain & I915_GEM_GPU_DOMAINS) == 0)
|
||||
if (!obj_priv->active)
|
||||
list_move_tail(&obj_priv->list,
|
||||
&dev_priv->mm.inactive_list);
|
||||
atomic_dec(&dev->pin_count);
|
||||
@ -4614,6 +4611,7 @@ i915_gem_load(struct drm_device *dev)
|
||||
INIT_LIST_HEAD(&dev_priv->mm.flushing_list);
|
||||
INIT_LIST_HEAD(&dev_priv->mm.gpu_write_list);
|
||||
INIT_LIST_HEAD(&dev_priv->mm.inactive_list);
|
||||
INIT_LIST_HEAD(&dev_priv->mm.pinned_list);
|
||||
INIT_LIST_HEAD(&dev_priv->mm.fence_list);
|
||||
INIT_LIST_HEAD(&dev_priv->mm.deferred_free_list);
|
||||
INIT_LIST_HEAD(&dev_priv->render_ring.active_list);
|
||||
|
Loading…
Reference in New Issue
Block a user