aboutsummaryrefslogtreecommitdiffstats
path: root/include/drm
diff options
context:
space:
mode:
authorBen Gamari <bgamari@gmail.com>2009-02-17 20:08:49 -0500
committerDave Airlie <airlied@redhat.com>2009-03-13 00:24:07 -0400
commit955b12def42e83287c1bdb1411d99451753c1391 (patch)
tree5dc5025f500b7a0a86c70ea79f2294e94902e3b2 /include/drm
parentdd8d7cb49e6e61da96ca44174b063081892c4dc6 (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. This contains the i915 hooks rewrite as well, to make bisectability better. Signed-off-by: Ben Gamari <bgamari@gmail.com> Signed-off-by: Eric Anholt <eric@anholt.net> Signed-off-by: Dave Airlie <airlied@redhat.com>
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 458e38e1d538..ccbcd13b6ed3 100644
--- a/include/drm/drmP.h
+++ b/include/drm/drmP.h
@@ -770,6 +770,8 @@ struct drm_driver {
770 770
771 int (*proc_init)(struct drm_minor *minor); 771 int (*proc_init)(struct drm_minor *minor);
772 void (*proc_cleanup)(struct drm_minor *minor); 772 void (*proc_cleanup)(struct drm_minor *minor);
773 int (*debugfs_init)(struct drm_minor *minor);
774 void (*debugfs_cleanup)(struct drm_minor *minor);
773 775
774 /** 776 /**
775 * Driver-specific constructor for drm_gem_objects, to set up 777 * Driver-specific constructor for drm_gem_objects, to set up
@@ -805,6 +807,48 @@ struct drm_driver {
805#define DRM_MINOR_CONTROL 2 807#define DRM_MINOR_CONTROL 2
806#define DRM_MINOR_RENDER 3 808#define DRM_MINOR_RENDER 3
807 809
810
811/**
812 * debugfs node list. This structure represents a debugfs file to
813 * be created by the drm core
814 */
815struct drm_debugfs_list {
816 const char *name; /** file name */
817 int (*show)(struct seq_file*, void*); /** show callback */
818 u32 driver_features; /**< Required driver features for this entry */
819};
820
821/**
822 * debugfs node structure. This structure represents a debugfs file.
823 */
824struct drm_debugfs_node {
825 struct list_head list;
826 struct drm_minor *minor;
827 struct drm_debugfs_list *debugfs_ent;
828 struct dentry *dent;
829};
830
831/**
832 * Info file list entry. This structure represents a debugfs or proc file to
833 * be created by the drm core
834 */
835struct drm_info_list {
836 const char *name; /** file name */
837 int (*show)(struct seq_file*, void*); /** show callback */
838 u32 driver_features; /**< Required driver features for this entry */
839 void *data;
840};
841
842/**
843 * debugfs node structure. This structure represents a debugfs file.
844 */
845struct drm_info_node {
846 struct list_head list;
847 struct drm_minor *minor;
848 struct drm_info_list *info_ent;
849 struct dentry *dent;
850};
851
808/** 852/**
809 * DRM minor structure. This structure represents a drm minor number. 853 * DRM minor structure. This structure represents a drm minor number.
810 */ 854 */
@@ -814,7 +858,12 @@ struct drm_minor {
814 dev_t device; /**< Device number for mknod */ 858 dev_t device; /**< Device number for mknod */
815 struct device kdev; /**< Linux device */ 859 struct device kdev; /**< Linux device */
816 struct drm_device *dev; 860 struct drm_device *dev;
817 struct proc_dir_entry *dev_root; /**< proc directory entry */ 861
862 struct proc_dir_entry *proc_root; /**< proc directory entry */
863 struct drm_info_node proc_nodes;
864 struct dentry *debugfs_root;
865 struct drm_info_node debugfs_nodes;
866
818 struct drm_master *master; /* currently active master for this node */ 867 struct drm_master *master; /* currently active master for this node */
819 struct list_head master_list; 868 struct list_head master_list;
820 struct drm_mode_group mode_group; 869 struct drm_mode_group mode_group;
@@ -1270,6 +1319,7 @@ extern unsigned int drm_debug;
1270 1319
1271extern struct class *drm_class; 1320extern struct class *drm_class;
1272extern struct proc_dir_entry *drm_proc_root; 1321extern struct proc_dir_entry *drm_proc_root;
1322extern struct dentry *drm_debugfs_root;
1273 1323
1274extern struct idr drm_minors_idr; 1324extern struct idr drm_minors_idr;
1275 1325
@@ -1280,6 +1330,31 @@ extern int drm_proc_init(struct drm_minor *minor, int minor_id,
1280 struct proc_dir_entry *root); 1330 struct proc_dir_entry *root);
1281extern int drm_proc_cleanup(struct drm_minor *minor, struct proc_dir_entry *root); 1331extern int drm_proc_cleanup(struct drm_minor *minor, struct proc_dir_entry *root);
1282 1332
1333 /* Debugfs support */
1334#if defined(CONFIG_DEBUG_FS)
1335extern int drm_debugfs_init(struct drm_minor *minor, int minor_id,
1336 struct dentry *root);
1337extern int drm_debugfs_create_files(struct drm_info_list *files, int count,
1338 struct dentry *root, struct drm_minor *minor);
1339extern int drm_debugfs_remove_files(struct drm_info_list *files, int count,
1340 struct drm_minor *minor);
1341extern int drm_debugfs_cleanup(struct drm_minor *minor);
1342#endif
1343
1344 /* Info file support */
1345extern int drm_name_info(struct seq_file *m, void *data);
1346extern int drm_vm_info(struct seq_file *m, void *data);
1347extern int drm_queues_info(struct seq_file *m, void *data);
1348extern int drm_bufs_info(struct seq_file *m, void *data);
1349extern int drm_vblank_info(struct seq_file *m, void *data);
1350extern int drm_clients_info(struct seq_file *m, void* data);
1351extern int drm_gem_name_info(struct seq_file *m, void *data);
1352extern int drm_gem_object_info(struct seq_file *m, void* data);
1353
1354#if DRM_DEBUG_CODE
1355extern int drm_vma_info(struct seq_file *m, void *data);
1356#endif
1357
1283 /* Scatter Gather Support (drm_scatter.h) */ 1358 /* Scatter Gather Support (drm_scatter.h) */
1284extern void drm_sg_cleanup(struct drm_sg_mem * entry); 1359extern void drm_sg_cleanup(struct drm_sg_mem * entry);
1285extern int drm_sg_alloc_ioctl(struct drm_device *dev, void *data, 1360extern int drm_sg_alloc_ioctl(struct drm_device *dev, void *data,