~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

TOMOYO Linux Cross Reference
Linux/include/drm/drm_print.h

Version: ~ [ linux-6.11-rc3 ] ~ [ linux-6.10.4 ] ~ [ linux-6.9.12 ] ~ [ linux-6.8.12 ] ~ [ linux-6.7.12 ] ~ [ linux-6.6.45 ] ~ [ linux-6.5.13 ] ~ [ linux-6.4.16 ] ~ [ linux-6.3.13 ] ~ [ linux-6.2.16 ] ~ [ linux-6.1.104 ] ~ [ linux-6.0.19 ] ~ [ linux-5.19.17 ] ~ [ linux-5.18.19 ] ~ [ linux-5.17.15 ] ~ [ linux-5.16.20 ] ~ [ linux-5.15.164 ] ~ [ linux-5.14.21 ] ~ [ linux-5.13.19 ] ~ [ linux-5.12.19 ] ~ [ linux-5.11.22 ] ~ [ linux-5.10.223 ] ~ [ linux-5.9.16 ] ~ [ linux-5.8.18 ] ~ [ linux-5.7.19 ] ~ [ linux-5.6.19 ] ~ [ linux-5.5.19 ] ~ [ linux-5.4.281 ] ~ [ linux-5.3.18 ] ~ [ linux-5.2.21 ] ~ [ linux-5.1.21 ] ~ [ linux-5.0.21 ] ~ [ linux-4.20.17 ] ~ [ linux-4.19.319 ] ~ [ linux-4.18.20 ] ~ [ linux-4.17.19 ] ~ [ linux-4.16.18 ] ~ [ linux-4.15.18 ] ~ [ linux-4.14.336 ] ~ [ linux-4.13.16 ] ~ [ linux-4.12.14 ] ~ [ linux-4.11.12 ] ~ [ linux-4.10.17 ] ~ [ linux-4.9.337 ] ~ [ linux-4.4.302 ] ~ [ linux-3.10.108 ] ~ [ linux-2.6.32.71 ] ~ [ linux-2.6.0 ] ~ [ linux-2.4.37.11 ] ~ [ unix-v6-master ] ~ [ ccs-tools-1.8.9 ] ~ [ policy-sample ] ~
Architecture: ~ [ i386 ] ~ [ alpha ] ~ [ m68k ] ~ [ mips ] ~ [ ppc ] ~ [ sparc ] ~ [ sparc64 ] ~

Diff markup

