aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLyude <cpaul@redhat.com>2016-08-05 20:30:38 -0400
committerDaniel Vetter <daniel.vetter@ffwll.ch>2016-08-09 12:23:43 -0400
commit27528c667a210845b35a1f49c810dba469bced52 (patch)
treef25ee1e8b89b29def0f103c164453f8912fa645b
parentcfc5adea1955ee8ddb62cc0d20ee454472033b6a (diff)
drm: Add ratelimited versions of the DRM_DEBUG* macros
There's a couple of places where this would be useful for drivers (such as reporting DP aux transaction timeouts). Signed-off-by: Lyude <cpaul@redhat.com> Reviewed-by: Christian König <christian.koenig@amd.com> Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch> Link: http://patchwork.freedesktop.org/patch/msgid/1470443443-27252-7-git-send-email-cpaul@redhat.com
-rw-r--r--include/drm/drmP.h30
1 files changed, 30 insertions, 0 deletions
diff --git a/include/drm/drmP.h b/include/drm/drmP.h
index 856c174bd730..f8e87fde611b 100644
--- a/include/drm/drmP.h
+++ b/include/drm/drmP.h
@@ -232,6 +232,36 @@ void drm_err(const char *format, ...);
232 drm_ut_debug_printk(__func__, fmt, ##args); \ 232 drm_ut_debug_printk(__func__, fmt, ##args); \
233 } while (0) 233 } while (0)
234 234
235#define _DRM_DEFINE_DEBUG_RATELIMITED(level, fmt, args...) \
236 do { \
237 if (unlikely(drm_debug & DRM_UT_ ## level)) { \
238 static DEFINE_RATELIMIT_STATE( \
239 _rs, \
240 DEFAULT_RATELIMIT_INTERVAL, \
241 DEFAULT_RATELIMIT_BURST); \
242 \
243 if (__ratelimit(&_rs)) { \
244 drm_ut_debug_printk(__func__, fmt, \
245 ##args); \
246 } \
247 } \
248 } while (0)
249
250/**
251 * Rate limited debug output. Like DRM_DEBUG() but won't flood the log.
252 *
253 * \param fmt printf() like format string.
254 * \param arg arguments
255 */
256#define DRM_DEBUG_RATELIMITED(fmt, args...) \
257 _DRM_DEFINE_DEBUG_RATELIMITED(CORE, fmt, ##args)
258#define DRM_DEBUG_DRIVER_RATELIMITED(fmt, args...) \
259 _DRM_DEFINE_DEBUG_RATELIMITED(DRIVER, fmt, ##args)
260#define DRM_DEBUG_KMS_RATELIMITED(fmt, args...) \
261 _DRM_DEFINE_DEBUG_RATELIMITED(KMS, fmt, ##args)
262#define DRM_DEBUG_PRIME_RATELIMITED(fmt, args...) \
263 _DRM_DEFINE_DEBUG_RATELIMITED(PRIME, fmt, ##args)
264
235/*@}*/ 265/*@}*/
236 266
237/***********************************************************************/ 267/***********************************************************************/