Message ID | 20230209081838.45273-3-christian.koenig@amd.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
Series | [1/3] drm/debugfs: separate debugfs creation into init and register | expand |
On 2/9/23 05:18, Christian König wrote: > The different subsystems should probably only register their debugfs > files once. > > This temporary removes the common files from the render node directory. > > Signed-off-by: Christian König <christian.koenig@amd.com> > --- > drivers/gpu/drm/drm_atomic.c | 4 ++-- > drivers/gpu/drm/drm_client.c | 4 ++-- > drivers/gpu/drm/drm_crtc_internal.h | 2 +- > drivers/gpu/drm/drm_debugfs.c | 24 ++++++++++++------------ > drivers/gpu/drm/drm_drv.c | 4 +++- > drivers/gpu/drm/drm_framebuffer.c | 4 ++-- > drivers/gpu/drm/drm_internal.h | 5 +++-- > include/drm/drm_client.h | 2 +- > 8 files changed, 26 insertions(+), 23 deletions(-) > [...] > diff --git a/drivers/gpu/drm/drm_internal.h b/drivers/gpu/drm/drm_internal.h > index 332fb65a935a..5ff7bf88f162 100644 > --- a/drivers/gpu/drm/drm_internal.h > +++ b/drivers/gpu/drm/drm_internal.h > @@ -185,7 +185,8 @@ int drm_gem_dumb_destroy(struct drm_file *file, struct drm_device *dev, > #if defined(CONFIG_DEBUG_FS) > int drm_debugfs_init(struct drm_minor *minor, int minor_id, > struct dentry *root); > -void drm_debugfs_register(struct drm_minor *minor); > +void drm_debugfs_dev_register(struct drm_device *dev); > +void drm_debugfs_minor_register(struct drm_minor *minor); For this patch and the previous one, I believe you need to add the functions to the #else path as well, otherwise it won't compile for CONFIG_DEBUG_FS=n. Best Regards, - Maíra Canal > void drm_debugfs_cleanup(struct drm_minor *minor); > void drm_debugfs_late_register(struct drm_device *dev); > void drm_debugfs_connector_add(struct drm_connector *connector); > @@ -261,4 +262,4 @@ int drm_syncobj_query_ioctl(struct drm_device *dev, void *data, > /* drm_framebuffer.c */ > void drm_framebuffer_print_info(struct drm_printer *p, unsigned int indent, > const struct drm_framebuffer *fb); > -void drm_framebuffer_debugfs_init(struct drm_minor *minor); > +void drm_framebuffer_debugfs_init(struct drm_device *dev); > diff --git a/include/drm/drm_client.h b/include/drm/drm_client.h > index 39482527a775..507d132cf494 100644 > --- a/include/drm/drm_client.h > +++ b/include/drm/drm_client.h > @@ -200,6 +200,6 @@ int drm_client_modeset_dpms(struct drm_client_dev *client, int mode); > drm_for_each_connector_iter(connector, iter) \ > if (connector->connector_type != DRM_MODE_CONNECTOR_WRITEBACK) > > -void drm_client_debugfs_init(struct drm_minor *minor); > +void drm_client_debugfs_init(struct drm_device *dev); > > #endif
Am 09.02.23 um 12:12 schrieb Maíra Canal: > On 2/9/23 05:18, Christian König wrote: >> The different subsystems should probably only register their debugfs >> files once. >> >> This temporary removes the common files from the render node directory. >> >> Signed-off-by: Christian König <christian.koenig@amd.com> >> --- >> drivers/gpu/drm/drm_atomic.c | 4 ++-- >> drivers/gpu/drm/drm_client.c | 4 ++-- >> drivers/gpu/drm/drm_crtc_internal.h | 2 +- >> drivers/gpu/drm/drm_debugfs.c | 24 ++++++++++++------------ >> drivers/gpu/drm/drm_drv.c | 4 +++- >> drivers/gpu/drm/drm_framebuffer.c | 4 ++-- >> drivers/gpu/drm/drm_internal.h | 5 +++-- >> include/drm/drm_client.h | 2 +- >> 8 files changed, 26 insertions(+), 23 deletions(-) >> > > [...] > >> diff --git a/drivers/gpu/drm/drm_internal.h >> b/drivers/gpu/drm/drm_internal.h >> index 332fb65a935a..5ff7bf88f162 100644 >> --- a/drivers/gpu/drm/drm_internal.h >> +++ b/drivers/gpu/drm/drm_internal.h >> @@ -185,7 +185,8 @@ int drm_gem_dumb_destroy(struct drm_file *file, >> struct drm_device *dev, >> #if defined(CONFIG_DEBUG_FS) >> int drm_debugfs_init(struct drm_minor *minor, int minor_id, >> struct dentry *root); >> -void drm_debugfs_register(struct drm_minor *minor); >> +void drm_debugfs_dev_register(struct drm_device *dev); >> +void drm_debugfs_minor_register(struct drm_minor *minor); > > For this patch and the previous one, I believe you need to add the > functions > to the #else path as well, otherwise it won't compile for > CONFIG_DEBUG_FS=n. Oh, good point. Going to fix this. Thanks, Christian. > > Best Regards, > - Maíra Canal > >> void drm_debugfs_cleanup(struct drm_minor *minor); >> void drm_debugfs_late_register(struct drm_device *dev); >> void drm_debugfs_connector_add(struct drm_connector *connector); >> @@ -261,4 +262,4 @@ int drm_syncobj_query_ioctl(struct drm_device >> *dev, void *data, >> /* drm_framebuffer.c */ >> void drm_framebuffer_print_info(struct drm_printer *p, unsigned int >> indent, >> const struct drm_framebuffer *fb); >> -void drm_framebuffer_debugfs_init(struct drm_minor *minor); >> +void drm_framebuffer_debugfs_init(struct drm_device *dev); >> diff --git a/include/drm/drm_client.h b/include/drm/drm_client.h >> index 39482527a775..507d132cf494 100644 >> --- a/include/drm/drm_client.h >> +++ b/include/drm/drm_client.h >> @@ -200,6 +200,6 @@ int drm_client_modeset_dpms(struct drm_client_dev >> *client, int mode); >> drm_for_each_connector_iter(connector, iter) \ >> if (connector->connector_type != DRM_MODE_CONNECTOR_WRITEBACK) >> -void drm_client_debugfs_init(struct drm_minor *minor); >> +void drm_client_debugfs_init(struct drm_device *dev); >> #endif
diff --git a/drivers/gpu/drm/drm_atomic.c b/drivers/gpu/drm/drm_atomic.c index 5457c02ca1ab..ae6ec1dd162a 100644 --- a/drivers/gpu/drm/drm_atomic.c +++ b/drivers/gpu/drm/drm_atomic.c @@ -1770,9 +1770,9 @@ static const struct drm_debugfs_info drm_atomic_debugfs_list[] = { {"state", drm_state_info, 0}, }; -void drm_atomic_debugfs_init(struct drm_minor *minor) +void drm_atomic_debugfs_init(struct drm_device *dev) { - drm_debugfs_add_files(minor->dev, drm_atomic_debugfs_list, + drm_debugfs_add_files(dev, drm_atomic_debugfs_list, ARRAY_SIZE(drm_atomic_debugfs_list)); } #endif diff --git a/drivers/gpu/drm/drm_client.c b/drivers/gpu/drm/drm_client.c index 009e7b10455c..847acf0ef570 100644 --- a/drivers/gpu/drm/drm_client.c +++ b/drivers/gpu/drm/drm_client.c @@ -507,9 +507,9 @@ static const struct drm_debugfs_info drm_client_debugfs_list[] = { { "internal_clients", drm_client_debugfs_internal_clients, 0 }, }; -void drm_client_debugfs_init(struct drm_minor *minor) +void drm_client_debugfs_init(struct drm_device *dev) { - drm_debugfs_add_files(minor->dev, drm_client_debugfs_list, + drm_debugfs_add_files(dev, drm_client_debugfs_list, ARRAY_SIZE(drm_client_debugfs_list)); } #endif diff --git a/drivers/gpu/drm/drm_crtc_internal.h b/drivers/gpu/drm/drm_crtc_internal.h index 501a10edd0e1..8556c3b3ff88 100644 --- a/drivers/gpu/drm/drm_crtc_internal.h +++ b/drivers/gpu/drm/drm_crtc_internal.h @@ -232,7 +232,7 @@ int drm_mode_dirtyfb_ioctl(struct drm_device *dev, /* drm_atomic.c */ #ifdef CONFIG_DEBUG_FS struct drm_minor; -void drm_atomic_debugfs_init(struct drm_minor *minor); +void drm_atomic_debugfs_init(struct drm_device *dev); #endif int __drm_atomic_helper_disable_plane(struct drm_plane *plane, diff --git a/drivers/gpu/drm/drm_debugfs.c b/drivers/gpu/drm/drm_debugfs.c index 2724cac03509..558e3a7271a5 100644 --- a/drivers/gpu/drm/drm_debugfs.c +++ b/drivers/gpu/drm/drm_debugfs.c @@ -231,22 +231,22 @@ int drm_debugfs_init(struct drm_minor *minor, int minor_id, return 0; } -void drm_debugfs_register(struct drm_minor *minor) +void drm_debugfs_dev_register(struct drm_device *dev) { - struct drm_device *dev = minor->dev; - struct drm_debugfs_entry *entry, *tmp; - - drm_debugfs_add_files(minor->dev, drm_debugfs_list, DRM_DEBUGFS_ENTRIES); - - if (drm_drv_uses_atomic_modeset(dev)) { - drm_atomic_debugfs_init(minor); - } + drm_debugfs_add_files(dev, drm_debugfs_list, DRM_DEBUGFS_ENTRIES); if (drm_core_check_feature(dev, DRIVER_MODESET)) { - drm_framebuffer_debugfs_init(minor); - - drm_client_debugfs_init(minor); + drm_framebuffer_debugfs_init(dev); + drm_client_debugfs_init(dev); } + if (drm_drv_uses_atomic_modeset(dev)) + drm_atomic_debugfs_init(dev); +} + +void drm_debugfs_minor_register(struct drm_minor *minor) +{ + struct drm_device *dev = minor->dev; + struct drm_debugfs_entry *entry, *tmp; if (dev->driver->debugfs_init) dev->driver->debugfs_init(minor); diff --git a/drivers/gpu/drm/drm_drv.c b/drivers/gpu/drm/drm_drv.c index 88ce22c04672..2cbe028e548c 100644 --- a/drivers/gpu/drm/drm_drv.c +++ b/drivers/gpu/drm/drm_drv.c @@ -179,7 +179,7 @@ static int drm_minor_register(struct drm_device *dev, unsigned int type) if (minor->type == DRM_MINOR_ACCEL) accel_debugfs_init(minor, minor->index); else - drm_debugfs_register(minor); + drm_debugfs_minor_register(minor); ret = device_add(minor->kdev); if (ret) @@ -913,6 +913,8 @@ int drm_dev_register(struct drm_device *dev, unsigned long flags) if (drm_dev_needs_global_mutex(dev)) mutex_lock(&drm_global_mutex); + drm_debugfs_dev_register(dev); + ret = drm_minor_register(dev, DRM_MINOR_RENDER); if (ret) goto err_minors; diff --git a/drivers/gpu/drm/drm_framebuffer.c b/drivers/gpu/drm/drm_framebuffer.c index aff3746dedfb..ba51deb6d042 100644 --- a/drivers/gpu/drm/drm_framebuffer.c +++ b/drivers/gpu/drm/drm_framebuffer.c @@ -1222,9 +1222,9 @@ static const struct drm_debugfs_info drm_framebuffer_debugfs_list[] = { { "framebuffer", drm_framebuffer_info, 0 }, }; -void drm_framebuffer_debugfs_init(struct drm_minor *minor) +void drm_framebuffer_debugfs_init(struct drm_device *dev) { - drm_debugfs_add_files(minor->dev, drm_framebuffer_debugfs_list, + drm_debugfs_add_files(dev, drm_framebuffer_debugfs_list, ARRAY_SIZE(drm_framebuffer_debugfs_list)); } #endif diff --git a/drivers/gpu/drm/drm_internal.h b/drivers/gpu/drm/drm_internal.h index 332fb65a935a..5ff7bf88f162 100644 --- a/drivers/gpu/drm/drm_internal.h +++ b/drivers/gpu/drm/drm_internal.h @@ -185,7 +185,8 @@ int drm_gem_dumb_destroy(struct drm_file *file, struct drm_device *dev, #if defined(CONFIG_DEBUG_FS) int drm_debugfs_init(struct drm_minor *minor, int minor_id, struct dentry *root); -void drm_debugfs_register(struct drm_minor *minor); +void drm_debugfs_dev_register(struct drm_device *dev); +void drm_debugfs_minor_register(struct drm_minor *minor); void drm_debugfs_cleanup(struct drm_minor *minor); void drm_debugfs_late_register(struct drm_device *dev); void drm_debugfs_connector_add(struct drm_connector *connector); @@ -261,4 +262,4 @@ int drm_syncobj_query_ioctl(struct drm_device *dev, void *data, /* drm_framebuffer.c */ void drm_framebuffer_print_info(struct drm_printer *p, unsigned int indent, const struct drm_framebuffer *fb); -void drm_framebuffer_debugfs_init(struct drm_minor *minor); +void drm_framebuffer_debugfs_init(struct drm_device *dev); diff --git a/include/drm/drm_client.h b/include/drm/drm_client.h index 39482527a775..507d132cf494 100644 --- a/include/drm/drm_client.h +++ b/include/drm/drm_client.h @@ -200,6 +200,6 @@ int drm_client_modeset_dpms(struct drm_client_dev *client, int mode); drm_for_each_connector_iter(connector, iter) \ if (connector->connector_type != DRM_MODE_CONNECTOR_WRITEBACK) -void drm_client_debugfs_init(struct drm_minor *minor); +void drm_client_debugfs_init(struct drm_device *dev); #endif
The different subsystems should probably only register their debugfs files once. This temporary removes the common files from the render node directory. Signed-off-by: Christian König <christian.koenig@amd.com> --- drivers/gpu/drm/drm_atomic.c | 4 ++-- drivers/gpu/drm/drm_client.c | 4 ++-- drivers/gpu/drm/drm_crtc_internal.h | 2 +- drivers/gpu/drm/drm_debugfs.c | 24 ++++++++++++------------ drivers/gpu/drm/drm_drv.c | 4 +++- drivers/gpu/drm/drm_framebuffer.c | 4 ++-- drivers/gpu/drm/drm_internal.h | 5 +++-- include/drm/drm_client.h | 2 +- 8 files changed, 26 insertions(+), 23 deletions(-)