[Intel-gfx] [PATCH 2/2] drm/i915: Export GTT buffer layout via debugfs

Chris Wilson chris at chris-wilson.co.uk
Wed Jun 17 22:53:08 CEST 2009


Signed-off-by: Chris Wilson <chris at chris-wilson.co.uk>
---
 drivers/gpu/drm/i915/i915_gem_debugfs.c |   20 ++++++++++++++++++++
 1 files changed, 20 insertions(+), 0 deletions(-)

diff --git a/drivers/gpu/drm/i915/i915_gem_debugfs.c b/drivers/gpu/drm/i915/i915_gem_debugfs.c
index c685772..1b4e1cc 100644
--- a/drivers/gpu/drm/i915/i915_gem_debugfs.c
+++ b/drivers/gpu/drm/i915/i915_gem_debugfs.c
@@ -356,6 +356,25 @@ static int i915_wait_source_info(struct seq_file *m, void *data)
 }
 #endif
 
+static int i915_gtt_info(struct seq_file *m, void *data)
+{
+	struct drm_info_node *node = (struct drm_info_node *) m->private;
+	struct drm_device *dev = node->minor->dev;
+	drm_i915_private_t *dev_priv = dev->dev_private;
+	struct drm_mm *mm = &dev_priv->mm.gtt_space;
+	struct drm_mm_node *mm_node;
+
+	mutex_lock(&dev->struct_mutex);
+	list_for_each_entry(mm_node, &mm->ml_entry, ml_entry) {
+		seq_printf(m, "0x%08lx  %09ld %s\n",
+			   mm_node->start,
+			   mm_node->size,
+			   mm_node->free ? "free" : "");
+	}
+	mutex_unlock(&dev->struct_mutex);
+	return 0;
+}
+
 static struct drm_info_list i915_gem_debugfs_list[] = {
 	{"i915_gem_active", i915_gem_object_list_info, 0, (void *) ACTIVE_LIST},
 	{"i915_gem_flushing", i915_gem_object_list_info, 0, (void *) FLUSHING_LIST},
@@ -371,6 +390,7 @@ static struct drm_info_list i915_gem_debugfs_list[] = {
 #ifdef I915_WAIT_ACCOUNTING
 	{"i915_wait_sources", i915_wait_source_info, 0},
 #endif
+	{"i915_gtt", i915_gtt_info, 0},
 };
 #define I915_GEM_DEBUGFS_ENTRIES ARRAY_SIZE(i915_gem_debugfs_list)
 
-- 
1.6.3.1




More information about the Intel-gfx mailing list