drm/rockchip: add mm dump debugfs
authorMark Yao <mark.yao@rock-chips.com>
Tue, 3 Jan 2017 03:50:55 +0000 (11:50 +0800)
committerHuang, Tao <huangtao@rock-chips.com>
Tue, 3 Jan 2017 06:26:12 +0000 (14:26 +0800)
shell# cat /sys/kernel/debug/dri/0/mm_dump

0x0000000000000000-0x00000000000a6000: 679936: free
0x00000000000a6000-0x0000000000970000: 9216000: used
0x0000000000970000-0x000000000123a000: 9216000: used
0x000000000123a000-0x0000000001b04000: 9216000: used
0x0000000001b04000-0x00000000023ce000: 9216000: used
0x00000000023ce000-0x0000000002c98000: 9216000: used
0x0000000002c98000-0x0000000003562000: 9216000: used
0x0000000003562000-0x0000000003e2c000: 9216000: used
0x0000000003e2c000-0x0000000100000000: 4229775360: free
total: 4294967296, used 64512000 free 4230455296

Change-Id: I39cb5b12a63418c050b3bd890829f831f898db4e
Signed-off-by: Mark Yao <mark.yao@rock-chips.com>
drivers/gpu/drm/rockchip/rockchip_drm_drv.c

index ce0b385a5f611750cf69be51dc06484b2ba74ec1..56a1eb23e0933950400570f4aa7362aa815f4f4c 100644 (file)
@@ -772,6 +772,23 @@ static void rockchip_iommu_cleanup(struct drm_device *drm_dev)
 }
 
 #ifdef CONFIG_DEBUG_FS
+static int rockchip_drm_mm_dump(struct seq_file *s, void *data)
+{
+       struct drm_info_node *node = s->private;
+       struct drm_minor *minor = node->minor;
+       struct drm_device *drm_dev = minor->dev;
+       struct rockchip_drm_private *priv = drm_dev->dev_private;
+       int ret;
+
+       mutex_lock(&priv->mm_lock);
+
+       ret = drm_mm_dump_table(s, &priv->mm);
+
+       mutex_unlock(&priv->mm_lock);
+
+       return ret;
+}
+
 static int rockchip_drm_summary_show(struct seq_file *s, void *data)
 {
        struct drm_info_node *node = s->private;
@@ -793,6 +810,7 @@ static int rockchip_drm_summary_show(struct seq_file *s, void *data)
 
 static struct drm_info_list rockchip_debugfs_files[] = {
        { "summary", rockchip_drm_summary_show, 0, NULL },
+       { "mm_dump", rockchip_drm_mm_dump, 0, NULL },
 };
 
 static int rockchip_drm_debugfs_init(struct drm_minor *minor)