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