drm/i915/debugfs: include some gtt page size metrics
Good to know, mostly for debugging purposes. v2: some improvements from Chris Signed-off-by: Matthew Auld <matthew.auld@intel.com> Cc: Joonas Lahtinen <joonas.lahtinen@linux.intel.com> Cc: Chris Wilson <chris@chris-wilson.co.uk> Reviewed-by: Chris Wilson <chris@chris-wilson.co.uk> Link: https://patchwork.freedesktop.org/patch/msgid/20171006145041.21673-17-matthew.auld@intel.com Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk> Link: https://patchwork.freedesktop.org/patch/msgid/20171006221833.32439-16-chris@chris-wilson.co.uk
This commit is contained in:
parent
d9ec12f8e3
commit
7393b7ee3a
|
@ -119,6 +119,36 @@ static u64 i915_gem_obj_total_ggtt_size(struct drm_i915_gem_object *obj)
|
||||||
return size;
|
return size;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static const char *
|
||||||
|
stringify_page_sizes(unsigned int page_sizes, char *buf, size_t len)
|
||||||
|
{
|
||||||
|
size_t x = 0;
|
||||||
|
|
||||||
|
switch (page_sizes) {
|
||||||
|
case 0:
|
||||||
|
return "";
|
||||||
|
case I915_GTT_PAGE_SIZE_4K:
|
||||||
|
return "4K";
|
||||||
|
case I915_GTT_PAGE_SIZE_64K:
|
||||||
|
return "64K";
|
||||||
|
case I915_GTT_PAGE_SIZE_2M:
|
||||||
|
return "2M";
|
||||||
|
default:
|
||||||
|
if (!buf)
|
||||||
|
return "M";
|
||||||
|
|
||||||
|
if (page_sizes & I915_GTT_PAGE_SIZE_2M)
|
||||||
|
x += snprintf(buf + x, len - x, "2M, ");
|
||||||
|
if (page_sizes & I915_GTT_PAGE_SIZE_64K)
|
||||||
|
x += snprintf(buf + x, len - x, "64K, ");
|
||||||
|
if (page_sizes & I915_GTT_PAGE_SIZE_4K)
|
||||||
|
x += snprintf(buf + x, len - x, "4K, ");
|
||||||
|
buf[x-2] = '\0';
|
||||||
|
|
||||||
|
return buf;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
describe_obj(struct seq_file *m, struct drm_i915_gem_object *obj)
|
describe_obj(struct seq_file *m, struct drm_i915_gem_object *obj)
|
||||||
{
|
{
|
||||||
|
@ -156,9 +186,10 @@ describe_obj(struct seq_file *m, struct drm_i915_gem_object *obj)
|
||||||
if (!drm_mm_node_allocated(&vma->node))
|
if (!drm_mm_node_allocated(&vma->node))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
seq_printf(m, " (%sgtt offset: %08llx, size: %08llx",
|
seq_printf(m, " (%sgtt offset: %08llx, size: %08llx, pages: %s",
|
||||||
i915_vma_is_ggtt(vma) ? "g" : "pp",
|
i915_vma_is_ggtt(vma) ? "g" : "pp",
|
||||||
vma->node.start, vma->node.size);
|
vma->node.start, vma->node.size,
|
||||||
|
stringify_page_sizes(vma->page_sizes.gtt, NULL, 0));
|
||||||
if (i915_vma_is_ggtt(vma)) {
|
if (i915_vma_is_ggtt(vma)) {
|
||||||
switch (vma->ggtt_view.type) {
|
switch (vma->ggtt_view.type) {
|
||||||
case I915_GGTT_VIEW_NORMAL:
|
case I915_GGTT_VIEW_NORMAL:
|
||||||
|
@ -403,10 +434,12 @@ static int i915_gem_object_info(struct seq_file *m, void *data)
|
||||||
struct drm_i915_private *dev_priv = node_to_i915(m->private);
|
struct drm_i915_private *dev_priv = node_to_i915(m->private);
|
||||||
struct drm_device *dev = &dev_priv->drm;
|
struct drm_device *dev = &dev_priv->drm;
|
||||||
struct i915_ggtt *ggtt = &dev_priv->ggtt;
|
struct i915_ggtt *ggtt = &dev_priv->ggtt;
|
||||||
u32 count, mapped_count, purgeable_count, dpy_count;
|
u32 count, mapped_count, purgeable_count, dpy_count, huge_count;
|
||||||
u64 size, mapped_size, purgeable_size, dpy_size;
|
u64 size, mapped_size, purgeable_size, dpy_size, huge_size;
|
||||||
struct drm_i915_gem_object *obj;
|
struct drm_i915_gem_object *obj;
|
||||||
|
unsigned int page_sizes = 0;
|
||||||
struct drm_file *file;
|
struct drm_file *file;
|
||||||
|
char buf[80];
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
ret = mutex_lock_interruptible(&dev->struct_mutex);
|
ret = mutex_lock_interruptible(&dev->struct_mutex);
|
||||||
|
@ -420,6 +453,7 @@ static int i915_gem_object_info(struct seq_file *m, void *data)
|
||||||
size = count = 0;
|
size = count = 0;
|
||||||
mapped_size = mapped_count = 0;
|
mapped_size = mapped_count = 0;
|
||||||
purgeable_size = purgeable_count = 0;
|
purgeable_size = purgeable_count = 0;
|
||||||
|
huge_size = huge_count = 0;
|
||||||
list_for_each_entry(obj, &dev_priv->mm.unbound_list, global_link) {
|
list_for_each_entry(obj, &dev_priv->mm.unbound_list, global_link) {
|
||||||
size += obj->base.size;
|
size += obj->base.size;
|
||||||
++count;
|
++count;
|
||||||
|
@ -433,6 +467,12 @@ static int i915_gem_object_info(struct seq_file *m, void *data)
|
||||||
mapped_count++;
|
mapped_count++;
|
||||||
mapped_size += obj->base.size;
|
mapped_size += obj->base.size;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (obj->mm.page_sizes.sg > I915_GTT_PAGE_SIZE) {
|
||||||
|
huge_count++;
|
||||||
|
huge_size += obj->base.size;
|
||||||
|
page_sizes |= obj->mm.page_sizes.sg;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
seq_printf(m, "%u unbound objects, %llu bytes\n", count, size);
|
seq_printf(m, "%u unbound objects, %llu bytes\n", count, size);
|
||||||
|
|
||||||
|
@ -455,6 +495,12 @@ static int i915_gem_object_info(struct seq_file *m, void *data)
|
||||||
mapped_count++;
|
mapped_count++;
|
||||||
mapped_size += obj->base.size;
|
mapped_size += obj->base.size;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (obj->mm.page_sizes.sg > I915_GTT_PAGE_SIZE) {
|
||||||
|
huge_count++;
|
||||||
|
huge_size += obj->base.size;
|
||||||
|
page_sizes |= obj->mm.page_sizes.sg;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
seq_printf(m, "%u bound objects, %llu bytes\n",
|
seq_printf(m, "%u bound objects, %llu bytes\n",
|
||||||
count, size);
|
count, size);
|
||||||
|
@ -462,11 +508,18 @@ static int i915_gem_object_info(struct seq_file *m, void *data)
|
||||||
purgeable_count, purgeable_size);
|
purgeable_count, purgeable_size);
|
||||||
seq_printf(m, "%u mapped objects, %llu bytes\n",
|
seq_printf(m, "%u mapped objects, %llu bytes\n",
|
||||||
mapped_count, mapped_size);
|
mapped_count, mapped_size);
|
||||||
|
seq_printf(m, "%u huge-paged objects (%s) %llu bytes\n",
|
||||||
|
huge_count,
|
||||||
|
stringify_page_sizes(page_sizes, buf, sizeof(buf)),
|
||||||
|
huge_size);
|
||||||
seq_printf(m, "%u display objects (pinned), %llu bytes\n",
|
seq_printf(m, "%u display objects (pinned), %llu bytes\n",
|
||||||
dpy_count, dpy_size);
|
dpy_count, dpy_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.total, ggtt->mappable_end);
|
||||||
|
seq_printf(m, "Supported page sizes: %s\n",
|
||||||
|
stringify_page_sizes(INTEL_INFO(dev_priv)->page_sizes,
|
||||||
|
buf, sizeof(buf)));
|
||||||
|
|
||||||
seq_putc(m, '\n');
|
seq_putc(m, '\n');
|
||||||
print_batch_pool_stats(m, dev_priv);
|
print_batch_pool_stats(m, dev_priv);
|
||||||
|
|
Loading…
Reference in New Issue