logger_interface.h 4.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156
  1. /*
  2. * Copyright 2012-15 Advanced Micro Devices, Inc.
  3. *
  4. * Permission is hereby granted, free of charge, to any person obtaining a
  5. * copy of this software and associated documentation files (the "Software"),
  6. * to deal in the Software without restriction, including without limitation
  7. * the rights to use, copy, modify, merge, publish, distribute, sublicense,
  8. * and/or sell copies of the Software, and to permit persons to whom the
  9. * Software is furnished to do so, subject to the following conditions:
  10. *
  11. * The above copyright notice and this permission notice shall be included in
  12. * all copies or substantial portions of the Software.
  13. *
  14. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  15. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  16. * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
  17. * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR
  18. * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
  19. * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
  20. * OTHER DEALINGS IN THE SOFTWARE.
  21. *
  22. * Authors: AMD
  23. *
  24. */
  25. #ifndef __DAL_LOGGER_INTERFACE_H__
  26. #define __DAL_LOGGER_INTERFACE_H__
  27. #include "logger_types.h"
  28. struct dc_context;
  29. struct dc_link;
  30. struct dc_surface_update;
  31. struct resource_context;
  32. struct dc_state;
  33. /*
  34. *
  35. * DAL logger functionality
  36. *
  37. */
  38. void pre_surface_trace(
  39. struct dc *dc,
  40. const struct dc_plane_state *const *plane_states,
  41. int surface_count);
  42. void update_surface_trace(
  43. struct dc *dc,
  44. const struct dc_surface_update *updates,
  45. int surface_count);
  46. void post_surface_trace(struct dc *dc);
  47. void context_timing_trace(
  48. struct dc *dc,
  49. struct resource_context *res_ctx);
  50. void context_clock_trace(
  51. struct dc *dc,
  52. struct dc_state *context);
  53. /* Any function which is empty or have incomplete implementation should be
  54. * marked by this macro.
  55. * Note that the message will be printed exactly once for every function
  56. * it is used in order to avoid repeating of the same message. */
  57. #define DAL_LOGGER_NOT_IMPL(fmt, ...) \
  58. do { \
  59. static bool print_not_impl = true; \
  60. if (print_not_impl == true) { \
  61. print_not_impl = false; \
  62. DRM_WARN("DAL_NOT_IMPL: " fmt, ##__VA_ARGS__); \
  63. } \
  64. } while (0)
  65. /******************************************************************************
  66. * Convenience macros to save on typing.
  67. *****************************************************************************/
  68. #define DC_ERROR(...) \
  69. do { \
  70. (void)(dc_ctx); \
  71. DC_LOG_ERROR(__VA_ARGS__); \
  72. } while (0)
  73. #define DC_SYNC_INFO(...) \
  74. do { \
  75. (void)(dc_ctx); \
  76. DC_LOG_SYNC(__VA_ARGS__); \
  77. } while (0)
  78. /* Connectivity log format:
  79. * [time stamp] [drm] [Major_minor] [connector name] message.....
  80. * eg:
  81. * [ 26.590965] [drm] [Conn_LKTN] [DP-1] HBRx4 pass VS=0, PE=0^
  82. * [ 26.881060] [drm] [Conn_Mode] [DP-1] {2560x1080, 2784x1111@185580Khz}^
  83. */
  84. #define CONN_DATA_DETECT(link, hex_data, hex_len, ...) \
  85. do { \
  86. (void)(link); \
  87. DC_LOG_EVENT_DETECTION(__VA_ARGS__); \
  88. } while (0)
  89. #define CONN_DATA_LINK_LOSS(link, hex_data, hex_len, ...) \
  90. do { \
  91. (void)(link); \
  92. DC_LOG_EVENT_LINK_LOSS(__VA_ARGS__); \
  93. } while (0)
  94. #define CONN_MSG_LT(link, ...) \
  95. do { \
  96. (void)(link); \
  97. DC_LOG_EVENT_LINK_TRAINING(__VA_ARGS__); \
  98. } while (0)
  99. #define CONN_MSG_MODE(link, ...) \
  100. do { \
  101. (void)(link); \
  102. DC_LOG_EVENT_MODE_SET(__VA_ARGS__); \
  103. } while (0)
  104. /*
  105. * Display Test Next logging
  106. */
  107. #define DTN_INFO_BEGIN() \
  108. dm_dtn_log_begin(dc_ctx, log_ctx)
  109. #define DTN_INFO(msg, ...) \
  110. dm_dtn_log_append_v(dc_ctx, log_ctx, msg, ##__VA_ARGS__)
  111. #define DTN_INFO_END() \
  112. dm_dtn_log_end(dc_ctx, log_ctx)
  113. #define PERFORMANCE_TRACE_START() \
  114. unsigned long long perf_trc_start_stmp = dm_get_timestamp(dc->ctx)
  115. #define PERFORMANCE_TRACE_END() \
  116. do { \
  117. unsigned long long perf_trc_end_stmp = dm_get_timestamp(dc->ctx); \
  118. if (dc->debug.performance_trace) { \
  119. DC_LOG_PERF_TRACE("%s duration: %lld ticks\n", __func__, \
  120. perf_trc_end_stmp - perf_trc_start_stmp); \
  121. } \
  122. } while (0)
  123. #define DISPLAY_STATS_BEGIN(entry) (void)(entry)
  124. #define DISPLAY_STATS(msg, ...) DC_LOG_PERF_TRACE(msg, __VA_ARGS__)
  125. #define DISPLAY_STATS_END(entry) (void)(entry)
  126. #define LOG_GAMMA_WRITE(msg, ...)
  127. #endif /* __DAL_LOGGER_INTERFACE_H__ */