linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
From: "Heiko Stübner" <heiko@sntech.de>
To: Andy Yan <andyshrk@163.com>
Cc: hjc@rock-chips.com, krzk+dt@kernel.org, s.hauer@pengutronix.de,
	devicetree@vger.kernel.org, dri-devel@lists.freedesktop.org,
	linux-arm-kernel@lists.infradead.org,
	linux-kernel@vger.kernel.org, linux-rockchip@lists.infradead.org,
	derek.foreman@collabora.com, detlev.casanova@collabora.com,
	Andy Yan <andy.yan@rock-chips.com>,
	Michael Riesch <michael.riesch@wolfvision.net>
Subject: Re: [PATCH v5 01/18] drm/rockchip: vop2: Add debugfs support
Date: Wed, 11 Dec 2024 09:52:10 +0100	[thread overview]
Message-ID: <3527424.cLl3JjQhRp@diego> (raw)
In-Reply-To: <121ab3c0.68d0.193b48b32ed.Coremail.andyshrk@163.com>

Hi Andy,

Am Mittwoch, 11. Dezember 2024, 08:07:21 CET schrieb Andy Yan:
> At 2024-12-10 19:57:44, "Heiko Stübner" <heiko@sntech.de> wrote:
> >Am Montag, 9. Dezember 2024, 13:29:13 CET schrieb Andy Yan:
> >> From: Andy Yan <andy.yan@rock-chips.com>
> >> 
> >> /sys/kernel/debug/dri/vop2/summary:  dump vop display state
> >> /sys/kernel/debug/dri/vop2/regs: dump whole vop registers
> >> /sys/kernel/debug/dri/vop2/active_regs: only dump the registers of
> >> activated modules
> >> 
> >> Reviewed-by: Sascha Hauer <s.hauer@pengutronix.de>
> >> Signed-off-by: Andy Yan <andy.yan@rock-chips.com>
> >> Tested-by: Michael Riesch <michael.riesch@wolfvision.net> # on RK3568
> >> Tested-by: Detlev Casanova <detlev.casanova@collabora.com>
> >> ---
> >
> >> +static void __vop2_regs_dump(struct seq_file *s, bool active_only)
> >> +{
> >> +	struct drm_info_node *node = s->private;
> >> +	struct vop2 *vop2 = node->info_ent->data;
> >> +	struct drm_minor *minor = node->minor;
> >> +	struct drm_device *drm_dev = minor->dev;
> >> +	const struct vop2_regs_dump *dump;
> >> +	unsigned int i;
> >> +
> >> +	drm_modeset_lock_all(drm_dev);
> >> +
> >> +	regcache_drop_region(vop2->map, 0, vop2_regmap_config.max_register);
> >> +
> >> +	if (vop2->enable_count) {
> >> +		for (i = 0; i < vop2->data->regs_dump_size; i++) {
> >> +			dump = &vop2->data->regs_dump[i];
> >> +			vop2_regs_print(vop2, s, dump, active_only);
> >> +		}
> >> +	} else {
> >> +		seq_printf(s, "VOP disabled\n");
> >> +	}
> >> +	drm_modeset_unlock_all(drm_dev);
> >> +
> >
> >nit: not needed empty line at the end of the function
> 
> Will fixed in V6.
> 
> >
> >> +}
> >> +
> >
> >> +static void vop2_debugfs_init(struct vop2 *vop2, struct drm_minor *minor)
> >> +{
> >> +	struct dentry *root;
> >> +	unsigned int i;
> >> +
> >> +	root = debugfs_create_dir("vop2", minor->debugfs_root);
> >> +	if (!IS_ERR(root)) {
> >> +		for (i = 0; i < ARRAY_SIZE(vop2_debugfs_list); i++)
> >> +			vop2_debugfs_list[i].data = vop2;
> >> +
> >> +		drm_debugfs_create_files(vop2_debugfs_list,
> >> +					 ARRAY_SIZE(vop2_debugfs_list),
> >> +					 root, minor);
> >> +	}
> >> +}
> >> +
> >> +static int vop2_crtc_late_register(struct drm_crtc *crtc)
> >> +{
> >> +	struct vop2_video_port *vp = to_vop2_video_port(crtc);
> >> +	struct vop2 *vop2 = vp->vop2;
> >> +
> >> +	if (drm_crtc_index(crtc) == 0)
> >> +		vop2_debugfs_init(vop2, crtc->dev->primary);
> >> +
> >> +	return 0;
> >> +}
> >
> >I'm wondering about, shoudln't there be an unregister step too?
> >I.e. the late_register callback says:
> >"should be unregistered in the early_unregister callback" [0].
> >
> >And there exists drm_debugfs_remove_files(), though it doesn't
> >seem t be used much - just by tegra.
> >
> >I haven't managed to find drm code handling that automatically though?
> 
> Did a little digging:
>  rockchip_drm_unbind --》drm_dev_unregister(drm_dev)--》drm_debugfs_dev_fini
> --》debugfs_remove_recursive(dev->debugfs_root);
> This will remove all the debugfs file under /dri/0-->display-subsystem  when we
> remove rockchipdrm when it build as module.