Differences between /include/drm/drm_print.h (Version linux-6.11-rc3) and /include/drm/drm_print.h (Version linux-6.6.45)


  1 /*                                                  1 /*
  2  * Copyright (C) 2016 Red Hat                       2  * Copyright (C) 2016 Red Hat
  3  *                                                  3  *
  4  * Permission is hereby granted, free of charg      4  * Permission is hereby granted, free of charge, to any person obtaining a
  5  * copy of this software and associated docume      5  * copy of this software and associated documentation files (the "Software"),
  6  * to deal in the Software without restriction      6  * to deal in the Software without restriction, including without limitation
  7  * the rights to use, copy, modify, merge, pub      7  * the rights to use, copy, modify, merge, publish, distribute, sublicense,
  8  * and/or sell copies of the Software, and to       8  * and/or sell copies of the Software, and to permit persons to whom the
  9  * Software is furnished to do so, subject to       9  * Software is furnished to do so, subject to the following conditions:
 10  *                                                 10  *
 11  * The above copyright notice and this permiss     11  * The above copyright notice and this permission notice shall be included in
 12  * all copies or substantial portions of the S     12  * all copies or substantial portions of the Software.
 13  *                                                 13  *
 14  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT W     14  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
 15  * IMPLIED, INCLUDING BUT NOT LIMITED TO THE W     15  * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
 16  * FITNESS FOR A PARTICULAR PURPOSE AND NONINF     16  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
 17  * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIA     17  * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR
 18  * OTHER LIABILITY, WHETHER IN AN ACTION OF CO     18  * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
 19  * ARISING FROM, OUT OF OR IN CONNECTION WITH      19  * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
 20  * OTHER DEALINGS IN THE SOFTWARE.                 20  * OTHER DEALINGS IN THE SOFTWARE.
 21  *                                                 21  *
 22  * Authors:                                        22  * Authors:
 23  * Rob Clark <robdclark@gmail.com>                 23  * Rob Clark <robdclark@gmail.com>
 24  */                                                24  */
 25                                                    25 
 26 #ifndef DRM_PRINT_H_                               26 #ifndef DRM_PRINT_H_
 27 #define DRM_PRINT_H_                               27 #define DRM_PRINT_H_
 28                                                    28 
 29 #include <linux/compiler.h>                        29 #include <linux/compiler.h>
 30 #include <linux/printk.h>                          30 #include <linux/printk.h>
                                                   >>  31 #include <linux/seq_file.h>
 31 #include <linux/device.h>                          32 #include <linux/device.h>
                                                   >>  33 #include <linux/debugfs.h>
 32 #include <linux/dynamic_debug.h>                   34 #include <linux/dynamic_debug.h>
 33                                                    35 
 34 #include <drm/drm.h>                               36 #include <drm/drm.h>
 35                                                    37 
 36 struct debugfs_regset32;                       << 
 37 struct drm_device;                             << 
 38 struct seq_file;                               << 
 39                                                << 
 40 /* Do *not* use outside of drm_print.[ch]! */      38 /* Do *not* use outside of drm_print.[ch]! */
 41 extern unsigned long __drm_debug;                  39 extern unsigned long __drm_debug;
 42                                                    40 
 43 /**                                                41 /**
 44  * DOC: print                                      42  * DOC: print
 45  *                                                 43  *
 46  * A simple wrapper for dev_printk(), seq_prin     44  * A simple wrapper for dev_printk(), seq_printf(), etc.  Allows same
 47  * debug code to be used for both debugfs and      45  * debug code to be used for both debugfs and printk logging.
 48  *                                                 46  *
 49  * For example::                                   47  * For example::
 50  *                                                 48  *
 51  *     void log_some_info(struct drm_printer *     49  *     void log_some_info(struct drm_printer *p)
 52  *     {                                           50  *     {
 53  *             drm_printf(p, "foo=%d\n", foo);     51  *             drm_printf(p, "foo=%d\n", foo);
 54  *             drm_printf(p, "bar=%d\n", bar);     52  *             drm_printf(p, "bar=%d\n", bar);
 55  *     }                                           53  *     }
 56  *                                                 54  *
 57  *     #ifdef CONFIG_DEBUG_FS                      55  *     #ifdef CONFIG_DEBUG_FS
 58  *     void debugfs_show(struct seq_file *f)       56  *     void debugfs_show(struct seq_file *f)
 59  *     {                                           57  *     {
 60  *             struct drm_printer p = drm_seq_     58  *             struct drm_printer p = drm_seq_file_printer(f);
 61  *             log_some_info(&p);                  59  *             log_some_info(&p);
 62  *     }                                           60  *     }
 63  *     #endif                                      61  *     #endif
 64  *                                                 62  *
 65  *     void some_other_function(...)               63  *     void some_other_function(...)
 66  *     {                                           64  *     {
 67  *             struct drm_printer p = drm_info     65  *             struct drm_printer p = drm_info_printer(drm->dev);
 68  *             log_some_info(&p);                  66  *             log_some_info(&p);
 69  *     }                                           67  *     }
 70  */                                                68  */
 71                                                    69 
 72 /**                                                70 /**
 73  * enum drm_debug_category - The DRM debug cat << 
 74  *                                             << 
 75  * Each of the DRM debug logging macros use a  << 
 76  * is filtered by the drm.debug module paramet << 
 77  * for the interface.                          << 
 78  *                                             << 
 79  * Each DRM_DEBUG_<CATEGORY> macro logs to DRM << 
 80  * DRM_DEBUG() logs to DRM_UT_CORE.            << 
 81  *                                             << 
 82  * Enabling verbose debug messages is done thr << 
 83  * category being enabled by a bit:            << 
 84  *                                             << 
 85  *  - drm.debug=0x1 will enable CORE messages  << 
 86  *  - drm.debug=0x2 will enable DRIVER message << 
 87  *  - drm.debug=0x3 will enable CORE and DRIVE << 
 88  *  - ...                                      << 
 89  *  - drm.debug=0x1ff will enable all messages << 
 90  *                                             << 
 91  * An interesting feature is that it's possibl << 
 92  * run-time by echoing the debug value in its  << 
 93  *                                             << 
 94  *   # echo 0xf > /sys/module/drm/parameters/d << 
 95  *                                             << 
 96  */                                            << 
 97 enum drm_debug_category {                      << 
 98         /* These names must match those in DYN << 
 99         /**                                    << 
100          * @DRM_UT_CORE: Used in the generic d << 
101          * drm_memory.c, ...                   << 
102          */                                    << 
103         DRM_UT_CORE,                           << 
104         /**                                    << 
105          * @DRM_UT_DRIVER: Used in the vendor  << 
106          * radeon, ... macro.                  << 
107          */                                    << 
108         DRM_UT_DRIVER,                         << 
109         /**                                    << 
110          * @DRM_UT_KMS: Used in the modesettin << 
111          */                                    << 
112         DRM_UT_KMS,                            << 
113         /**                                    << 
114          * @DRM_UT_PRIME: Used in the prime co << 
115          */                                    << 
116         DRM_UT_PRIME,                          << 
117         /**                                    << 
118          * @DRM_UT_ATOMIC: Used in the atomic  << 
119          */                                    << 
120         DRM_UT_ATOMIC,                         << 
121         /**                                    << 
122          * @DRM_UT_VBL: Used for verbose debug << 
123          */                                    << 
124         DRM_UT_VBL,                            << 
125         /**                                    << 
126          * @DRM_UT_STATE: Used for verbose ato << 
127          */                                    << 
128         DRM_UT_STATE,                          << 
129         /**                                    << 
130          * @DRM_UT_LEASE: Used in the lease co << 
131          */                                    << 
132         DRM_UT_LEASE,                          << 
133         /**                                    << 
134          * @DRM_UT_DP: Used in the DP code.    << 
135          */                                    << 
136         DRM_UT_DP,                             << 
137         /**                                    << 
138          * @DRM_UT_DRMRES: Used in the drm man << 
139          */                                    << 
140         DRM_UT_DRMRES                          << 
141 };                                             << 
142                                                << 
143 static inline bool drm_debug_enabled_raw(enum  << 
144 {                                              << 
145         return unlikely(__drm_debug & BIT(cate << 
146 }                                              << 
147                                                << 
148 #define drm_debug_enabled_instrumented(categor << 
149         ({                                     << 
150                 pr_debug("todo: is this freque << 
151                 drm_debug_enabled_raw(category << 
152         })                                     << 
153                                                << 
154 #if defined(CONFIG_DRM_USE_DYNAMIC_DEBUG)      << 
155 /*                                             << 
156  * the drm.debug API uses dyndbg, so each drm_ << 
157  * a descriptor, and only enabled callsites ar << 
158  * the private macro to avoid re-testing the e << 
159  */                                            << 
160 #define __drm_debug_enabled(category)   true   << 
161 #define drm_debug_enabled(category)     drm_de << 
162 #else                                          << 
163 #define __drm_debug_enabled(category)   drm_de << 
164 #define drm_debug_enabled(category)     drm_de << 
165 #endif                                         << 
166                                                << 
167 /**                                            << 
168  * struct drm_printer - drm output "stream"        71  * struct drm_printer - drm output "stream"
169  *                                                 72  *
170  * Do not use struct members directly.  Use dr     73  * Do not use struct members directly.  Use drm_printer_seq_file(),
171  * drm_printer_info(), etc to initialize.  And     74  * drm_printer_info(), etc to initialize.  And drm_printf() for output.
172  */                                                75  */
173 struct drm_printer {                               76 struct drm_printer {
174         /* private: */                             77         /* private: */
175         void (*printfn)(struct drm_printer *p,     78         void (*printfn)(struct drm_printer *p, struct va_format *vaf);
176         void (*puts)(struct drm_printer *p, co     79         void (*puts)(struct drm_printer *p, const char *str);
177         void *arg;                                 80         void *arg;
178         const void *origin;                    << 
179         const char *prefix;                        81         const char *prefix;
180         enum drm_debug_category category;      << 
181 };                                                 82 };
182                                                    83 
183 void __drm_printfn_coredump(struct drm_printer     84 void __drm_printfn_coredump(struct drm_printer *p, struct va_format *vaf);
184 void __drm_puts_coredump(struct drm_printer *p     85 void __drm_puts_coredump(struct drm_printer *p, const char *str);
185 void __drm_printfn_seq_file(struct drm_printer     86 void __drm_printfn_seq_file(struct drm_printer *p, struct va_format *vaf);
186 void __drm_puts_seq_file(struct drm_printer *p     87 void __drm_puts_seq_file(struct drm_printer *p, const char *str);
187 void __drm_printfn_info(struct drm_printer *p,     88 void __drm_printfn_info(struct drm_printer *p, struct va_format *vaf);
188 void __drm_printfn_dbg(struct drm_printer *p,  !!  89 void __drm_printfn_debug(struct drm_printer *p, struct va_format *vaf);
189 void __drm_printfn_err(struct drm_printer *p,      90 void __drm_printfn_err(struct drm_printer *p, struct va_format *vaf);
190                                                    91 
191 __printf(2, 3)                                     92 __printf(2, 3)
192 void drm_printf(struct drm_printer *p, const c     93 void drm_printf(struct drm_printer *p, const char *f, ...);
193 void drm_puts(struct drm_printer *p, const cha     94 void drm_puts(struct drm_printer *p, const char *str);
194 void drm_print_regset32(struct drm_printer *p,     95 void drm_print_regset32(struct drm_printer *p, struct debugfs_regset32 *regset);
195 void drm_print_bits(struct drm_printer *p, uns     96 void drm_print_bits(struct drm_printer *p, unsigned long value,
196                     const char * const bits[],     97                     const char * const bits[], unsigned int nbits);
197                                                    98 
198 __printf(2, 0)                                     99 __printf(2, 0)
199 /**                                               100 /**
200  * drm_vprintf - print to a &drm_printer strea    101  * drm_vprintf - print to a &drm_printer stream
201  * @p: the &drm_printer                           102  * @p: the &drm_printer
202  * @fmt: format string                            103  * @fmt: format string
203  * @va: the va_list                               104  * @va: the va_list
204  */                                               105  */
205 static inline void                                106 static inline void
206 drm_vprintf(struct drm_printer *p, const char     107 drm_vprintf(struct drm_printer *p, const char *fmt, va_list *va)
207 {                                                 108 {
208         struct va_format vaf = { .fmt = fmt, .    109         struct va_format vaf = { .fmt = fmt, .va = va };
209                                                   110 
210         p->printfn(p, &vaf);                      111         p->printfn(p, &vaf);
211 }                                                 112 }
212                                                   113 
213 /**                                               114 /**
214  * drm_printf_indent - Print to a &drm_printer    115  * drm_printf_indent - Print to a &drm_printer stream with indentation
215  * @printer: DRM printer                          116  * @printer: DRM printer
216  * @indent: Tab indentation level (max 5)         117  * @indent: Tab indentation level (max 5)
217  * @fmt: Format string                            118  * @fmt: Format string
218  */                                               119  */
219 #define drm_printf_indent(printer, indent, fmt    120 #define drm_printf_indent(printer, indent, fmt, ...) \
220         drm_printf((printer), "%.*s" fmt, (ind    121         drm_printf((printer), "%.*s" fmt, (indent), "\t\t\t\t\tX", ##__VA_ARGS__)
221                                                   122 
222 /**                                               123 /**
223  * struct drm_print_iterator - local struct us    124  * struct drm_print_iterator - local struct used with drm_printer_coredump
224  * @data: Pointer to the devcoredump output bu    125  * @data: Pointer to the devcoredump output buffer
225  * @start: The offset within the buffer to sta    126  * @start: The offset within the buffer to start writing
226  * @remain: The number of bytes to write for t    127  * @remain: The number of bytes to write for this iteration
227  */                                               128  */
228 struct drm_print_iterator {                       129 struct drm_print_iterator {
229         void *data;                               130         void *data;
230         ssize_t start;                            131         ssize_t start;
231         ssize_t remain;                           132         ssize_t remain;
232         /* private: */                            133         /* private: */
233         ssize_t offset;                           134         ssize_t offset;
234 };                                                135 };
235                                                   136 
236 /**                                               137 /**
237  * drm_coredump_printer - construct a &drm_pri    138  * drm_coredump_printer - construct a &drm_printer that can output to a buffer
238  * from the read function for devcoredump         139  * from the read function for devcoredump
239  * @iter: A pointer to a struct drm_print_iter    140  * @iter: A pointer to a struct drm_print_iterator for the read instance
240  *                                                141  *
241  * This wrapper extends drm_printf() to work w    142  * This wrapper extends drm_printf() to work with a dev_coredumpm() callback
242  * function. The passed in drm_print_iterator     143  * function. The passed in drm_print_iterator struct contains the buffer
243  * pointer, size and offset as passed in from     144  * pointer, size and offset as passed in from devcoredump.
244  *                                                145  *
245  * For example::                                  146  * For example::
246  *                                                147  *
247  *      void coredump_read(char *buffer, loff_    148  *      void coredump_read(char *buffer, loff_t offset, size_t count,
248  *              void *data, size_t datalen)       149  *              void *data, size_t datalen)
249  *      {                                         150  *      {
250  *              struct drm_print_iterator iter    151  *              struct drm_print_iterator iter;
251  *              struct drm_printer p;             152  *              struct drm_printer p;
252  *                                                153  *
253  *              iter.data = buffer;               154  *              iter.data = buffer;
254  *              iter.start = offset;              155  *              iter.start = offset;
255  *              iter.remain = count;              156  *              iter.remain = count;
256  *                                                157  *
257  *              p = drm_coredump_printer(&iter    158  *              p = drm_coredump_printer(&iter);
258  *                                                159  *
259  *              drm_printf(p, "foo=%d\n", foo)    160  *              drm_printf(p, "foo=%d\n", foo);
260  *      }                                         161  *      }
261  *                                                162  *
262  *      void makecoredump(...)                    163  *      void makecoredump(...)
263  *      {                                         164  *      {
264  *              ...                               165  *              ...
265  *              dev_coredumpm(dev, THIS_MODULE    166  *              dev_coredumpm(dev, THIS_MODULE, data, 0, GFP_KERNEL,
266  *                      coredump_read, ...)       167  *                      coredump_read, ...)
267  *      }                                         168  *      }
268  *                                                169  *
269  * RETURNS:                                       170  * RETURNS:
270  * The &drm_printer object                        171  * The &drm_printer object
271  */                                               172  */
272 static inline struct drm_printer                  173 static inline struct drm_printer
273 drm_coredump_printer(struct drm_print_iterator    174 drm_coredump_printer(struct drm_print_iterator *iter)
274 {                                                 175 {
275         struct drm_printer p = {                  176         struct drm_printer p = {
276                 .printfn = __drm_printfn_cored    177                 .printfn = __drm_printfn_coredump,
277                 .puts = __drm_puts_coredump,      178                 .puts = __drm_puts_coredump,
278                 .arg = iter,                      179                 .arg = iter,
279         };                                        180         };
280                                                   181 
281         /* Set the internal offset of the iter    182         /* Set the internal offset of the iterator to zero */
282         iter->offset = 0;                         183         iter->offset = 0;
283                                                   184 
284         return p;                                 185         return p;
285 }                                                 186 }
286                                                   187 
287 /**                                               188 /**
288  * drm_seq_file_printer - construct a &drm_pri    189  * drm_seq_file_printer - construct a &drm_printer that outputs to &seq_file
289  * @f:  the &struct seq_file to output to         190  * @f:  the &struct seq_file to output to
290  *                                                191  *
291  * RETURNS:                                       192  * RETURNS:
292  * The &drm_printer object                        193  * The &drm_printer object
293  */                                               194  */
294 static inline struct drm_printer drm_seq_file_    195 static inline struct drm_printer drm_seq_file_printer(struct seq_file *f)
295 {                                                 196 {
296         struct drm_printer p = {                  197         struct drm_printer p = {
297                 .printfn = __drm_printfn_seq_f    198                 .printfn = __drm_printfn_seq_file,
298                 .puts = __drm_puts_seq_file,      199                 .puts = __drm_puts_seq_file,
299                 .arg = f,                         200                 .arg = f,
300         };                                        201         };
301         return p;                                 202         return p;
302 }                                                 203 }
303                                                   204 
304 /**                                               205 /**
305  * drm_info_printer - construct a &drm_printer    206  * drm_info_printer - construct a &drm_printer that outputs to dev_printk()
306  * @dev: the &struct device pointer               207  * @dev: the &struct device pointer
307  *                                                208  *
308  * RETURNS:                                       209  * RETURNS:
309  * The &drm_printer object                        210  * The &drm_printer object
310  */                                               211  */
311 static inline struct drm_printer drm_info_prin    212 static inline struct drm_printer drm_info_printer(struct device *dev)
312 {                                                 213 {
313         struct drm_printer p = {                  214         struct drm_printer p = {
314                 .printfn = __drm_printfn_info,    215                 .printfn = __drm_printfn_info,
315                 .arg = dev,                       216                 .arg = dev,
316         };                                        217         };
317         return p;                                 218         return p;
318 }                                                 219 }
319                                                   220 
320 /**                                               221 /**
321  * drm_dbg_printer - construct a &drm_printer  !! 222  * drm_debug_printer - construct a &drm_printer that outputs to pr_debug()
322  * @drm: the &struct drm_device pointer, or NU !! 223  * @prefix: debug output prefix
323  * @category: the debug category to use        << 
324  * @prefix: debug output prefix, or NULL for n << 
325  *                                                224  *
326  * RETURNS:                                       225  * RETURNS:
327  * The &drm_printer object                        226  * The &drm_printer object
328  */                                               227  */
329 static inline struct drm_printer drm_dbg_print !! 228 static inline struct drm_printer drm_debug_printer(const char *prefix)
330                                                << 
331                                                << 
332 {                                                 229 {
333         struct drm_printer p = {                  230         struct drm_printer p = {
334                 .printfn = __drm_printfn_dbg,  !! 231                 .printfn = __drm_printfn_debug,
335                 .arg = drm,                    !! 232                 .prefix = prefix
336                 .origin = (const void *)_THIS_ << 
337                 .prefix = prefix,              << 
338                 .category = category,          << 
339         };                                        233         };
340         return p;                                 234         return p;
341 }                                                 235 }
342                                                   236 
343 /**                                               237 /**
344  * drm_err_printer - construct a &drm_printer  !! 238  * drm_err_printer - construct a &drm_printer that outputs to pr_err()
345  * @drm: the &struct drm_device pointer        !! 239  * @prefix: debug output prefix
346  * @prefix: debug output prefix, or NULL for n << 
347  *                                                240  *
348  * RETURNS:                                       241  * RETURNS:
349  * The &drm_printer object                        242  * The &drm_printer object
350  */                                               243  */
351 static inline struct drm_printer drm_err_print !! 244 static inline struct drm_printer drm_err_printer(const char *prefix)
352                                                << 
353 {                                                 245 {
354         struct drm_printer p = {                  246         struct drm_printer p = {
355                 .printfn = __drm_printfn_err,     247                 .printfn = __drm_printfn_err,
356                 .arg = drm,                    << 
357                 .prefix = prefix                  248                 .prefix = prefix
358         };                                        249         };
359         return p;                                 250         return p;
360 }                                                 251 }
361                                                   252 
                                                   >> 253 /**
                                                   >> 254  * enum drm_debug_category - The DRM debug categories
                                                   >> 255  *
                                                   >> 256  * Each of the DRM debug logging macros use a specific category, and the logging
                                                   >> 257  * is filtered by the drm.debug module parameter. This enum specifies the values
                                                   >> 258  * for the interface.
                                                   >> 259  *
                                                   >> 260  * Each DRM_DEBUG_<CATEGORY> macro logs to DRM_UT_<CATEGORY> category, except
                                                   >> 261  * DRM_DEBUG() logs to DRM_UT_CORE.
                                                   >> 262  *
                                                   >> 263  * Enabling verbose debug messages is done through the drm.debug parameter, each
                                                   >> 264  * category being enabled by a bit:
                                                   >> 265  *
                                                   >> 266  *  - drm.debug=0x1 will enable CORE messages
                                                   >> 267  *  - drm.debug=0x2 will enable DRIVER messages
                                                   >> 268  *  - drm.debug=0x3 will enable CORE and DRIVER messages
                                                   >> 269  *  - ...
                                                   >> 270  *  - drm.debug=0x1ff will enable all messages
                                                   >> 271  *
                                                   >> 272  * An interesting feature is that it's possible to enable verbose logging at
                                                   >> 273  * run-time by echoing the debug value in its sysfs node::
                                                   >> 274  *
                                                   >> 275  *   # echo 0xf > /sys/module/drm/parameters/debug
                                                   >> 276  *
                                                   >> 277  */
                                                   >> 278 enum drm_debug_category {
                                                   >> 279         /* These names must match those in DYNAMIC_DEBUG_CLASSBITS */
                                                   >> 280         /**
                                                   >> 281          * @DRM_UT_CORE: Used in the generic drm code: drm_ioctl.c, drm_mm.c,
                                                   >> 282          * drm_memory.c, ...
                                                   >> 283          */
                                                   >> 284         DRM_UT_CORE,
                                                   >> 285         /**
                                                   >> 286          * @DRM_UT_DRIVER: Used in the vendor specific part of the driver: i915,
                                                   >> 287          * radeon, ... macro.
                                                   >> 288          */
                                                   >> 289         DRM_UT_DRIVER,
                                                   >> 290         /**
                                                   >> 291          * @DRM_UT_KMS: Used in the modesetting code.
                                                   >> 292          */
                                                   >> 293         DRM_UT_KMS,
                                                   >> 294         /**
                                                   >> 295          * @DRM_UT_PRIME: Used in the prime code.
                                                   >> 296          */
                                                   >> 297         DRM_UT_PRIME,
                                                   >> 298         /**
                                                   >> 299          * @DRM_UT_ATOMIC: Used in the atomic code.
                                                   >> 300          */
                                                   >> 301         DRM_UT_ATOMIC,
                                                   >> 302         /**
                                                   >> 303          * @DRM_UT_VBL: Used for verbose debug message in the vblank code.
                                                   >> 304          */
                                                   >> 305         DRM_UT_VBL,
                                                   >> 306         /**
                                                   >> 307          * @DRM_UT_STATE: Used for verbose atomic state debugging.
                                                   >> 308          */
                                                   >> 309         DRM_UT_STATE,
                                                   >> 310         /**
                                                   >> 311          * @DRM_UT_LEASE: Used in the lease code.
                                                   >> 312          */
                                                   >> 313         DRM_UT_LEASE,
                                                   >> 314         /**
                                                   >> 315          * @DRM_UT_DP: Used in the DP code.
                                                   >> 316          */
                                                   >> 317         DRM_UT_DP,
                                                   >> 318         /**
                                                   >> 319          * @DRM_UT_DRMRES: Used in the drm managed resources code.
                                                   >> 320          */
                                                   >> 321         DRM_UT_DRMRES
                                                   >> 322 };
                                                   >> 323 
                                                   >> 324 static inline bool drm_debug_enabled_raw(enum drm_debug_category category)
                                                   >> 325 {
                                                   >> 326         return unlikely(__drm_debug & BIT(category));
                                                   >> 327 }
                                                   >> 328 
                                                   >> 329 #define drm_debug_enabled_instrumented(category)                        \
                                                   >> 330         ({                                                              \
                                                   >> 331                 pr_debug("todo: is this frequent enough to optimize ?\n"); \
                                                   >> 332                 drm_debug_enabled_raw(category);                        \
                                                   >> 333         })
                                                   >> 334 
                                                   >> 335 #if defined(CONFIG_DRM_USE_DYNAMIC_DEBUG)
                                                   >> 336 /*
                                                   >> 337  * the drm.debug API uses dyndbg, so each drm_*dbg macro/callsite gets
                                                   >> 338  * a descriptor, and only enabled callsites are reachable.  They use
                                                   >> 339  * the private macro to avoid re-testing the enable-bit.
                                                   >> 340  */
                                                   >> 341 #define __drm_debug_enabled(category)   true
                                                   >> 342 #define drm_debug_enabled(category)     drm_debug_enabled_instrumented(category)
                                                   >> 343 #else
                                                   >> 344 #define __drm_debug_enabled(category)   drm_debug_enabled_raw(category)
                                                   >> 345 #define drm_debug_enabled(category)     drm_debug_enabled_raw(category)
                                                   >> 346 #endif
                                                   >> 347 
362 /*                                                348 /*
363  * struct device based logging                    349  * struct device based logging
364  *                                                350  *
365  * Prefer drm_device based logging over device    351  * Prefer drm_device based logging over device or printk based logging.
366  */                                               352  */
367                                                   353 
368 __printf(3, 4)                                    354 __printf(3, 4)
369 void drm_dev_printk(const struct device *dev,     355 void drm_dev_printk(const struct device *dev, const char *level,
370                     const char *format, ...);     356                     const char *format, ...);
371 struct _ddebug;                                   357 struct _ddebug;
372 __printf(4, 5)                                    358 __printf(4, 5)
373 void __drm_dev_dbg(struct _ddebug *desc, const    359 void __drm_dev_dbg(struct _ddebug *desc, const struct device *dev,
374                    enum drm_debug_category cat    360                    enum drm_debug_category category, const char *format, ...);
375                                                   361 
376 /**                                               362 /**
377  * DRM_DEV_ERROR() - Error output.                363  * DRM_DEV_ERROR() - Error output.
378  *                                                364  *
379  * NOTE: this is deprecated in favor of drm_er    365  * NOTE: this is deprecated in favor of drm_err() or dev_err().
380  *                                                366  *
381  * @dev: device pointer                           367  * @dev: device pointer
382  * @fmt: printf() like format string.             368  * @fmt: printf() like format string.
383  */                                               369  */
384 #define DRM_DEV_ERROR(dev, fmt, ...)              370 #define DRM_DEV_ERROR(dev, fmt, ...)                                    \
385         drm_dev_printk(dev, KERN_ERR, "*ERROR*    371         drm_dev_printk(dev, KERN_ERR, "*ERROR* " fmt, ##__VA_ARGS__)
386                                                   372 
387 /**                                               373 /**
388  * DRM_DEV_ERROR_RATELIMITED() - Rate limited     374  * DRM_DEV_ERROR_RATELIMITED() - Rate limited error output.
389  *                                                375  *
390  * NOTE: this is deprecated in favor of drm_er    376  * NOTE: this is deprecated in favor of drm_err_ratelimited() or
391  * dev_err_ratelimited().                         377  * dev_err_ratelimited().
392  *                                                378  *
393  * @dev: device pointer                           379  * @dev: device pointer
394  * @fmt: printf() like format string.             380  * @fmt: printf() like format string.
395  *                                                381  *
396  * Like DRM_ERROR() but won't flood the log.      382  * Like DRM_ERROR() but won't flood the log.
397  */                                               383  */
398 #define DRM_DEV_ERROR_RATELIMITED(dev, fmt, ..    384 #define DRM_DEV_ERROR_RATELIMITED(dev, fmt, ...)                        \
399 ({                                                385 ({                                                                      \
400         static DEFINE_RATELIMIT_STATE(_rs,        386         static DEFINE_RATELIMIT_STATE(_rs,                              \
401                                       DEFAULT_    387                                       DEFAULT_RATELIMIT_INTERVAL,       \
402                                       DEFAULT_    388                                       DEFAULT_RATELIMIT_BURST);         \
403                                                   389                                                                         \
404         if (__ratelimit(&_rs))                    390         if (__ratelimit(&_rs))                                          \
405                 DRM_DEV_ERROR(dev, fmt, ##__VA    391                 DRM_DEV_ERROR(dev, fmt, ##__VA_ARGS__);                 \
406 })                                                392 })
407                                                   393 
408 /* NOTE: this is deprecated in favor of drm_in    394 /* NOTE: this is deprecated in favor of drm_info() or dev_info(). */
409 #define DRM_DEV_INFO(dev, fmt, ...)               395 #define DRM_DEV_INFO(dev, fmt, ...)                             \
410         drm_dev_printk(dev, KERN_INFO, fmt, ##    396         drm_dev_printk(dev, KERN_INFO, fmt, ##__VA_ARGS__)
411                                                   397 
412 /* NOTE: this is deprecated in favor of drm_in    398 /* NOTE: this is deprecated in favor of drm_info_once() or dev_info_once(). */
413 #define DRM_DEV_INFO_ONCE(dev, fmt, ...)          399 #define DRM_DEV_INFO_ONCE(dev, fmt, ...)                                \
414 ({                                                400 ({                                                                      \
415         static bool __print_once __read_mostly    401         static bool __print_once __read_mostly;                         \
416         if (!__print_once) {                      402         if (!__print_once) {                                            \
417                 __print_once = true;              403                 __print_once = true;                                    \
418                 DRM_DEV_INFO(dev, fmt, ##__VA_    404                 DRM_DEV_INFO(dev, fmt, ##__VA_ARGS__);                  \
419         }                                         405         }                                                               \
420 })                                                406 })
421                                                   407 
422 #if !defined(CONFIG_DRM_USE_DYNAMIC_DEBUG)        408 #if !defined(CONFIG_DRM_USE_DYNAMIC_DEBUG)
423 #define drm_dev_dbg(dev, cat, fmt, ...)           409 #define drm_dev_dbg(dev, cat, fmt, ...)                         \
424         __drm_dev_dbg(NULL, dev, cat, fmt, ##_    410         __drm_dev_dbg(NULL, dev, cat, fmt, ##__VA_ARGS__)
425 #else                                             411 #else
426 #define drm_dev_dbg(dev, cat, fmt, ...)           412 #define drm_dev_dbg(dev, cat, fmt, ...)                         \
427         _dynamic_func_call_cls(cat, fmt, __drm    413         _dynamic_func_call_cls(cat, fmt, __drm_dev_dbg,         \
428                                dev, cat, fmt,     414                                dev, cat, fmt, ##__VA_ARGS__)
429 #endif                                            415 #endif
430                                                   416 
431 /**                                               417 /**
432  * DRM_DEV_DEBUG() - Debug output for generic     418  * DRM_DEV_DEBUG() - Debug output for generic drm code
433  *                                                419  *
434  * NOTE: this is deprecated in favor of drm_db    420  * NOTE: this is deprecated in favor of drm_dbg_core().
435  *                                                421  *
436  * @dev: device pointer                           422  * @dev: device pointer
437  * @fmt: printf() like format string.             423  * @fmt: printf() like format string.
438  */                                               424  */
439 #define DRM_DEV_DEBUG(dev, fmt, ...)              425 #define DRM_DEV_DEBUG(dev, fmt, ...)                                    \
440         drm_dev_dbg(dev, DRM_UT_CORE, fmt, ##_    426         drm_dev_dbg(dev, DRM_UT_CORE, fmt, ##__VA_ARGS__)
441 /**                                               427 /**
442  * DRM_DEV_DEBUG_DRIVER() - Debug output for v    428  * DRM_DEV_DEBUG_DRIVER() - Debug output for vendor specific part of the driver
443  *                                                429  *
444  * NOTE: this is deprecated in favor of drm_db    430  * NOTE: this is deprecated in favor of drm_dbg() or dev_dbg().
445  *                                                431  *
446  * @dev: device pointer                           432  * @dev: device pointer
447  * @fmt: printf() like format string.             433  * @fmt: printf() like format string.
448  */                                               434  */
449 #define DRM_DEV_DEBUG_DRIVER(dev, fmt, ...)       435 #define DRM_DEV_DEBUG_DRIVER(dev, fmt, ...)                             \
450         drm_dev_dbg(dev, DRM_UT_DRIVER, fmt, #    436         drm_dev_dbg(dev, DRM_UT_DRIVER, fmt, ##__VA_ARGS__)
451 /**                                               437 /**
452  * DRM_DEV_DEBUG_KMS() - Debug output for mode    438  * DRM_DEV_DEBUG_KMS() - Debug output for modesetting code
453  *                                                439  *
454  * NOTE: this is deprecated in favor of drm_db    440  * NOTE: this is deprecated in favor of drm_dbg_kms().
455  *                                                441  *
456  * @dev: device pointer                           442  * @dev: device pointer
457  * @fmt: printf() like format string.             443  * @fmt: printf() like format string.
458  */                                               444  */
459 #define DRM_DEV_DEBUG_KMS(dev, fmt, ...)          445 #define DRM_DEV_DEBUG_KMS(dev, fmt, ...)                                \
460         drm_dev_dbg(dev, DRM_UT_KMS, fmt, ##__    446         drm_dev_dbg(dev, DRM_UT_KMS, fmt, ##__VA_ARGS__)
461                                                   447 
462 /*                                                448 /*
463  * struct drm_device based logging                449  * struct drm_device based logging
464  *                                                450  *
465  * Prefer drm_device based logging over device    451  * Prefer drm_device based logging over device or prink based logging.
466  */                                               452  */
467                                                   453 
468 /* Helper for struct drm_device based logging.    454 /* Helper for struct drm_device based logging. */
469 #define __drm_printk(drm, level, type, fmt, ..    455 #define __drm_printk(drm, level, type, fmt, ...)                        \
470         dev_##level##type((drm) ? (drm)->dev : !! 456         dev_##level##type((drm)->dev, "[drm] " fmt, ##__VA_ARGS__)
471                                                   457 
472                                                   458 
473 #define drm_info(drm, fmt, ...)                   459 #define drm_info(drm, fmt, ...)                                 \
474         __drm_printk((drm), info,, fmt, ##__VA    460         __drm_printk((drm), info,, fmt, ##__VA_ARGS__)
475                                                   461 
476 #define drm_notice(drm, fmt, ...)                 462 #define drm_notice(drm, fmt, ...)                               \
477         __drm_printk((drm), notice,, fmt, ##__    463         __drm_printk((drm), notice,, fmt, ##__VA_ARGS__)
478                                                   464 
479 #define drm_warn(drm, fmt, ...)                   465 #define drm_warn(drm, fmt, ...)                                 \
480         __drm_printk((drm), warn,, fmt, ##__VA    466         __drm_printk((drm), warn,, fmt, ##__VA_ARGS__)
481                                                   467 
482 #define drm_err(drm, fmt, ...)                    468 #define drm_err(drm, fmt, ...)                                  \
483         __drm_printk((drm), err,, "*ERROR* " f    469         __drm_printk((drm), err,, "*ERROR* " fmt, ##__VA_ARGS__)
484                                                   470 
485                                                   471 
486 #define drm_info_once(drm, fmt, ...)              472 #define drm_info_once(drm, fmt, ...)                            \
487         __drm_printk((drm), info, _once, fmt,     473         __drm_printk((drm), info, _once, fmt, ##__VA_ARGS__)
488                                                   474 
489 #define drm_notice_once(drm, fmt, ...)            475 #define drm_notice_once(drm, fmt, ...)                          \
490         __drm_printk((drm), notice, _once, fmt    476         __drm_printk((drm), notice, _once, fmt, ##__VA_ARGS__)
491                                                   477 
492 #define drm_warn_once(drm, fmt, ...)              478 #define drm_warn_once(drm, fmt, ...)                            \
493         __drm_printk((drm), warn, _once, fmt,     479         __drm_printk((drm), warn, _once, fmt, ##__VA_ARGS__)
494                                                   480 
495 #define drm_err_once(drm, fmt, ...)               481 #define drm_err_once(drm, fmt, ...)                             \
496         __drm_printk((drm), err, _once, "*ERRO    482         __drm_printk((drm), err, _once, "*ERROR* " fmt, ##__VA_ARGS__)
497                                                   483 
498                                                   484 
499 #define drm_err_ratelimited(drm, fmt, ...)        485 #define drm_err_ratelimited(drm, fmt, ...)                              \
500         __drm_printk((drm), err, _ratelimited,    486         __drm_printk((drm), err, _ratelimited, "*ERROR* " fmt, ##__VA_ARGS__)
501                                                   487 
502                                                   488 
503 #define drm_dbg_core(drm, fmt, ...)               489 #define drm_dbg_core(drm, fmt, ...)                                     \
504         drm_dev_dbg((drm) ? (drm)->dev : NULL,    490         drm_dev_dbg((drm) ? (drm)->dev : NULL, DRM_UT_CORE, fmt, ##__VA_ARGS__)
505 #define drm_dbg_driver(drm, fmt, ...)             491 #define drm_dbg_driver(drm, fmt, ...)                                           \
506         drm_dev_dbg((drm) ? (drm)->dev : NULL,    492         drm_dev_dbg((drm) ? (drm)->dev : NULL, DRM_UT_DRIVER, fmt, ##__VA_ARGS__)
507 #define drm_dbg_kms(drm, fmt, ...)                493 #define drm_dbg_kms(drm, fmt, ...)                                      \
508         drm_dev_dbg((drm) ? (drm)->dev : NULL,    494         drm_dev_dbg((drm) ? (drm)->dev : NULL, DRM_UT_KMS, fmt, ##__VA_ARGS__)
509 #define drm_dbg_prime(drm, fmt, ...)              495 #define drm_dbg_prime(drm, fmt, ...)                                    \
510         drm_dev_dbg((drm) ? (drm)->dev : NULL,    496         drm_dev_dbg((drm) ? (drm)->dev : NULL, DRM_UT_PRIME, fmt, ##__VA_ARGS__)
511 #define drm_dbg_atomic(drm, fmt, ...)             497 #define drm_dbg_atomic(drm, fmt, ...)                                   \
512         drm_dev_dbg((drm) ? (drm)->dev : NULL,    498         drm_dev_dbg((drm) ? (drm)->dev : NULL, DRM_UT_ATOMIC, fmt, ##__VA_ARGS__)
513 #define drm_dbg_vbl(drm, fmt, ...)                499 #define drm_dbg_vbl(drm, fmt, ...)                                      \
514         drm_dev_dbg((drm) ? (drm)->dev : NULL,    500         drm_dev_dbg((drm) ? (drm)->dev : NULL, DRM_UT_VBL, fmt, ##__VA_ARGS__)
515 #define drm_dbg_state(drm, fmt, ...)              501 #define drm_dbg_state(drm, fmt, ...)                                    \
516         drm_dev_dbg((drm) ? (drm)->dev : NULL,    502         drm_dev_dbg((drm) ? (drm)->dev : NULL, DRM_UT_STATE, fmt, ##__VA_ARGS__)
517 #define drm_dbg_lease(drm, fmt, ...)              503 #define drm_dbg_lease(drm, fmt, ...)                                    \
518         drm_dev_dbg((drm) ? (drm)->dev : NULL,    504         drm_dev_dbg((drm) ? (drm)->dev : NULL, DRM_UT_LEASE, fmt, ##__VA_ARGS__)
519 #define drm_dbg_dp(drm, fmt, ...)                 505 #define drm_dbg_dp(drm, fmt, ...)                                       \
520         drm_dev_dbg((drm) ? (drm)->dev : NULL,    506         drm_dev_dbg((drm) ? (drm)->dev : NULL, DRM_UT_DP, fmt, ##__VA_ARGS__)
521 #define drm_dbg_drmres(drm, fmt, ...)             507 #define drm_dbg_drmres(drm, fmt, ...)                                   \
522         drm_dev_dbg((drm) ? (drm)->dev : NULL,    508         drm_dev_dbg((drm) ? (drm)->dev : NULL, DRM_UT_DRMRES, fmt, ##__VA_ARGS__)
523                                                   509 
524 #define drm_dbg(drm, fmt, ...)  drm_dbg_driver    510 #define drm_dbg(drm, fmt, ...)  drm_dbg_driver(drm, fmt, ##__VA_ARGS__)
525                                                   511 
526 /*                                                512 /*
527  * printk based logging                           513  * printk based logging
528  *                                                514  *
529  * Prefer drm_device based logging over device    515  * Prefer drm_device based logging over device or prink based logging.
530  */                                               516  */
531                                                   517 
                                                   >> 518 __printf(3, 4)
                                                   >> 519 void ___drm_dbg(struct _ddebug *desc, enum drm_debug_category category, const char *format, ...);
532 __printf(1, 2)                                    520 __printf(1, 2)
533 void __drm_err(const char *format, ...);          521 void __drm_err(const char *format, ...);
534                                                   522 
535 #if !defined(CONFIG_DRM_USE_DYNAMIC_DEBUG)        523 #if !defined(CONFIG_DRM_USE_DYNAMIC_DEBUG)
536 #define __drm_dbg(cat, fmt, ...)        __drm_ !! 524 #define __drm_dbg(cat, fmt, ...)                ___drm_dbg(NULL, cat, fmt, ##__VA_ARGS__)
537 #else                                             525 #else
538 #define __drm_dbg(cat, fmt, ...)                  526 #define __drm_dbg(cat, fmt, ...)                                        \
539         _dynamic_func_call_cls(cat, fmt, __drm !! 527         _dynamic_func_call_cls(cat, fmt, ___drm_dbg,                    \
540                                NULL, cat, fmt, !! 528                                cat, fmt, ##__VA_ARGS__)
541 #endif                                            529 #endif
542                                                   530 
543 /* Macros to make printk easier */                531 /* Macros to make printk easier */
544                                                   532 
545 #define _DRM_PRINTK(once, level, fmt, ...)        533 #define _DRM_PRINTK(once, level, fmt, ...)                              \
546         printk##once(KERN_##level "[" DRM_NAME    534         printk##once(KERN_##level "[" DRM_NAME "] " fmt, ##__VA_ARGS__)
547                                                   535 
548 /* NOTE: this is deprecated in favor of pr_inf    536 /* NOTE: this is deprecated in favor of pr_info(). */
549 #define DRM_INFO(fmt, ...)                        537 #define DRM_INFO(fmt, ...)                                              \
550         _DRM_PRINTK(, INFO, fmt, ##__VA_ARGS__    538         _DRM_PRINTK(, INFO, fmt, ##__VA_ARGS__)
551 /* NOTE: this is deprecated in favor of pr_not    539 /* NOTE: this is deprecated in favor of pr_notice(). */
552 #define DRM_NOTE(fmt, ...)                        540 #define DRM_NOTE(fmt, ...)                                              \
553         _DRM_PRINTK(, NOTICE, fmt, ##__VA_ARGS    541         _DRM_PRINTK(, NOTICE, fmt, ##__VA_ARGS__)
554 /* NOTE: this is deprecated in favor of pr_war    542 /* NOTE: this is deprecated in favor of pr_warn(). */
555 #define DRM_WARN(fmt, ...)                        543 #define DRM_WARN(fmt, ...)                                              \
556         _DRM_PRINTK(, WARNING, fmt, ##__VA_ARG    544         _DRM_PRINTK(, WARNING, fmt, ##__VA_ARGS__)
557                                                   545 
558 /* NOTE: this is deprecated in favor of pr_inf    546 /* NOTE: this is deprecated in favor of pr_info_once(). */
559 #define DRM_INFO_ONCE(fmt, ...)                   547 #define DRM_INFO_ONCE(fmt, ...)                                         \
560         _DRM_PRINTK(_once, INFO, fmt, ##__VA_A    548         _DRM_PRINTK(_once, INFO, fmt, ##__VA_ARGS__)
561 /* NOTE: this is deprecated in favor of pr_not    549 /* NOTE: this is deprecated in favor of pr_notice_once(). */
562 #define DRM_NOTE_ONCE(fmt, ...)                   550 #define DRM_NOTE_ONCE(fmt, ...)                                         \
563         _DRM_PRINTK(_once, NOTICE, fmt, ##__VA    551         _DRM_PRINTK(_once, NOTICE, fmt, ##__VA_ARGS__)
564 /* NOTE: this is deprecated in favor of pr_war    552 /* NOTE: this is deprecated in favor of pr_warn_once(). */
565 #define DRM_WARN_ONCE(fmt, ...)                   553 #define DRM_WARN_ONCE(fmt, ...)                                         \
566         _DRM_PRINTK(_once, WARNING, fmt, ##__V    554         _DRM_PRINTK(_once, WARNING, fmt, ##__VA_ARGS__)
567                                                   555 
568 /* NOTE: this is deprecated in favor of pr_err    556 /* NOTE: this is deprecated in favor of pr_err(). */
569 #define DRM_ERROR(fmt, ...)                       557 #define DRM_ERROR(fmt, ...)                                             \
570         __drm_err(fmt, ##__VA_ARGS__)             558         __drm_err(fmt, ##__VA_ARGS__)
571                                                   559 
572 /* NOTE: this is deprecated in favor of pr_err    560 /* NOTE: this is deprecated in favor of pr_err_ratelimited(). */
573 #define DRM_ERROR_RATELIMITED(fmt, ...)           561 #define DRM_ERROR_RATELIMITED(fmt, ...)                                 \
574         DRM_DEV_ERROR_RATELIMITED(NULL, fmt, #    562         DRM_DEV_ERROR_RATELIMITED(NULL, fmt, ##__VA_ARGS__)
575                                                   563 
576 /* NOTE: this is deprecated in favor of drm_db    564 /* NOTE: this is deprecated in favor of drm_dbg_core(NULL, ...). */
577 #define DRM_DEBUG(fmt, ...)                       565 #define DRM_DEBUG(fmt, ...)                                             \
578         __drm_dbg(DRM_UT_CORE, fmt, ##__VA_ARG    566         __drm_dbg(DRM_UT_CORE, fmt, ##__VA_ARGS__)
579                                                   567 
580 /* NOTE: this is deprecated in favor of drm_db    568 /* NOTE: this is deprecated in favor of drm_dbg(NULL, ...). */
581 #define DRM_DEBUG_DRIVER(fmt, ...)                569 #define DRM_DEBUG_DRIVER(fmt, ...)                                      \
582         __drm_dbg(DRM_UT_DRIVER, fmt, ##__VA_A    570         __drm_dbg(DRM_UT_DRIVER, fmt, ##__VA_ARGS__)
583                                                   571 
584 /* NOTE: this is deprecated in favor of drm_db    572 /* NOTE: this is deprecated in favor of drm_dbg_kms(NULL, ...). */
585 #define DRM_DEBUG_KMS(fmt, ...)                   573 #define DRM_DEBUG_KMS(fmt, ...)                                         \
586         __drm_dbg(DRM_UT_KMS, fmt, ##__VA_ARGS    574         __drm_dbg(DRM_UT_KMS, fmt, ##__VA_ARGS__)
587                                                   575 
588 /* NOTE: this is deprecated in favor of drm_db    576 /* NOTE: this is deprecated in favor of drm_dbg_prime(NULL, ...). */
589 #define DRM_DEBUG_PRIME(fmt, ...)                 577 #define DRM_DEBUG_PRIME(fmt, ...)                                       \
590         __drm_dbg(DRM_UT_PRIME, fmt, ##__VA_AR    578         __drm_dbg(DRM_UT_PRIME, fmt, ##__VA_ARGS__)
591                                                   579 
592 /* NOTE: this is deprecated in favor of drm_db    580 /* NOTE: this is deprecated in favor of drm_dbg_atomic(NULL, ...). */
593 #define DRM_DEBUG_ATOMIC(fmt, ...)                581 #define DRM_DEBUG_ATOMIC(fmt, ...)                                      \
594         __drm_dbg(DRM_UT_ATOMIC, fmt, ##__VA_A    582         __drm_dbg(DRM_UT_ATOMIC, fmt, ##__VA_ARGS__)
595                                                   583 
596 /* NOTE: this is deprecated in favor of drm_db    584 /* NOTE: this is deprecated in favor of drm_dbg_vbl(NULL, ...). */
597 #define DRM_DEBUG_VBL(fmt, ...)                   585 #define DRM_DEBUG_VBL(fmt, ...)                                         \
598         __drm_dbg(DRM_UT_VBL, fmt, ##__VA_ARGS    586         __drm_dbg(DRM_UT_VBL, fmt, ##__VA_ARGS__)
599                                                   587 
600 /* NOTE: this is deprecated in favor of drm_db    588 /* NOTE: this is deprecated in favor of drm_dbg_lease(NULL, ...). */
601 #define DRM_DEBUG_LEASE(fmt, ...)                 589 #define DRM_DEBUG_LEASE(fmt, ...)                                       \
602         __drm_dbg(DRM_UT_LEASE, fmt, ##__VA_AR    590         __drm_dbg(DRM_UT_LEASE, fmt, ##__VA_ARGS__)
603                                                   591 
604 /* NOTE: this is deprecated in favor of drm_db    592 /* NOTE: this is deprecated in favor of drm_dbg_dp(NULL, ...). */
605 #define DRM_DEBUG_DP(fmt, ...)                    593 #define DRM_DEBUG_DP(fmt, ...)                                          \
606         __drm_dbg(DRM_UT_DP, fmt, ## __VA_ARGS    594         __drm_dbg(DRM_UT_DP, fmt, ## __VA_ARGS__)
607                                                   595 
608 #define __DRM_DEFINE_DBG_RATELIMITED(category,    596 #define __DRM_DEFINE_DBG_RATELIMITED(category, drm, fmt, ...)                                   \
609 ({                                                597 ({                                                                                              \
610         static DEFINE_RATELIMIT_STATE(rs_, DEF    598         static DEFINE_RATELIMIT_STATE(rs_, DEFAULT_RATELIMIT_INTERVAL, DEFAULT_RATELIMIT_BURST);\
611         const struct drm_device *drm_ = (drm);    599         const struct drm_device *drm_ = (drm);                                                  \
612                                                   600                                                                                                 \
613         if (drm_debug_enabled(DRM_UT_ ## categ    601         if (drm_debug_enabled(DRM_UT_ ## category) && __ratelimit(&rs_))                        \
614                 drm_dev_printk(drm_ ? drm_->de    602                 drm_dev_printk(drm_ ? drm_->dev : NULL, KERN_DEBUG, fmt, ## __VA_ARGS__);       \
615 })                                                603 })
616                                                   604 
617 #define drm_dbg_ratelimited(drm, fmt, ...) \   << 
618         __DRM_DEFINE_DBG_RATELIMITED(DRIVER, d << 
619                                                << 
620 #define drm_dbg_kms_ratelimited(drm, fmt, ...)    605 #define drm_dbg_kms_ratelimited(drm, fmt, ...) \
621         __DRM_DEFINE_DBG_RATELIMITED(KMS, drm,    606         __DRM_DEFINE_DBG_RATELIMITED(KMS, drm, fmt, ## __VA_ARGS__)
622                                                   607 
623 /*                                                608 /*
624  * struct drm_device based WARNs                  609  * struct drm_device based WARNs
625  *                                                610  *
626  * drm_WARN*() acts like WARN*(), but with the    611  * drm_WARN*() acts like WARN*(), but with the key difference of
627  * using device specific information so that w    612  * using device specific information so that we know from which device
628  * warning is originating from.                   613  * warning is originating from.
629  *                                                614  *
630  * Prefer drm_device based drm_WARN* over regu    615  * Prefer drm_device based drm_WARN* over regular WARN*
631  */                                               616  */
632                                                   617 
633 /* Helper for struct drm_device based WARNs */    618 /* Helper for struct drm_device based WARNs */
634 #define drm_WARN(drm, condition, format, arg..    619 #define drm_WARN(drm, condition, format, arg...)                        \
635         WARN(condition, "%s %s: [drm] " format !! 620         WARN(condition, "%s %s: " format,                               \
636                         dev_driver_string((drm    621                         dev_driver_string((drm)->dev),                  \
637                         dev_name((drm)->dev),     622                         dev_name((drm)->dev), ## arg)
638                                                   623 
639 #define drm_WARN_ONCE(drm, condition, format,     624 #define drm_WARN_ONCE(drm, condition, format, arg...)                   \
640         WARN_ONCE(condition, "%s %s: [drm] " f !! 625         WARN_ONCE(condition, "%s %s: " format,                          \
641                         dev_driver_string((drm    626                         dev_driver_string((drm)->dev),                  \
642                         dev_name((drm)->dev),     627                         dev_name((drm)->dev), ## arg)
643                                                   628 
644 #define drm_WARN_ON(drm, x)                       629 #define drm_WARN_ON(drm, x)                                             \
645         drm_WARN((drm), (x), "%s",                630         drm_WARN((drm), (x), "%s",                                      \
646                  "drm_WARN_ON(" __stringify(x)    631                  "drm_WARN_ON(" __stringify(x) ")")
647                                                   632 
648 #define drm_WARN_ON_ONCE(drm, x)                  633 #define drm_WARN_ON_ONCE(drm, x)                                        \
649         drm_WARN_ONCE((drm), (x), "%s",           634         drm_WARN_ONCE((drm), (x), "%s",                                 \
650                       "drm_WARN_ON_ONCE(" __st    635                       "drm_WARN_ON_ONCE(" __stringify(x) ")")
651                                                   636 
652 #endif /* DRM_PRINT_H_ */                         637 #endif /* DRM_PRINT_H_ */
653                                                   638 

~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

kernel.org | git.kernel.org | LWN.net | Project Home | SVN repository | Mail admin

Linux® is a registered trademark of Linus Torvalds in the United States and other countries.
TOMOYO® is a registered trademark of NTT DATA CORPORATION.

sflogo.php