Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
torvalds
GitHub Repository: torvalds/linux
Path: blob/master/include/drm/drm_debugfs.h
26285 views
1
/*
2
* Internal Header for the Direct Rendering Manager
3
*
4
* Copyright 1999 Precision Insight, Inc., Cedar Park, Texas.
5
* Copyright 2000 VA Linux Systems, Inc., Sunnyvale, California.
6
* Copyright (c) 2009-2010, Code Aurora Forum.
7
* All rights reserved.
8
*
9
* Author: Rickard E. (Rik) Faith <[email protected]>
10
* Author: Gareth Hughes <[email protected]>
11
*
12
* Permission is hereby granted, free of charge, to any person obtaining a
13
* copy of this software and associated documentation files (the "Software"),
14
* to deal in the Software without restriction, including without limitation
15
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
16
* and/or sell copies of the Software, and to permit persons to whom the
17
* Software is furnished to do so, subject to the following conditions:
18
*
19
* The above copyright notice and this permission notice (including the next
20
* paragraph) shall be included in all copies or substantial portions of the
21
* Software.
22
*
23
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
24
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
25
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
26
* VA LINUX SYSTEMS AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
27
* OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
28
* ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
29
* OTHER DEALINGS IN THE SOFTWARE.
30
*/
31
32
#ifndef _DRM_DEBUGFS_H_
33
#define _DRM_DEBUGFS_H_
34
35
#include <linux/types.h>
36
#include <linux/seq_file.h>
37
38
#include <drm/drm_gpuvm.h>
39
40
/**
41
* DRM_DEBUGFS_GPUVA_INFO - &drm_info_list entry to dump a GPU VA space
42
* @show: the &drm_info_list's show callback
43
* @data: driver private data
44
*
45
* Drivers should use this macro to define a &drm_info_list entry to provide a
46
* debugfs file for dumping the GPU VA space regions and mappings.
47
*
48
* For each DRM GPU VA space drivers should call drm_debugfs_gpuva_info() from
49
* their @show callback.
50
*/
51
#define DRM_DEBUGFS_GPUVA_INFO(show, data) {"gpuvas", show, DRIVER_GEM_GPUVA, data}
52
53
/**
54
* struct drm_info_list - debugfs info list entry
55
*
56
* This structure represents a debugfs file to be created by the drm
57
* core.
58
*/
59
struct drm_info_list {
60
/** @name: file name */
61
const char *name;
62
/**
63
* @show:
64
*
65
* Show callback. &seq_file->private will be set to the &struct
66
* drm_info_node corresponding to the instance of this info on a given
67
* &struct drm_minor.
68
*/
69
int (*show)(struct seq_file*, void*);
70
/** @driver_features: Required driver features for this entry */
71
u32 driver_features;
72
/** @data: Driver-private data, should not be device-specific. */
73
void *data;
74
};
75
76
/**
77
* struct drm_info_node - Per-minor debugfs node structure
78
*
79
* This structure represents a debugfs file, as an instantiation of a &struct
80
* drm_info_list on a &struct drm_minor.
81
*
82
* FIXME:
83
*
84
* No it doesn't make a hole lot of sense that we duplicate debugfs entries for
85
* both the render and the primary nodes, but that's how this has organically
86
* grown. It should probably be fixed, with a compatibility link, if needed.
87
*/
88
struct drm_info_node {
89
/** @minor: &struct drm_minor for this node. */
90
struct drm_minor *minor;
91
/** @info_ent: template for this node. */
92
const struct drm_info_list *info_ent;
93
/* private: */
94
struct list_head list;
95
struct dentry *dent;
96
};
97
98
/**
99
* struct drm_debugfs_info - debugfs info list entry
100
*
101
* This structure represents a debugfs file to be created by the drm
102
* core.
103
*/
104
struct drm_debugfs_info {
105
/** @name: File name */
106
const char *name;
107
108
/**
109
* @show:
110
*
111
* Show callback. &seq_file->private will be set to the &struct
112
* drm_debugfs_entry corresponding to the instance of this info
113
* on a given &struct drm_device.
114
*/
115
int (*show)(struct seq_file*, void*);
116
117
/** @driver_features: Required driver features for this entry. */
118
u32 driver_features;
119
120
/** @data: Driver-private data, should not be device-specific. */
121
void *data;
122
};
123
124
/**
125
* struct drm_debugfs_entry - Per-device debugfs node structure
126
*
127
* This structure represents a debugfs file, as an instantiation of a &struct
128
* drm_debugfs_info on a &struct drm_device.
129
*/
130
struct drm_debugfs_entry {
131
/** @dev: &struct drm_device for this node. */
132
struct drm_device *dev;
133
134
/** @file: Template for this node. */
135
struct drm_debugfs_info file;
136
137
/** @list: Linked list of all device nodes. */
138
struct list_head list;
139
};
140
141
#if defined(CONFIG_DEBUG_FS)
142
void drm_debugfs_create_files(const struct drm_info_list *files,
143
int count, struct dentry *root,
144
struct drm_minor *minor);
145
int drm_debugfs_remove_files(const struct drm_info_list *files, int count,
146
struct dentry *root, struct drm_minor *minor);
147
148
void drm_debugfs_add_file(struct drm_device *dev, const char *name,
149
int (*show)(struct seq_file*, void*), void *data);
150
151
void drm_debugfs_add_files(struct drm_device *dev,
152
const struct drm_debugfs_info *files, int count);
153
154
int drm_debugfs_gpuva_info(struct seq_file *m,
155
struct drm_gpuvm *gpuvm);
156
157
void drm_debugfs_clients_add(struct drm_file *file);
158
void drm_debugfs_clients_remove(struct drm_file *file);
159
#else
160
static inline void drm_debugfs_create_files(const struct drm_info_list *files,
161
int count, struct dentry *root,
162
struct drm_minor *minor)
163
{}
164
165
static inline int drm_debugfs_remove_files(const struct drm_info_list *files,
166
int count, struct dentry *root,
167
struct drm_minor *minor)
168
{
169
return 0;
170
}
171
172
static inline void drm_debugfs_add_file(struct drm_device *dev, const char *name,
173
int (*show)(struct seq_file*, void*),
174
void *data)
175
{}
176
177
static inline void drm_debugfs_add_files(struct drm_device *dev,
178
const struct drm_debugfs_info *files,
179
int count)
180
{}
181
182
static inline int drm_debugfs_gpuva_info(struct seq_file *m,
183
struct drm_gpuvm *gpuvm)
184
{
185
return 0;
186
}
187
188
static inline void drm_debugfs_clients_add(struct drm_file *file)
189
{
190
}
191
192
static inline void drm_debugfs_clients_remove(struct drm_file *file)
193
{
194
}
195
#endif
196
197
#endif /* _DRM_DEBUGFS_H_ */
198
199