aboutsummaryrefslogtreecommitdiffstats
path: root/include/drm
diff options
context:
space:
mode:
authorBen Gamari <bgamari@gmail.com>2009-02-17 20:08:49 -0500
committerEric Anholt <eric@anholt.net>2009-03-27 18:12:00 -0400
commit28a62277e06f93729d0340d9659153dcfbdbe16d (patch)
tree6fbdd815754c329273d3bdb5adb31fc1f308ae32 /include/drm
parent40a5f0decdf050785ebd62b36ad48c869ee4b384 (diff)
drm: Convert proc files to seq_file and introduce debugfs
The old mechanism to formatting proc files is extremely ugly. The seq_file API was designed specifically for cases like this and greatly simplifies the process. Also, most of the files in /proc really don't belong there. This patch introduces the infrastructure for putting these into debugfs and exposes all of the proc files in debugfs as well. Signed-off-by: Ben Gamari <bgamari@gmail.com> Signed-off-by: Eric Anholt <eric@anholt.net>
Diffstat (limited to 'include/drm')
-rw-r--r--include/drm/drmP.h77
1 files changed, 76 insertions, 1 deletions
diff --git a/include/drm/drmP.h b/include/drm/drmP.h
index e5f4ae989abf..c19a93c3be85 100644
--- a/include/drm/drmP.h
+++ b/include/drm/drmP.h
@@ -758,6 +758,8 @@ struct drm_driver {
758 758
759 int (*proc_init)(struct drm_minor *minor); 759 int (*proc_init)(struct drm_minor *minor);
760 void (*proc_cleanup)(struct drm_minor *minor); 760 void (*proc_cleanup)(struct drm_minor *minor);
761 int (*debugfs_init)(struct drm_minor *minor);
762 void (*debugfs_cleanup)(struct drm_minor *minor);
761 763
762 /** 764 /**
763 * Driver-specific constructor for drm_gem_objects, to set up 765 * Driver-specific constructor for drm_gem_objects, to set up
@@ -793,6 +795,48 @@ struct drm_driver {
793#define DRM_MINOR_CONTROL 2 795#define DRM_MINOR_CONTROL 2
794#define DRM_MINOR_RENDER 3 796#define DRM_MINOR_RENDER 3
795 797
798
799/**
800 * debugfs node list. This structure represents a debugfs file to
801 * be created by the drm core
802 */
803struct drm_debugfs_list {
804 const char *name; /** file name */
805 int (*show)(struct seq_file*, void*); /** show callback */
806 u32 driver_features; /**< Required driver features for this entry */
807};
808
809/**
810 * debugfs node structure. This structure represents a debugfs file.
811 */
812struct drm_debugfs_node {
813 struct list_head list;
814 struct drm_minor *minor;
815 struct drm_debugfs_list *debugfs_ent;
816 struct dentry *dent;
817};
818
819/**
820 * Info file list entry. This structure represents a debugfs or proc file to
821 * be created by the drm core
822 */
823struct drm_info_list {
824 const char *name; /** file name */
825 int (*show)(struct seq_file*, void*); /** show callback */
826 u32 driver_features; /**< Required driver features for this entry */
827 void *data;
828};
829
830/**
831 * debugfs node structure. This structure represents a debugfs file.
832 */
833struct drm_info_node {
834 struct list_head list;
835 struct drm_minor *minor;
836 struct drm_info_list *info_ent;
837 struct dentry *dent;
838};
839
796/** 840/**
797 * DRM minor structure. This structure represents a drm minor number. 841 * DRM minor structure. This structure represents a drm minor number.
798 */ 842 */
@@ -802,7 +846,12 @@ struct drm_minor {
802 dev_t device; /**< Device number for mknod */ 846 dev_t device; /**< Device number for mknod */
803 struct device kdev; /**< Linux device */ 847 struct device kdev; /**< Linux device */
804 struct drm_device *dev; 848 struct drm_device *dev;
805 struct proc_dir_entry *dev_root; /**< proc directory entry */ 849
850 struct proc_dir_entry *proc_root; /**< proc directory entry */
851 struct drm_info_node proc_nodes;
852 struct dentry *debugfs_root;
853 struct drm_info_node debugfs_nodes;
854
806 struct drm_master *master; /* currently active master for this node */ 855 struct drm_master *master; /* currently active master for this node */
807 struct list_head master_list; 856 struct list_head master_list;
808 struct drm_mode_group mode_group; 857 struct drm_mode_group mode_group;
@@ -1258,6 +1307,7 @@ extern unsigned int drm_debug;
1258 1307
1259extern struct class *drm_class; 1308extern struct class *drm_class;
1260extern struct proc_dir_entry *drm_proc_root; 1309extern struct proc_dir_entry *drm_proc_root;
1310extern struct dentry *drm_debugfs_root;
1261 1311
1262extern struct idr drm_minors_idr; 1312extern struct idr drm_minors_idr;
1263 1313
@@ -1268,6 +1318,31 @@ extern int drm_proc_init(struct drm_minor *minor, int minor_id,
1268 struct proc_dir_entry *root); 1318 struct proc_dir_entry *root);
1269extern int drm_proc_cleanup(struct drm_minor *minor, struct proc_dir_entry *root); 1319extern int drm_proc_cleanup(struct drm_minor *minor, struct proc_dir_entry *root);
1270 1320
1321 /* Debugfs support */
1322#if defined(CONFIG_DEBUG_FS)
1323extern int drm_debugfs_init(struct drm_minor *minor, int minor_id,
1324 struct dentry *root);
1325extern int drm_debugfs_create_files(struct drm_info_list *files, int count,
1326 struct dentry *root, struct drm_minor *minor);
1327extern int drm_debugfs_remove_files(struct drm_info_list *files, int count,
1328 struct drm_minor *minor);
1329extern int drm_debugfs_cleanup(struct drm_minor *minor);
1330#endif
1331
1332 /* Info file support */
1333extern int drm_name_info(struct seq_file *m, void *data);
1334extern int drm_vm_info(struct seq_file *m, void *data);
1335extern int drm_queues_info(struct seq_file *m, void *data);
1336extern int drm_bufs_info(struct seq_file *m, void *data);
1337extern int drm_vblank_info(struct seq_file *m, void *data);
1338extern int drm_clients_info(struct seq_file *m, void* data);
1339extern int drm_gem_name_info(struct seq_file *m, void *data);
1340extern int drm_gem_object_info(struct seq_file *m, void* data);
1341
1342#if DRM_DEBUG_CODE
1343extern int drm_vma_info(struct seq_file *m, void *data);
1344#endif
1345
1271 /* Scatter Gather Support (drm_scatter.h) */ 1346 /* Scatter Gather Support (drm_scatter.h) */
1272extern void drm_sg_cleanup(struct drm_sg_mem * entry); 1347extern void drm_sg_cleanup(struct drm_sg_mem * entry);
1273extern int drm_sg_alloc_ioctl(struct drm_device *dev, void *data, 1348extern int drm_sg_alloc_ioctl(struct drm_device *dev, void *data,