diff mbox

[RFC,1/2] drm/i915: Export active PPGTTs in debugfs

Message ID 1423771502-9766-2-git-send-email-rafael.barbalho@intel.com (mailing list archive)
State New, archived
Headers show

Commit Message

rafael.barbalho@intel.com Feb. 12, 2015, 8:05 p.m. UTC
From: Rafael Barbalho <rafael.barbalho@intel.com>

It's possible to gather up basic information on all active VMs.

Signed-off-by: Rafael Barbalho <rafael.barbalho@intel.com>
Cc: Daniel Vetter <daniel@ffwll.ch>
Cc: Jon Bloomfield <jon.bloomfield@intel.com>
---
 drivers/gpu/drm/i915/i915_debugfs.c | 41 +++++++++++++++++++++++++------------
 1 file changed, 28 insertions(+), 13 deletions(-)
diff mbox

Patch

diff --git a/drivers/gpu/drm/i915/i915_debugfs.c b/drivers/gpu/drm/i915/i915_debugfs.c
index 1467cc1..0bf10c0 100644
--- a/drivers/gpu/drm/i915/i915_debugfs.c
+++ b/drivers/gpu/drm/i915/i915_debugfs.c
@@ -125,7 +125,7 @@  describe_obj(struct seq_file *m, struct drm_i915_gem_object *obj)
 	struct i915_vma *vma;
 	int pin_count = 0;
 
-	seq_printf(m, "%pK: %s%s%s %8zdKiB %02x %02x %u %u %u%s%s%s",
+	seq_printf(m, "%p: %s%s%s %8zdKiB %02x %02x %u %u %u%s%s%s",
 		   &obj->base,
 		   get_pin_flag(obj),
 		   get_tiling_flag(obj),
@@ -2013,22 +2013,37 @@  static void gen8_ppgtt_info(struct seq_file *m, struct drm_device *dev)
 	struct drm_i915_private *dev_priv = dev->dev_private;
 	struct intel_engine_cs *ring;
 	struct i915_hw_ppgtt *ppgtt = dev_priv->mm.aliasing_ppgtt;
+	struct i915_address_space *vm;
 	int unused, i;
 
-	if (!ppgtt)
-		return;
 
-	seq_printf(m, "Page directories: %d\n", ppgtt->num_pd_pages);
-	seq_printf(m, "Page tables: %d\n", ppgtt->num_pd_entries);
-	for_each_ring(ring, dev_priv, unused) {
-		seq_printf(m, "%s\n", ring->name);
-		for (i = 0; i < 4; i++) {
-			u32 offset = 0x270 + i * 8;
-			u64 pdp = I915_READ(ring->mmio_base + offset + 4);
-			pdp <<= 32;
-			pdp |= I915_READ(ring->mmio_base + offset);
-			seq_printf(m, "\tPDP%d 0x%016llx\n", i, pdp);
+	if (ppgtt) {
+		seq_printf(m, "Page directories: %d\n", ppgtt->num_pd_pages);
+		seq_printf(m, "Page tables: %d\n", ppgtt->num_pd_entries);
+		for_each_ring(ring, dev_priv, unused) {
+			seq_printf(m, "%s\n", ring->name);
+			for (i = 0; i < 4; i++) {
+				u32 offset = 0x270 + i * 8;
+				u64 pdp = I915_READ(ring->mmio_base + offset + 4);
+				pdp <<= 32;
+				pdp |= I915_READ(ring->mmio_base + offset);
+				seq_printf(m, "\tPDP%d 0x%016llx\n", i, pdp);
+			}
+		}
+	} else {
+		i = 0;
+		list_for_each_entry(vm, &dev_priv->vm_list, global_link) {
+			if (i915_is_ggtt(vm))
+				continue;
+			i++;
+			ppgtt = i915_vm_to_ppgtt(vm);
+			seq_printf(m, "PPGTT %p - references\n", ppgtt);
+			seq_printf(m, "Page directories: %d\n",
+							ppgtt->num_pd_pages);
+			seq_printf(m, "Page tables: %d\n",
+							ppgtt->num_pd_entries);
 		}
+		seq_printf(m, "Number of PPGTTs active: %d\n", i);
 	}
 }