Back to home page

OSCL-LXR

 
 

    


0001 /*
0002  * Internal Header for the Direct Rendering Manager
0003  *
0004  * Copyright 1999 Precision Insight, Inc., Cedar Park, Texas.
0005  * Copyright 2000 VA Linux Systems, Inc., Sunnyvale, California.
0006  * Copyright (c) 2009-2010, Code Aurora Forum.
0007  * All rights reserved.
0008  *
0009  * Author: Rickard E. (Rik) Faith <faith@valinux.com>
0010  * Author: Gareth Hughes <gareth@valinux.com>
0011  *
0012  * Permission is hereby granted, free of charge, to any person obtaining a
0013  * copy of this software and associated documentation files (the "Software"),
0014  * to deal in the Software without restriction, including without limitation
0015  * the rights to use, copy, modify, merge, publish, distribute, sublicense,
0016  * and/or sell copies of the Software, and to permit persons to whom the
0017  * Software is furnished to do so, subject to the following conditions:
0018  *
0019  * The above copyright notice and this permission notice (including the next
0020  * paragraph) shall be included in all copies or substantial portions of the
0021  * Software.
0022  *
0023  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
0024  * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
0025  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
0026  * VA LINUX SYSTEMS AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
0027  * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
0028  * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
0029  * OTHER DEALINGS IN THE SOFTWARE.
0030  */
0031 
0032 #ifndef _DRM_DEBUGFS_H_
0033 #define _DRM_DEBUGFS_H_
0034 
0035 #include <linux/types.h>
0036 #include <linux/seq_file.h>
0037 /**
0038  * struct drm_info_list - debugfs info list entry
0039  *
0040  * This structure represents a debugfs file to be created by the drm
0041  * core.
0042  */
0043 struct drm_info_list {
0044     /** @name: file name */
0045     const char *name;
0046     /**
0047      * @show:
0048      *
0049      * Show callback. &seq_file->private will be set to the &struct
0050      * drm_info_node corresponding to the instance of this info on a given
0051      * &struct drm_minor.
0052      */
0053     int (*show)(struct seq_file*, void*);
0054     /** @driver_features: Required driver features for this entry */
0055     u32 driver_features;
0056     /** @data: Driver-private data, should not be device-specific. */
0057     void *data;
0058 };
0059 
0060 /**
0061  * struct drm_info_node - Per-minor debugfs node structure
0062  *
0063  * This structure represents a debugfs file, as an instantiation of a &struct
0064  * drm_info_list on a &struct drm_minor.
0065  *
0066  * FIXME:
0067  *
0068  * No it doesn't make a hole lot of sense that we duplicate debugfs entries for
0069  * both the render and the primary nodes, but that's how this has organically
0070  * grown. It should probably be fixed, with a compatibility link, if needed.
0071  */
0072 struct drm_info_node {
0073     /** @minor: &struct drm_minor for this node. */
0074     struct drm_minor *minor;
0075     /** @info_ent: template for this node. */
0076     const struct drm_info_list *info_ent;
0077     /* private: */
0078     struct list_head list;
0079     struct dentry *dent;
0080 };
0081 
0082 #if defined(CONFIG_DEBUG_FS)
0083 void drm_debugfs_create_files(const struct drm_info_list *files,
0084                   int count, struct dentry *root,
0085                   struct drm_minor *minor);
0086 int drm_debugfs_remove_files(const struct drm_info_list *files,
0087                  int count, struct drm_minor *minor);
0088 #else
0089 static inline void drm_debugfs_create_files(const struct drm_info_list *files,
0090                         int count, struct dentry *root,
0091                         struct drm_minor *minor)
0092 {}
0093 
0094 static inline int drm_debugfs_remove_files(const struct drm_info_list *files,
0095                        int count, struct drm_minor *minor)
0096 {
0097     return 0;
0098 }
0099 #endif
0100 
0101 #endif /* _DRM_DEBUGFS_H_ */