xref: /dragonfly/sys/dev/drm/include/drm/drm_debugfs.h (revision 3f2dd94a)
1a85cb24fSFrançois Tigeot /*
2a85cb24fSFrançois Tigeot  * Internal Header for the Direct Rendering Manager
3a85cb24fSFrançois Tigeot  *
4a85cb24fSFrançois Tigeot  * Copyright 1999 Precision Insight, Inc., Cedar Park, Texas.
5a85cb24fSFrançois Tigeot  * Copyright 2000 VA Linux Systems, Inc., Sunnyvale, California.
6a85cb24fSFrançois Tigeot  * Copyright (c) 2009-2010, Code Aurora Forum.
7a85cb24fSFrançois Tigeot  * All rights reserved.
8a85cb24fSFrançois Tigeot  *
9a85cb24fSFrançois Tigeot  * Author: Rickard E. (Rik) Faith <faith@valinux.com>
10a85cb24fSFrançois Tigeot  * Author: Gareth Hughes <gareth@valinux.com>
11a85cb24fSFrançois Tigeot  *
12a85cb24fSFrançois Tigeot  * Permission is hereby granted, free of charge, to any person obtaining a
13a85cb24fSFrançois Tigeot  * copy of this software and associated documentation files (the "Software"),
14a85cb24fSFrançois Tigeot  * to deal in the Software without restriction, including without limitation
15a85cb24fSFrançois Tigeot  * the rights to use, copy, modify, merge, publish, distribute, sublicense,
16a85cb24fSFrançois Tigeot  * and/or sell copies of the Software, and to permit persons to whom the
17a85cb24fSFrançois Tigeot  * Software is furnished to do so, subject to the following conditions:
18a85cb24fSFrançois Tigeot  *
19a85cb24fSFrançois Tigeot  * The above copyright notice and this permission notice (including the next
20a85cb24fSFrançois Tigeot  * paragraph) shall be included in all copies or substantial portions of the
21a85cb24fSFrançois Tigeot  * Software.
22a85cb24fSFrançois Tigeot  *
23a85cb24fSFrançois Tigeot  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
24a85cb24fSFrançois Tigeot  * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
25a85cb24fSFrançois Tigeot  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
26a85cb24fSFrançois Tigeot  * VA LINUX SYSTEMS AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
27a85cb24fSFrançois Tigeot  * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
28a85cb24fSFrançois Tigeot  * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
29a85cb24fSFrançois Tigeot  * OTHER DEALINGS IN THE SOFTWARE.
30a85cb24fSFrançois Tigeot  */
31a85cb24fSFrançois Tigeot 
32a85cb24fSFrançois Tigeot #ifndef _DRM_DEBUGFS_H_
33a85cb24fSFrançois Tigeot #define _DRM_DEBUGFS_H_
34a85cb24fSFrançois Tigeot 
35a85cb24fSFrançois Tigeot /**
36*3f2dd94aSFrançois Tigeot  * struct drm_info_list - debugfs info list entry
37*3f2dd94aSFrançois Tigeot  *
38*3f2dd94aSFrançois Tigeot  * This structure represents a debugfs file to be created by the drm
39*3f2dd94aSFrançois Tigeot  * core.
40a85cb24fSFrançois Tigeot  */
41a85cb24fSFrançois Tigeot struct drm_info_list {
42*3f2dd94aSFrançois Tigeot 	/** @name: file name */
43*3f2dd94aSFrançois Tigeot 	const char *name;
44*3f2dd94aSFrançois Tigeot 	/**
45*3f2dd94aSFrançois Tigeot 	 * @show:
46*3f2dd94aSFrançois Tigeot 	 *
47*3f2dd94aSFrançois Tigeot 	 * Show callback. &seq_file->private will be set to the &struct
48*3f2dd94aSFrançois Tigeot 	 * drm_info_node corresponding to the instance of this info on a given
49*3f2dd94aSFrançois Tigeot 	 * &struct drm_minor.
50*3f2dd94aSFrançois Tigeot 	 */
51*3f2dd94aSFrançois Tigeot 	int (*show)(struct seq_file*, void*);
52*3f2dd94aSFrançois Tigeot 	/** @driver_features: Required driver features for this entry */
53*3f2dd94aSFrançois Tigeot 	u32 driver_features;
54*3f2dd94aSFrançois Tigeot 	/** @data: Driver-private data, should not be device-specific. */
55a85cb24fSFrançois Tigeot 	void *data;
56a85cb24fSFrançois Tigeot };
57a85cb24fSFrançois Tigeot 
58a85cb24fSFrançois Tigeot /**
59*3f2dd94aSFrançois Tigeot  * struct drm_info_node - Per-minor debugfs node structure
60*3f2dd94aSFrançois Tigeot  *
61*3f2dd94aSFrançois Tigeot  * This structure represents a debugfs file, as an instantiation of a &struct
62*3f2dd94aSFrançois Tigeot  * drm_info_list on a &struct drm_minor.
63*3f2dd94aSFrançois Tigeot  *
64*3f2dd94aSFrançois Tigeot  * FIXME:
65*3f2dd94aSFrançois Tigeot  *
66*3f2dd94aSFrançois Tigeot  * No it doesn't make a hole lot of sense that we duplicate debugfs entries for
67*3f2dd94aSFrançois Tigeot  * both the render and the primary nodes, but that's how this has organically
68*3f2dd94aSFrançois Tigeot  * grown. It should probably be fixed, with a compatibility link, if needed.
69a85cb24fSFrançois Tigeot  */
70a85cb24fSFrançois Tigeot struct drm_info_node {
71*3f2dd94aSFrançois Tigeot 	/** @minor: &struct drm_minor for this node. */
72a85cb24fSFrançois Tigeot 	struct drm_minor *minor;
73*3f2dd94aSFrançois Tigeot 	/** @info_ent: template for this node. */
74a85cb24fSFrançois Tigeot 	const struct drm_info_list *info_ent;
75*3f2dd94aSFrançois Tigeot 	/* private: */
76*3f2dd94aSFrançois Tigeot 	struct list_head list;
77a85cb24fSFrançois Tigeot 	struct dentry *dent;
78a85cb24fSFrançois Tigeot };
79a85cb24fSFrançois Tigeot 
80a85cb24fSFrançois Tigeot #if defined(CONFIG_DEBUG_FS)
81a85cb24fSFrançois Tigeot int drm_debugfs_create_files(const struct drm_info_list *files,
82a85cb24fSFrançois Tigeot 			     int count, struct dentry *root,
83a85cb24fSFrançois Tigeot 			     struct drm_minor *minor);
84a85cb24fSFrançois Tigeot int drm_debugfs_remove_files(const struct drm_info_list *files,
85a85cb24fSFrançois Tigeot 			     int count, struct drm_minor *minor);
86a85cb24fSFrançois Tigeot #else
drm_debugfs_create_files(const struct drm_info_list * files,int count,struct dentry * root,struct drm_minor * minor)87a85cb24fSFrançois Tigeot static inline int drm_debugfs_create_files(const struct drm_info_list *files,
88a85cb24fSFrançois Tigeot 					   int count, struct dentry *root,
89a85cb24fSFrançois Tigeot 					   struct drm_minor *minor)
90a85cb24fSFrançois Tigeot {
91a85cb24fSFrançois Tigeot 	return 0;
92a85cb24fSFrançois Tigeot }
93a85cb24fSFrançois Tigeot 
drm_debugfs_remove_files(const struct drm_info_list * files,int count,struct drm_minor * minor)94a85cb24fSFrançois Tigeot static inline int drm_debugfs_remove_files(const struct drm_info_list *files,
95a85cb24fSFrançois Tigeot 					   int count, struct drm_minor *minor)
96a85cb24fSFrançois Tigeot {
97a85cb24fSFrançois Tigeot 	return 0;
98a85cb24fSFrançois Tigeot }
99a85cb24fSFrançois Tigeot #endif
100a85cb24fSFrançois Tigeot 
101a85cb24fSFrançois Tigeot #endif /* _DRM_DEBUGFS_H_ */
102