diff options
author | Daniel Vetter <daniel.vetter@ffwll.ch> | 2017-03-22 16:54:01 -0400 |
---|---|---|
committer | Daniel Vetter <daniel.vetter@ffwll.ch> | 2017-03-24 04:36:06 -0400 |
commit | 0cad7f71b5be7f3c6b63cfccb881e65a3c09404d (patch) | |
tree | 0e3b1ec2c7b7a26fc0fa0f14f321cab7fc56c22f | |
parent | 760f71e72eb5c64b12d85d4e6dc79d28a708e09e (diff) |
drm/debugfs: Add kerneldoc
I've decided to not document drm_debugfs_remove_files, it's on the way
out.
The biggest part is a huge todo.rst entry with what all should be
improved.
v2: Nits from Gabriel.
Cc: Gabriel Krisman Bertazi <krisman@collabora.co.uk>
Reviewed-by: Gabriel Krisman Bertazi <krisman@collabora.co.uk>
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Link: http://patchwork.freedesktop.org/patch/msgid/20170322205401.24897-1-daniel.vetter@ffwll.ch
-rw-r--r-- | Documentation/gpu/drm-uapi.rst | 9 | ||||
-rw-r--r-- | Documentation/gpu/todo.rst | 26 | ||||
-rw-r--r-- | drivers/gpu/drm/drm_debugfs.c | 51 | ||||
-rw-r--r-- | drivers/gpu/drm/drm_internal.h | 2 | ||||
-rw-r--r-- | include/drm/drm_debugfs.h | 38 |
5 files changed, 74 insertions, 52 deletions
diff --git a/Documentation/gpu/drm-uapi.rst b/Documentation/gpu/drm-uapi.rst index 369e8ca12b8e..76356c86e358 100644 --- a/Documentation/gpu/drm-uapi.rst +++ b/Documentation/gpu/drm-uapi.rst | |||
@@ -210,6 +210,15 @@ Display CRC Support | |||
210 | .. kernel-doc:: drivers/gpu/drm/drm_debugfs_crc.c | 210 | .. kernel-doc:: drivers/gpu/drm/drm_debugfs_crc.c |
211 | :export: | 211 | :export: |
212 | 212 | ||
213 | Debugfs Support | ||
214 | --------------- | ||
215 | |||
216 | .. kernel-doc:: include/drm/drm_debugfs.h | ||
217 | :internal: | ||
218 | |||
219 | .. kernel-doc:: drivers/gpu/drm/drm_debugfs.c | ||
220 | :export: | ||
221 | |||
213 | VBlank event handling | 222 | VBlank event handling |
214 | ===================== | 223 | ===================== |
215 | 224 | ||
diff --git a/Documentation/gpu/todo.rst b/Documentation/gpu/todo.rst index 64e9d16170ce..0cdaddad2b9b 100644 --- a/Documentation/gpu/todo.rst +++ b/Documentation/gpu/todo.rst | |||
@@ -272,6 +272,32 @@ This is a really varied tasks with lots of little bits and pieces: | |||
272 | 272 | ||
273 | Contact: Daniel Vetter | 273 | Contact: Daniel Vetter |
274 | 274 | ||
275 | Clean up the debugfs support | ||
276 | ---------------------------- | ||
277 | |||
278 | There's a bunch of issues with it: | ||
279 | |||
280 | - The drm_info_list ->show() function doesn't even bother to cast to the drm | ||
281 | structure for you. This is lazy. | ||
282 | |||
283 | - We probably want to have some support for debugfs files on crtc/connectors and | ||
284 | maybe other kms objects directly in core. There's even drm_print support in | ||
285 | the funcs for these objects to dump kms state, so it's all there. And then the | ||
286 | ->show() functions should obviously give you a pointer to the right object. | ||
287 | |||
288 | - The drm_info_list stuff is centered on drm_minor instead of drm_device. For | ||
289 | anything we want to print drm_device (or maybe drm_file) is the right thing. | ||
290 | |||
291 | - The drm_driver->debugfs_init hooks we have is just an artifact of the old | ||
292 | midlayered load sequence. DRM debugfs should work more like sysfs, where you | ||
293 | can create properties/files for an object anytime you want, and the core | ||
294 | takes care of publishing/unpuplishing all the files at register/unregister | ||
295 | time. Drivers shouldn't need to worry about these technicalities, and fixing | ||
296 | this (together with the drm_minor->drm_device move) would allow us to remove | ||
297 | debugfs_init. | ||
298 | |||
299 | Contact: Daniel Vetter | ||
300 | |||
275 | Better Testing | 301 | Better Testing |
276 | ============== | 302 | ============== |
277 | 303 | ||
diff --git a/drivers/gpu/drm/drm_debugfs.c b/drivers/gpu/drm/drm_debugfs.c index 4b02f4230562..c1807d5754b2 100644 --- a/drivers/gpu/drm/drm_debugfs.c +++ b/drivers/gpu/drm/drm_debugfs.c | |||
@@ -1,10 +1,3 @@ | |||
1 | /** | ||
2 | * \file drm_debugfs.c | ||
3 | * debugfs support for DRM | ||
4 | * | ||
5 | * \author Ben Gamari <bgamari@gmail.com> | ||
6 | */ | ||
7 | |||
8 | /* | 1 | /* |
9 | * Created: Sun Dec 21 13:08:50 2008 by bgamari@gmail.com | 2 | * Created: Sun Dec 21 13:08:50 2008 by bgamari@gmail.com |
10 | * | 3 | * |
@@ -75,16 +68,15 @@ static const struct file_operations drm_debugfs_fops = { | |||
75 | 68 | ||
76 | 69 | ||
77 | /** | 70 | /** |
78 | * Initialize a given set of debugfs files for a device | 71 | * drm_debugfs_create_files - Initialize a given set of debugfs files for DRM |
79 | * | 72 | * minor |
80 | * \param files The array of files to create | 73 | * @files: The array of files to create |
81 | * \param count The number of files given | 74 | * @count: The number of files given |
82 | * \param root DRI debugfs dir entry. | 75 | * @root: DRI debugfs dir entry. |
83 | * \param minor device minor number | 76 | * @minor: device minor number |
84 | * \return Zero on success, non-zero on failure | ||
85 | * | 77 | * |
86 | * Create a given set of debugfs files represented by an array of | 78 | * Create a given set of debugfs files represented by an array of |
87 | * &drm_info_list in the given root directory. These files will be removed | 79 | * &struct drm_info_list in the given root directory. These files will be removed |
88 | * automatically on drm_debugfs_cleanup(). | 80 | * automatically on drm_debugfs_cleanup(). |
89 | */ | 81 | */ |
90 | int drm_debugfs_create_files(const struct drm_info_list *files, int count, | 82 | int drm_debugfs_create_files(const struct drm_info_list *files, int count, |
@@ -133,17 +125,6 @@ fail: | |||
133 | } | 125 | } |
134 | EXPORT_SYMBOL(drm_debugfs_create_files); | 126 | EXPORT_SYMBOL(drm_debugfs_create_files); |
135 | 127 | ||
136 | /** | ||
137 | * Initialize the DRI debugfs filesystem for a device | ||
138 | * | ||
139 | * \param dev DRM device | ||
140 | * \param minor device minor number | ||
141 | * \param root DRI debugfs dir entry. | ||
142 | * | ||
143 | * Create the DRI debugfs root entry "/sys/kernel/debug/dri", the device debugfs root entry | ||
144 | * "/sys/kernel/debug/dri/%minor%/", and each entry in debugfs_list as | ||
145 | * "/sys/kernel/debug/dri/%minor%/%name%". | ||
146 | */ | ||
147 | int drm_debugfs_init(struct drm_minor *minor, int minor_id, | 128 | int drm_debugfs_init(struct drm_minor *minor, int minor_id, |
148 | struct dentry *root) | 129 | struct dentry *root) |
149 | { | 130 | { |
@@ -189,16 +170,6 @@ int drm_debugfs_init(struct drm_minor *minor, int minor_id, | |||
189 | } | 170 | } |
190 | 171 | ||
191 | 172 | ||
192 | /** | ||
193 | * Remove a list of debugfs files | ||
194 | * | ||
195 | * \param files The list of files | ||
196 | * \param count The number of files | ||
197 | * \param minor The minor of which we should remove the files | ||
198 | * \return always zero. | ||
199 | * | ||
200 | * Remove all debugfs entries created by debugfs_init(). | ||
201 | */ | ||
202 | int drm_debugfs_remove_files(const struct drm_info_list *files, int count, | 173 | int drm_debugfs_remove_files(const struct drm_info_list *files, int count, |
203 | struct drm_minor *minor) | 174 | struct drm_minor *minor) |
204 | { | 175 | { |
@@ -235,14 +206,6 @@ static void drm_debugfs_remove_all_files(struct drm_minor *minor) | |||
235 | mutex_unlock(&minor->debugfs_lock); | 206 | mutex_unlock(&minor->debugfs_lock); |
236 | } | 207 | } |
237 | 208 | ||
238 | /** | ||
239 | * Cleanup the debugfs filesystem resources. | ||
240 | * | ||
241 | * \param minor device minor number. | ||
242 | * \return always zero. | ||
243 | * | ||
244 | * Remove all debugfs entries created by debugfs_init(). | ||
245 | */ | ||
246 | int drm_debugfs_cleanup(struct drm_minor *minor) | 209 | int drm_debugfs_cleanup(struct drm_minor *minor) |
247 | { | 210 | { |
248 | if (!minor->debugfs_root) | 211 | if (!minor->debugfs_root) |
diff --git a/drivers/gpu/drm/drm_internal.h b/drivers/gpu/drm/drm_internal.h index 92ff4b9393b1..3d8e8f878924 100644 --- a/drivers/gpu/drm/drm_internal.h +++ b/drivers/gpu/drm/drm_internal.h | |||
@@ -100,7 +100,7 @@ int drm_gem_open_ioctl(struct drm_device *dev, void *data, | |||
100 | void drm_gem_open(struct drm_device *dev, struct drm_file *file_private); | 100 | void drm_gem_open(struct drm_device *dev, struct drm_file *file_private); |
101 | void drm_gem_release(struct drm_device *dev, struct drm_file *file_private); | 101 | void drm_gem_release(struct drm_device *dev, struct drm_file *file_private); |
102 | 102 | ||
103 | /* drm_debugfs.c */ | 103 | /* drm_debugfs.c drm_debugfs_crc.c */ |
104 | #if defined(CONFIG_DEBUG_FS) | 104 | #if defined(CONFIG_DEBUG_FS) |
105 | int drm_debugfs_init(struct drm_minor *minor, int minor_id, | 105 | int drm_debugfs_init(struct drm_minor *minor, int minor_id, |
106 | struct dentry *root); | 106 | struct dentry *root); |
diff --git a/include/drm/drm_debugfs.h b/include/drm/drm_debugfs.h index 56924196d08d..ac0f75df1ac9 100644 --- a/include/drm/drm_debugfs.h +++ b/include/drm/drm_debugfs.h | |||
@@ -33,23 +33,47 @@ | |||
33 | #define _DRM_DEBUGFS_H_ | 33 | #define _DRM_DEBUGFS_H_ |
34 | 34 | ||
35 | /** | 35 | /** |
36 | * Info file list entry. This structure represents a debugfs or proc file to | 36 | * struct drm_info_list - debugfs info list entry |
37 | * be created by the drm core | 37 | * |
38 | * This structure represents a debugfs file to be created by the drm | ||
39 | * core. | ||
38 | */ | 40 | */ |
39 | struct drm_info_list { | 41 | struct drm_info_list { |
40 | const char *name; /** file name */ | 42 | /** @name: file name */ |
41 | int (*show)(struct seq_file*, void*); /** show callback */ | 43 | const char *name; |
42 | u32 driver_features; /**< Required driver features for this entry */ | 44 | /** |
45 | * @show: | ||
46 | * | ||
47 | * Show callback. &seq_file->private will be set to the &struct | ||
48 | * drm_info_node corresponding to the instance of this info on a given | ||
49 | * &struct drm_minor. | ||
50 | */ | ||
51 | int (*show)(struct seq_file*, void*); | ||
52 | /** @driver_features: Required driver features for this entry */ | ||
53 | u32 driver_features; | ||
54 | /** @data: Driver-private data, should not be device-specific. */ | ||
43 | void *data; | 55 | void *data; |
44 | }; | 56 | }; |
45 | 57 | ||
46 | /** | 58 | /** |
47 | * debugfs node structure. This structure represents a debugfs file. | 59 | * struct drm_info_node - Per-minor debugfs node structure |
60 | * | ||
61 | * This structure represents a debugfs file, as an instantiation of a &struct | ||
62 | * drm_info_list on a &struct drm_minor. | ||
63 | * | ||
64 | * FIXME: | ||
65 | * | ||
66 | * No it doesn't make a hole lot of sense that we duplicate debugfs entries for | ||
67 | * both the render and the primary nodes, but that's how this has organically | ||
68 | * grown. It should probably be fixed, with a compatibility link, if needed. | ||
48 | */ | 69 | */ |
49 | struct drm_info_node { | 70 | struct drm_info_node { |
50 | struct list_head list; | 71 | /** @minor: &struct drm_minor for this node. */ |
51 | struct drm_minor *minor; | 72 | struct drm_minor *minor; |
73 | /** @info_ent: template for this node. */ | ||
52 | const struct drm_info_list *info_ent; | 74 | const struct drm_info_list *info_ent; |
75 | /* private: */ | ||
76 | struct list_head list; | ||
53 | struct dentry *dent; | 77 | struct dentry *dent; |
54 | }; | 78 | }; |
55 | 79 | ||