2022-12-07 14:16:15

by Maíra Canal

[permalink] [raw]
Subject: [PATCH v3 0/6] Introduce debugfs device-centered functions

This series introduces the initial structure to make DRM debugfs more
device-centered and it is the first step to drop the
drm_driver->debugfs_init hooks in the future [1].

Currently, DRM debugfs files are created using drm_debugfs_create_files()
on request. The first patch of this series makes it possible for DRM devices
for creating debugfs files during drm_dev_register(). For it, it introduces
two new functions that can be used by the drivers: drm_debugfs_add_files()
and drm_debugfs_add_file(). The requests are added to a list and are created
all at once during drm_dev_register(). Moreover, the first patch was based on
this RFC series [2].

The main difference between the RFC series and the current series is the
creation of a new fops structure to accommodate the new structs and, also,
the creation of a new drm_debugfs_open. Moreover, the new series uses
device-managed allocation, returns memory allocation errors, and converts
more drivers to the new structure.

Apart from the first patch, the following patches are converting some drivers
to the new DRM debugfs structure and the last patch update the TODO task
related to it.

[1] https://cgit.freedesktop.org/drm/drm/tree/Documentation/gpu/todo.rst#n506
[2] https://lore.kernel.org/dri-devel/[email protected]/

Best Regards,
- Maíra Canal

---

v1 -> v2: https://lore.kernel.org/dri-devel/[email protected]/T/#t

- Fix compilation errors in the second patch (kernel test robot).
- Drop debugfs_init hook from vkms (Maíra Canal).
- Remove return values and error handling to debugfs related
functions (Jani Nikula).
- Remove entry from list after the file is created, so that drm_debugfs_init
can be called more than once (Maíra Canal).

v2 -> v3: https://lore.kernel.org/dri-devel/[email protected]/

- Rebase on top of drm-misc-next

---

Maíra Canal (6):
drm/debugfs: create device-centered debugfs functions
drm: use new debugfs device-centered functions on DRM core files
drm/vc4: use new debugfs device-centered functions
drm/v3d: use new debugfs device-centered functions
drm/vkms: use new debugfs device-centered functions
drm/todo: update the debugfs clean up task

Documentation/gpu/todo.rst | 9 +--
drivers/gpu/drm/drm_atomic.c | 11 ++--
drivers/gpu/drm/drm_client.c | 11 ++--
drivers/gpu/drm/drm_debugfs.c | 88 ++++++++++++++++++++++++---
drivers/gpu/drm/drm_drv.c | 3 +
drivers/gpu/drm/drm_framebuffer.c | 11 ++--
drivers/gpu/drm/drm_gem_vram_helper.c | 11 ++--
drivers/gpu/drm/v3d/v3d_debugfs.c | 22 +++----
drivers/gpu/drm/vc4/vc4_bo.c | 10 +--
drivers/gpu/drm/vc4/vc4_crtc.c | 7 +--
drivers/gpu/drm/vc4/vc4_debugfs.c | 36 +++--------
drivers/gpu/drm/vc4/vc4_dpi.c | 5 +-
drivers/gpu/drm/vc4/vc4_drv.c | 1 -
drivers/gpu/drm/vc4/vc4_drv.h | 32 +++-------
drivers/gpu/drm/vc4/vc4_dsi.c | 6 +-
drivers/gpu/drm/vc4/vc4_hdmi.c | 12 ++--
drivers/gpu/drm/vc4/vc4_hvs.c | 24 +++-----
drivers/gpu/drm/vc4/vc4_v3d.c | 14 ++---
drivers/gpu/drm/vc4/vc4_vec.c | 6 +-
drivers/gpu/drm/vkms/vkms_drv.c | 17 ++----
include/drm/drm_debugfs.h | 41 +++++++++++++
include/drm/drm_device.h | 15 +++++
22 files changed, 212 insertions(+), 180 deletions(-)

--
2.38.1


2022-12-07 14:22:08

by Maíra Canal

[permalink] [raw]
Subject: [PATCH v3 6/6] drm/todo: update the debugfs clean up task

The structs drm_debugfs_info and drm_debugfs_entry introduced a new
debugfs structure to DRM, centered on drm_device instead of drm_minor.
Therefore, remove the tasks related to create a new device-centered
debugfs structure and add a new task to replace the use of
drm_debugfs_create_files() for the use of drm_debugfs_add_file() and
drm_debugfs_add_files().

Signed-off-by: Maíra Canal <[email protected]>
---
Documentation/gpu/todo.rst | 9 ++-------
1 file changed, 2 insertions(+), 7 deletions(-)

diff --git a/Documentation/gpu/todo.rst b/Documentation/gpu/todo.rst
index b2c6aaf1edf2..f64abf69f341 100644
--- a/Documentation/gpu/todo.rst
+++ b/Documentation/gpu/todo.rst
@@ -508,17 +508,14 @@ Clean up the debugfs support

There's a bunch of issues with it:

-- The drm_info_list ->show() function doesn't even bother to cast to the drm
- structure for you. This is lazy.
+- Convert drivers to support the drm_debugfs_add_files() function instead of
+ the drm_debugfs_create_files() function.

- We probably want to have some support for debugfs files on crtc/connectors and
maybe other kms objects directly in core. There's even drm_print support in
the funcs for these objects to dump kms state, so it's all there. And then the
->show() functions should obviously give you a pointer to the right object.

-- The drm_info_list stuff is centered on drm_minor instead of drm_device. For
- anything we want to print drm_device (or maybe drm_file) is the right thing.
-
- The drm_driver->debugfs_init hooks we have is just an artifact of the old
midlayered load sequence. DRM debugfs should work more like sysfs, where you
can create properties/files for an object anytime you want, and the core
@@ -527,8 +524,6 @@ There's a bunch of issues with it:
this (together with the drm_minor->drm_device move) would allow us to remove
debugfs_init.

-Previous RFC that hasn't landed yet: https://lore.kernel.org/dri-devel/[email protected]/
-
Contact: Daniel Vetter

Level: Intermediate
--
2.38.1