drm/i915: Show pin mapped counts and sizes in debugfs

Show a total and purgeable number of pin mapped objects
and their total and purgeable size.

Example output (new stat prefixed with a star):

  # cat i915_gem_objects
  19920 objects, 289243136 bytes
  19920 [18466] objects, 288714752 [267911168] bytes in gtt
    0 [0] active objects, 0 [0] bytes
    19917 [18466] inactive objects, 288714752 [267911168] bytes
  0 unbound objects, 0 bytes
  0 purgeable objects, 0 bytes
  1 pinned mappable objects, 3145728 bytes
  0 fault mappable objects, 0 bytes
* 19914 [0] pin mapped objects, 285560832 [0] bytes [purgeable]
  4294967296 [268435456] gtt total

Signed-off-by: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
Cc: Chris Wilson <chris@chris-wilson.co.uk>
Reviewed-by: Chris Wilson <chris@chris-wilson.co.uk>
Link: http://patchwork.freedesktop.org/patch/msgid/1460716493-27826-1-git-send-email-tvrtko.ursulin@linux.intel.com
This commit is contained in:
Tvrtko Ursulin 2016-04-15 11:34:53 +01:00
parent be12a86b46
commit be19b10d24

View File

@ -443,6 +443,8 @@ static int i915_gem_object_info(struct seq_file *m, void* data)
struct i915_ggtt *ggtt = &dev_priv->ggtt; struct i915_ggtt *ggtt = &dev_priv->ggtt;
u32 count, mappable_count, purgeable_count; u32 count, mappable_count, purgeable_count;
u64 size, mappable_size, purgeable_size; u64 size, mappable_size, purgeable_size;
unsigned long pin_mapped_count = 0, pin_mapped_purgeable_count = 0;
u64 pin_mapped_size = 0, pin_mapped_purgeable_size = 0;
struct drm_i915_gem_object *obj; struct drm_i915_gem_object *obj;
struct drm_file *file; struct drm_file *file;
struct i915_vma *vma; struct i915_vma *vma;
@ -476,6 +478,14 @@ static int i915_gem_object_info(struct seq_file *m, void* data)
size += obj->base.size, ++count; size += obj->base.size, ++count;
if (obj->madv == I915_MADV_DONTNEED) if (obj->madv == I915_MADV_DONTNEED)
purgeable_size += obj->base.size, ++purgeable_count; purgeable_size += obj->base.size, ++purgeable_count;
if (obj->mapping) {
pin_mapped_count++;
pin_mapped_size += obj->base.size;
if (obj->pages_pin_count == 0) {
pin_mapped_purgeable_count++;
pin_mapped_purgeable_size += obj->base.size;
}
}
} }
seq_printf(m, "%u unbound objects, %llu bytes\n", count, size); seq_printf(m, "%u unbound objects, %llu bytes\n", count, size);
@ -493,6 +503,14 @@ static int i915_gem_object_info(struct seq_file *m, void* data)
purgeable_size += obj->base.size; purgeable_size += obj->base.size;
++purgeable_count; ++purgeable_count;
} }
if (obj->mapping) {
pin_mapped_count++;
pin_mapped_size += obj->base.size;
if (obj->pages_pin_count == 0) {
pin_mapped_purgeable_count++;
pin_mapped_purgeable_size += obj->base.size;
}
}
} }
seq_printf(m, "%u purgeable objects, %llu bytes\n", seq_printf(m, "%u purgeable objects, %llu bytes\n",
purgeable_count, purgeable_size); purgeable_count, purgeable_size);
@ -500,6 +518,10 @@ static int i915_gem_object_info(struct seq_file *m, void* data)
mappable_count, mappable_size); mappable_count, mappable_size);
seq_printf(m, "%u fault mappable objects, %llu bytes\n", seq_printf(m, "%u fault mappable objects, %llu bytes\n",
count, size); count, size);
seq_printf(m,
"%lu [%lu] pin mapped objects, %llu [%llu] bytes [purgeable]\n",
pin_mapped_count, pin_mapped_purgeable_count,
pin_mapped_size, pin_mapped_purgeable_size);
seq_printf(m, "%llu [%llu] gtt total\n", seq_printf(m, "%llu [%llu] gtt total\n",
ggtt->base.total, ggtt->mappable_end - ggtt->base.start); ggtt->base.total, ggtt->mappable_end - ggtt->base.start);