From 8b1aea0325cb4688645e20c818973757fbaa508d Mon Sep 17 00:00:00 2001 From: Mark Yao Date: Tue, 3 Jan 2017 11:50:55 +0800 Subject: [PATCH] drm/rockchip: add mm dump debugfs 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 --- drivers/gpu/drm/rockchip/rockchip_drm_drv.c | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/drivers/gpu/drm/rockchip/rockchip_drm_drv.c b/drivers/gpu/drm/rockchip/rockchip_drm_drv.c index ce0b385a5f61..56a1eb23e093 100644 --- a/drivers/gpu/drm/rockchip/rockchip_drm_drv.c +++ b/drivers/gpu/drm/rockchip/rockchip_drm_drv.c @@ -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) -- 2.34.1