thanks a lot for finding this. And yes, that covers all possible cases.

> If it is builtin, whether we remove them seems to make no difference when we
> reboot or thutdown the system ?
> I also searched for other platforms using similar late register hook, and it seems they haven't remove debugfs  either.

unbind can be called even if the driver is builtin - i.e. a driver
does not need to be a module to be unbount/rebound again.

But the drm_debugfs_dev_fini() function you found, solves that
in all cases, so this patch can stay as it is - minus the empty line.

Thanks a lot
Heiko




  reply	other threads:[~2024-12-11  8:53 UTC|newest]

Thread overview: 50+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-12-09 12:29 [PATCH v5 00/18] VOP Support for rk3576 Andy Yan
2024-12-09 12:29 ` [PATCH] arm64: dts: rockchip: Add vop " Andy Yan
2024-12-09 12:36   ` Andy Yan
2024-12-09 12:29 ` [PATCH] arm64: dts: rockchip: Enable HDMI display for rk3588 Cool Pi GenBook Andy Yan
2024-12-09 12:37   ` Andy Yan
2024-12-09 12:29 ` [PATCH v5 01/18] drm/rockchip: vop2: Add debugfs support Andy Yan
2024-12-10 11:57   ` Heiko Stübner
2024-12-11  7:07     ` Andy Yan
2024-12-11  8:52       ` Heiko Stübner [this message]
2024-12-09 12:29 ` [PATCH] drm/rockchip: vop2: Setup delay cycle for Esmart2/3 Andy Yan
2024-12-09 12:37   ` Andy Yan
2024-12-09 12:29 ` [PATCH v5 02/18] drm/rockchip: vop2: Fix cluster windows alpha ctrl regsiters offset Andy Yan
2024-12-09 12:29 ` [PATCH v5 03/18] drm/rockchip: vop2: Fix the mixer alpha setup for layer 0 Andy Yan
2024-12-09 12:29 ` [PATCH v5 04/18] drm/rockchip: vop2: Fix the windows switch between different layers Andy Yan
2024-12-10 23:09   ` Heiko Stuebner
2024-12-09 12:29 ` [PATCH v5 05/18] drm/rockchip: vop2: Set AXI id for rk3588 Andy Yan
2024-12-10 18:40   ` Detlev Casanova
2024-12-11  6:34     ` Andy Yan
2024-12-11 15:45       ` Detlev Casanova
2024-12-12  7:52         ` Andy Yan
2024-12-13 18:34           ` Detlev Casanova
2024-12-14  8:01             ` Andy Yan
2024-12-09 12:29 ` [PATCH v5 06/18] drm/rockchip: vop2: Setup delay cycle for Esmart2/3 Andy Yan
2024-12-09 12:29 ` [PATCH v5 07/18] drm/rockchip: vop2: Check linear format for Cluster windows on rk3566/8 Andy Yan
2024-12-09 12:32 ` [PATCH v5 08/18] drm/rockchip: vop2: Add check for 32 bpp format Andy Yan
2024-12-09 17:06   ` Daniel Stone
2024-12-10  7:01     ` Andy Yan
2024-12-09 12:32 ` [PATCH v5 09/18] drm/rockchip: vop2: include rockchip_drm_drv.h Andy Yan
2024-12-09 12:32 ` [PATCH v5 10/18] drm/rockchip: vop2: Support 32x8 superblock afbc Andy Yan
2024-12-09 12:33 ` [PATCH v5 11/18] drm/rockchip: vop2: Add platform specific callback Andy Yan
2024-12-09 12:33 ` [PATCH v5 12/18] drm/rockchip: vop2: Support for different layer select configuration between VPs Andy Yan
2024-12-09 12:33 ` [PATCH v5 13/18] drm/rockchip: vop2: Introduce vop hardware version Andy Yan
2024-12-10 15:03   ` Heiko Stübner
2024-12-09 12:33 ` [PATCH v5 14/18] drm/rockchip: vop2: Register the primary plane and overlay plane separately Andy Yan
2024-12-09 12:33 ` [PATCH v5 15/18] drm/rockchip: vop2: Set plane possible crtcs by possible vp mask Andy Yan
2024-12-09 12:34 ` [PATCH v5 16/18] drm/rockchip: vop2: Add uv swap for cluster window Andy Yan
2024-12-09 12:34 ` [PATCH v5 17/18] dt-bindings: display: vop2: Add rk3576 support Andy Yan
2024-12-09 12:34 ` [PATCH v5 18/18] drm/rockchip: vop2: Add support for rk3576 Andy Yan
2024-12-10 23:12 ` (subset) [PATCH v5 00/18] VOP Support " Heiko Stuebner
2024-12-14  8:15 ` [PATCH v6 00/16] " Andy Yan
2024-12-14  8:15   ` [PATCH v6 01/16] drm/rockchip: vop2: Add debugfs support Andy Yan
2024-12-14  8:15   ` [PATCH v6 02/16] drm/rockchip: vop2: Fix the windows switch between different layers Andy Yan
2024-12-14  8:15   ` [PATCH v6 03/16] drm/rockchip: vop2: Set AXI id for rk3588 Andy Yan
2024-12-14  8:15   ` [PATCH v6 04/16] drm/rockchip: vop2: Setup delay cycle for Esmart2/3 Andy Yan
2024-12-14  8:15   ` [PATCH v6 05/16] drm/rockchip: vop2: Check linear format for Cluster windows on rk3566/8 Andy Yan
2024-12-14  8:15   ` [PATCH v6 06/16] drm/rockchip: vop2: Add check for 32 bpp format for rk3588 Andy Yan
2024-12-14  8:15   ` [PATCH v6 07/16] drm/rockchip: vop2: include rockchip_drm_drv.h Andy Yan
2024-12-14  8:15   ` [PATCH v6 08/16] drm/rockchip: vop2: Support 32x8 superblock afbc Andy Yan
2024-12-14  8:15   ` [PATCH v6 09/16] drm/rockchip: vop2: Add platform specific callback Andy Yan
2024-12-14  8:15   ` [PATCH v6 10/16] drm/rockchip: vop2: Support for different layer select configuration between VPs Andy Yan

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=3527424.cLl3JjQhRp@diego \
    --to=heiko@sntech.de \
    --cc=andy.yan@rock-chips.com \
    --cc=andyshrk@163.com \
    --cc=derek.foreman@collabora.com \
    --cc=detlev.casanova@collabora.com \
    --cc=devicetree@vger.kernel.org \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=hjc@rock-chips.com \
    --cc=krzk+dt@kernel.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-rockchip@lists.infradead.org \
    --cc=michael.riesch@wolfvision.net \
    --cc=s.hauer@pengutronix.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).