From 528096963f4984230cbbbad8fe7d3ccc6904b187 Mon Sep 17 00:00:00 2001 From: Mark Yao Date: Fri, 30 Dec 2016 17:03:51 +0800 Subject: [PATCH] drm/rockchip: add drm summary debugfs node With the summary debug node, show current display status would be easier. Using step: shell# cat /sys/kernel/debug/dri/0/summary vop name: ff900000.vop status=active Display mode: 1200x1920 fps[60] clk[160000] type[8] flag[a] H: 1200 1320 1340 1361 V: 1920 1941 1944 1962 win0-0: status=active format: AB24 little-endian (0x34324241) zpos: 0 src: pos[0x0] rect[1200x1920] dst: pos[0x0] rect[1200x1920] buf[0]: addr: 0x9e19000 pitch: 4800 offset: 0 win1-0: status=disabled win2-0: status=disabled win2-0: status=disabled win2-1: status=disabled win2-2: status=disabled win3-0: status=disabled win3-0: status=disabled win3-1: status=disabled win3-2: status=disabled vop name: ff8f0000.vop status=disabled Change-Id: I386398b0617f0c18902c4cadad5906be343cc4de Signed-off-by: Mark Yao Signed-off-by: Andy Yan --- drivers/gpu/drm/rockchip/rockchip_drm_drv.c | 48 +++++++++++++++++++++ 1 file changed, 48 insertions(+) diff --git a/drivers/gpu/drm/rockchip/rockchip_drm_drv.c b/drivers/gpu/drm/rockchip/rockchip_drm_drv.c index b32d625a790d..5ba50d469e4d 100644 --- a/drivers/gpu/drm/rockchip/rockchip_drm_drv.c +++ b/drivers/gpu/drm/rockchip/rockchip_drm_drv.c @@ -16,6 +16,7 @@ #include #include +#include #include #include #include @@ -133,6 +134,50 @@ static void rockchip_iommu_cleanup(struct drm_device *drm_dev) iommu_domain_free(private->domain); } +#ifdef CONFIG_DEBUG_FS +static int rockchip_drm_summary_show(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; + struct drm_crtc *crtc; + + drm_for_each_crtc(crtc, drm_dev) { + int pipe = drm_crtc_index(crtc); + + if (priv->crtc_funcs[pipe] && + priv->crtc_funcs[pipe]->debugfs_dump) + priv->crtc_funcs[pipe]->debugfs_dump(crtc, s); + } + + return 0; +} + +static struct drm_info_list rockchip_debugfs_files[] = { + { "summary", rockchip_drm_summary_show, 0, NULL }, +}; + +static void rockchip_drm_debugfs_init(struct drm_minor *minor) +{ + struct drm_device *dev = minor->dev; + struct rockchip_drm_private *priv = dev->dev_private; + struct drm_crtc *crtc; + + drm_debugfs_create_files(rockchip_debugfs_files, + ARRAY_SIZE(rockchip_debugfs_files), + minor->debugfs_root, minor); + + drm_for_each_crtc(crtc, dev) { + int pipe = drm_crtc_index(crtc); + + if (priv->crtc_funcs[pipe] && + priv->crtc_funcs[pipe]->debugfs_init) + priv->crtc_funcs[pipe]->debugfs_init(minor, crtc); + } +} +#endif + static int rockchip_drm_bind(struct device *dev) { struct drm_device *drm_dev; @@ -247,6 +292,9 @@ static struct drm_driver rockchip_drm_driver = { .gem_prime_vmap = rockchip_gem_prime_vmap, .gem_prime_vunmap = rockchip_gem_prime_vunmap, .gem_prime_mmap = rockchip_gem_mmap_buf, +#ifdef CONFIG_DEBUG_FS + .debugfs_init = rockchip_drm_debugfs_init, +#endif .fops = &rockchip_drm_driver_fops, .name = DRIVER_NAME, .desc = DRIVER_DESC,