diff options
-rw-r--r-- | drivers/gpu/drm/drm_stub.c | 17 | ||||
-rw-r--r-- | include/drm/drmP.h | 61 |
2 files changed, 72 insertions, 6 deletions
diff --git a/drivers/gpu/drm/drm_stub.c b/drivers/gpu/drm/drm_stub.c index b9631e3a1ea..89050684fe0 100644 --- a/drivers/gpu/drm/drm_stub.c +++ b/drivers/gpu/drm/drm_stub.c | |||
@@ -51,7 +51,22 @@ struct idr drm_minors_idr; | |||
51 | struct class *drm_class; | 51 | struct class *drm_class; |
52 | struct proc_dir_entry *drm_proc_root; | 52 | struct proc_dir_entry *drm_proc_root; |
53 | struct dentry *drm_debugfs_root; | 53 | struct dentry *drm_debugfs_root; |
54 | 54 | void drm_ut_debug_printk(unsigned int request_level, | |
55 | const char *prefix, | ||
56 | const char *function_name, | ||
57 | const char *format, ...) | ||
58 | { | ||
59 | va_list args; | ||
60 | |||
61 | if (drm_debug & request_level) { | ||
62 | if (function_name) | ||
63 | printk(KERN_DEBUG "[%s:%s], ", prefix, function_name); | ||
64 | va_start(args, format); | ||
65 | vprintk(format, args); | ||
66 | va_end(args); | ||
67 | } | ||
68 | } | ||
69 | EXPORT_SYMBOL(drm_ut_debug_printk); | ||
55 | static int drm_minor_get_id(struct drm_device *dev, int type) | 70 | static int drm_minor_get_id(struct drm_device *dev, int type) |
56 | { | 71 | { |
57 | int new_id; | 72 | int new_id; |
diff --git a/include/drm/drmP.h b/include/drm/drmP.h index efa5f79a35c..afc21685230 100644 --- a/include/drm/drmP.h +++ b/include/drm/drmP.h | |||
@@ -87,6 +87,15 @@ struct drm_device; | |||
87 | #include "drm_os_linux.h" | 87 | #include "drm_os_linux.h" |
88 | #include "drm_hashtab.h" | 88 | #include "drm_hashtab.h" |
89 | 89 | ||
90 | #define DRM_UT_CORE 0x01 | ||
91 | #define DRM_UT_DRIVER 0x02 | ||
92 | #define DRM_UT_KMS 0x04 | ||
93 | #define DRM_UT_MODE 0x08 | ||
94 | |||
95 | extern void drm_ut_debug_printk(unsigned int request_level, | ||
96 | const char *prefix, | ||
97 | const char *function_name, | ||
98 | const char *format, ...); | ||
90 | /***********************************************************************/ | 99 | /***********************************************************************/ |
91 | /** \name DRM template customization defaults */ | 100 | /** \name DRM template customization defaults */ |
92 | /*@{*/ | 101 | /*@{*/ |
@@ -186,15 +195,57 @@ struct drm_device; | |||
186 | * \param arg arguments | 195 | * \param arg arguments |
187 | */ | 196 | */ |
188 | #if DRM_DEBUG_CODE | 197 | #if DRM_DEBUG_CODE |
189 | #define DRM_DEBUG(fmt, arg...) \ | 198 | #define DRM_DEBUG(fmt, args...) \ |
190 | do { \ | 199 | do { \ |
191 | if ( drm_debug ) \ | 200 | drm_ut_debug_printk(DRM_UT_CORE, DRM_NAME, \ |
192 | printk(KERN_DEBUG \ | 201 | __func__, fmt, ##args); \ |
193 | "[" DRM_NAME ":%s] " fmt , \ | 202 | } while (0) |
194 | __func__ , ##arg); \ | 203 | |
204 | #define DRM_DEBUG_DRIVER(prefix, fmt, args...) \ | ||
205 | do { \ | ||
206 | drm_ut_debug_printk(DRM_UT_DRIVER, prefix, \ | ||
207 | __func__, fmt, ##args); \ | ||
208 | } while (0) | ||
209 | #define DRM_DEBUG_KMS(prefix, fmt, args...) \ | ||
210 | do { \ | ||
211 | drm_ut_debug_printk(DRM_UT_KMS, prefix, \ | ||
212 | __func__, fmt, ##args); \ | ||
213 | } while (0) | ||
214 | #define DRM_DEBUG_MODE(prefix, fmt, args...) \ | ||
215 | do { \ | ||
216 | drm_ut_debug_printk(DRM_UT_MODE, prefix, \ | ||
217 | __func__, fmt, ##args); \ | ||
218 | } while (0) | ||
219 | #define DRM_LOG(fmt, args...) \ | ||
220 | do { \ | ||
221 | drm_ut_debug_printk(DRM_UT_CORE, NULL, \ | ||
222 | NULL, fmt, ##args); \ | ||
223 | } while (0) | ||
224 | #define DRM_LOG_KMS(fmt, args...) \ | ||
225 | do { \ | ||
226 | drm_ut_debug_printk(DRM_UT_KMS, NULL, \ | ||
227 | NULL, fmt, ##args); \ | ||
228 | } while (0) | ||
229 | #define DRM_LOG_MODE(fmt, args...) \ | ||
230 | do { \ | ||
231 | drm_ut_debug_printk(DRM_UT_MODE, NULL, \ | ||
232 | NULL, fmt, ##args); \ | ||
233 | } while (0) | ||
234 | #define DRM_LOG_DRIVER(fmt, args...) \ | ||
235 | do { \ | ||
236 | drm_ut_debug_printk(DRM_UT_DRIVER, NULL, \ | ||
237 | NULL, fmt, ##args); \ | ||
195 | } while (0) | 238 | } while (0) |
196 | #else | 239 | #else |
240 | #define DRM_DEBUG_DRIVER(prefix, fmt, args...) do { } while (0) | ||
241 | #define DRM_DEBUG_KMS(prefix, fmt, args...) do { } while (0) | ||
242 | #define DRM_DEBUG_MODE(prefix, fmt, args...) do { } while (0) | ||
197 | #define DRM_DEBUG(fmt, arg...) do { } while (0) | 243 | #define DRM_DEBUG(fmt, arg...) do { } while (0) |
244 | #define DRM_LOG(fmt, arg...) do { } while (0) | ||
245 | #define DRM_LOG_KMS(fmt, args...) do { } while (0) | ||
246 | #define DRM_LOG_MODE(fmt, arg...) do { } while (0) | ||
247 | #define DRM_LOG_DRIVER(fmt, arg...) do { } while (0) | ||
248 | |||
198 | #endif | 249 | #endif |
199 | 250 | ||
200 | #define DRM_PROC_LIMIT (PAGE_SIZE-80) | 251 | #define DRM_PROC_LIMIT (PAGE_SIZE-80) |