]> Git Repo - linux.git/commitdiff
drm: Add ratelimited versions of the DRM_DEBUG* macros
authorLyude <[email protected]>
Sat, 6 Aug 2016 00:30:38 +0000 (20:30 -0400)
committerDaniel Vetter <[email protected]>
Tue, 9 Aug 2016 16:23:43 +0000 (18:23 +0200)
There's a couple of places where this would be useful for drivers (such
as reporting DP aux transaction timeouts).

Signed-off-by: Lyude <[email protected]>
Reviewed-by: Christian König <[email protected]>
Signed-off-by: Daniel Vetter <[email protected]>
Link: http://patchwork.freedesktop.org/patch/msgid/[email protected]
include/drm/drmP.h

index 856c174bd73078f58edcabf50d999178347dd193..f8e87fde611bd0cb5cefbf2f3f5c728656303841 100644 (file)
@@ -232,6 +232,36 @@ void drm_err(const char *format, ...);
                        drm_ut_debug_printk(__func__, fmt, ##args);     \
        } while (0)
 
+#define _DRM_DEFINE_DEBUG_RATELIMITED(level, fmt, args...)             \
+       do {                                                            \
+               if (unlikely(drm_debug & DRM_UT_ ## level)) {           \
+                       static DEFINE_RATELIMIT_STATE(                  \
+                               _rs,                                    \
+                               DEFAULT_RATELIMIT_INTERVAL,             \
+                               DEFAULT_RATELIMIT_BURST);               \
+                                                                       \
+                       if (__ratelimit(&_rs)) {                        \
+                               drm_ut_debug_printk(__func__, fmt,      \
+                                                   ##args);            \
+                       }                                               \
+               }                                                       \
+       } while (0)
+
+/**
+ * Rate limited debug output. Like DRM_DEBUG() but won't flood the log.
+ *
+ * \param fmt printf() like format string.
+ * \param arg arguments
+ */
+#define DRM_DEBUG_RATELIMITED(fmt, args...)                            \
+       _DRM_DEFINE_DEBUG_RATELIMITED(CORE, fmt, ##args)
+#define DRM_DEBUG_DRIVER_RATELIMITED(fmt, args...)                     \
+       _DRM_DEFINE_DEBUG_RATELIMITED(DRIVER, fmt, ##args)
+#define DRM_DEBUG_KMS_RATELIMITED(fmt, args...)                                \
+       _DRM_DEFINE_DEBUG_RATELIMITED(KMS, fmt, ##args)
+#define DRM_DEBUG_PRIME_RATELIMITED(fmt, args...)                      \
+       _DRM_DEFINE_DEBUG_RATELIMITED(PRIME, fmt, ##args)
+
 /*@}*/
 
 /***********************************************************************/
This page took 0.056254 seconds and 4 git commands to generate.