diff mbox series

[RFC,36/42] drm/i915/lmem: include debugfs metrics

Message ID 20190214145740.14521-37-matthew.auld@intel.com (mailing list archive)
State New, archived
Headers show
Series Introduce memory region concept (including device local memory) | expand

Commit Message

Matthew Auld Feb. 14, 2019, 2:57 p.m. UTC
Useful for debugging.

Signed-off-by: Matthew Auld <matthew.auld@intel.com>
Cc: Joonas Lahtinen <joonas.lahtinen@linux.intel.com>
Cc: Abdiel Janulgue <abdiel.janulgue@linux.intel.com>
---
 drivers/gpu/drm/i915/i915_debugfs.c | 27 +++++++++++++++++++++++++++
 1 file changed, 27 insertions(+)
diff mbox series

Patch

diff --git a/drivers/gpu/drm/i915/i915_debugfs.c b/drivers/gpu/drm/i915/i915_debugfs.c
index fed46fe19c03..2178c13213ef 100644
--- a/drivers/gpu/drm/i915/i915_debugfs.c
+++ b/drivers/gpu/drm/i915/i915_debugfs.c
@@ -435,6 +435,8 @@  static int i915_gem_object_info(struct seq_file *m, void *data)
 	struct i915_ggtt *ggtt = &dev_priv->ggtt;
 	u32 count, mapped_count, purgeable_count, dpy_count, huge_count;
 	u64 size, mapped_size, purgeable_size, dpy_size, huge_size;
+	u32 lmem_count, lmem_dpy_count;
+	u64 lmem_size, lmem_dpy_size;
 	struct drm_i915_gem_object *obj;
 	unsigned int page_sizes = 0;
 	char buf[80];
@@ -448,6 +450,7 @@  static int i915_gem_object_info(struct seq_file *m, void *data)
 	mapped_size = mapped_count = 0;
 	purgeable_size = purgeable_count = 0;
 	huge_size = huge_count = 0;
+	lmem_size = lmem_count = lmem_dpy_size = lmem_dpy_count = 0;
 
 	spin_lock(&dev_priv->mm.obj_lock);
 	list_for_each_entry(obj, &dev_priv->mm.unbound_list, mm.link) {
@@ -469,6 +472,15 @@  static int i915_gem_object_info(struct seq_file *m, void *data)
 			huge_size += obj->base.size;
 			page_sizes |= obj->mm.page_sizes.sg;
 		}
+
+		if (i915_gem_object_is_lmem(obj)) {
+			if (obj->pin_global) {
+				lmem_dpy_count++;
+				lmem_dpy_size += obj->base.size;
+			}
+			lmem_count++;
+			lmem_size += obj->base.size;
+		}
 	}
 	seq_printf(m, "%u unbound objects, %llu bytes\n", count, size);
 
@@ -497,6 +509,15 @@  static int i915_gem_object_info(struct seq_file *m, void *data)
 			huge_size += obj->base.size;
 			page_sizes |= obj->mm.page_sizes.sg;
 		}
+
+		if (i915_gem_object_is_lmem(obj)) {
+			if (obj->pin_global) {
+				lmem_dpy_count++;
+				lmem_dpy_size += obj->base.size;
+			}
+			lmem_count++;
+			lmem_size += obj->base.size;
+		}
 	}
 	spin_unlock(&dev_priv->mm.obj_lock);
 
@@ -513,6 +534,12 @@  static int i915_gem_object_info(struct seq_file *m, void *data)
 	seq_printf(m, "%u display objects (globally pinned), %llu bytes\n",
 		   dpy_count, dpy_size);
 
+	if (HAS_LMEM(dev_priv)) {
+		seq_printf(m, "%u LMEM objects, %llu bytes\n", lmem_count, lmem_size);
+		seq_printf(m, "%u LMEM display objects (globally pinned), %llu bytes\n",
+			   lmem_dpy_count, lmem_dpy_size);
+	}
+
 	seq_printf(m, "%llu [%pa] gtt total\n",
 		   ggtt->vm.total, &ggtt->mappable_end);
 	seq_printf(m, "Supported page sizes: %s\n",