14562236bSHarry Wentland /* 24562236bSHarry Wentland * Copyright 2012-15 Advanced Micro Devices, Inc. 34562236bSHarry Wentland * 44562236bSHarry Wentland * Permission is hereby granted, free of charge, to any person obtaining a 54562236bSHarry Wentland * copy of this software and associated documentation files (the "Software"), 64562236bSHarry Wentland * to deal in the Software without restriction, including without limitation 74562236bSHarry Wentland * the rights to use, copy, modify, merge, publish, distribute, sublicense, 84562236bSHarry Wentland * and/or sell copies of the Software, and to permit persons to whom the 94562236bSHarry Wentland * Software is furnished to do so, subject to the following conditions: 104562236bSHarry Wentland * 114562236bSHarry Wentland * The above copyright notice and this permission notice shall be included in 124562236bSHarry Wentland * all copies or substantial portions of the Software. 134562236bSHarry Wentland * 144562236bSHarry Wentland * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 154562236bSHarry Wentland * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 164562236bSHarry Wentland * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL 174562236bSHarry Wentland * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR 184562236bSHarry Wentland * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, 194562236bSHarry Wentland * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 204562236bSHarry Wentland * OTHER DEALINGS IN THE SOFTWARE. 214562236bSHarry Wentland * 224562236bSHarry Wentland * Authors: AMD 234562236bSHarry Wentland * 244562236bSHarry Wentland */ 254562236bSHarry Wentland 264562236bSHarry Wentland #ifndef __DAL_LOGGER_INTERFACE_H__ 274562236bSHarry Wentland #define __DAL_LOGGER_INTERFACE_H__ 284562236bSHarry Wentland 294562236bSHarry Wentland #include "logger_types.h" 304562236bSHarry Wentland 314562236bSHarry Wentland struct dc_context; 324562236bSHarry Wentland struct dc_link; 334562236bSHarry Wentland struct dc_surface_update; 349474980aSYongqiang Sun struct resource_context; 35608ac7bbSJerry Zuo struct dc_state; 364562236bSHarry Wentland 374562236bSHarry Wentland /* 384562236bSHarry Wentland * 394562236bSHarry Wentland * DAL logger functionality 404562236bSHarry Wentland * 414562236bSHarry Wentland */ 424562236bSHarry Wentland 434562236bSHarry Wentland void update_surface_trace( 44fb3466a4SBhawanpreet Lakha struct dc *dc, 454562236bSHarry Wentland const struct dc_surface_update *updates, 464562236bSHarry Wentland int surface_count); 474562236bSHarry Wentland 48fb3466a4SBhawanpreet Lakha void post_surface_trace(struct dc *dc); 494562236bSHarry Wentland 50c9742685SDmytro Laktyushkin void context_clock_trace( 51fb3466a4SBhawanpreet Lakha struct dc *dc, 52608ac7bbSJerry Zuo struct dc_state *context); 534562236bSHarry Wentland 544562236bSHarry Wentland /* Any function which is empty or have incomplete implementation should be 554562236bSHarry Wentland * marked by this macro. 564562236bSHarry Wentland * Note that the message will be printed exactly once for every function 574562236bSHarry Wentland * it is used in order to avoid repeating of the same message. */ 58e1cb3e48SNicholas Kazlauskas 594562236bSHarry Wentland #define DAL_LOGGER_NOT_IMPL(fmt, ...) \ 60e1cb3e48SNicholas Kazlauskas do { \ 614562236bSHarry Wentland static bool print_not_impl = true; \ 624562236bSHarry Wentland if (print_not_impl == true) { \ 634562236bSHarry Wentland print_not_impl = false; \ 64e1cb3e48SNicholas Kazlauskas DRM_WARN("DAL_NOT_IMPL: " fmt, ##__VA_ARGS__); \ 654562236bSHarry Wentland } \ 66e1cb3e48SNicholas Kazlauskas } while (0) 674562236bSHarry Wentland 684562236bSHarry Wentland /****************************************************************************** 694562236bSHarry Wentland * Convenience macros to save on typing. 704562236bSHarry Wentland *****************************************************************************/ 714562236bSHarry Wentland 724562236bSHarry Wentland #define DC_ERROR(...) \ 73e1cb3e48SNicholas Kazlauskas do { \ 74e1cb3e48SNicholas Kazlauskas (void)(dc_ctx); \ 75e1cb3e48SNicholas Kazlauskas DC_LOG_ERROR(__VA_ARGS__); \ 76e1cb3e48SNicholas Kazlauskas } while (0) 776d244be8STony Cheng 784562236bSHarry Wentland #define DC_SYNC_INFO(...) \ 79e1cb3e48SNicholas Kazlauskas do { \ 80e1cb3e48SNicholas Kazlauskas (void)(dc_ctx); \ 81e1cb3e48SNicholas Kazlauskas DC_LOG_SYNC(__VA_ARGS__); \ 82e1cb3e48SNicholas Kazlauskas } while (0) 834562236bSHarry Wentland 844562236bSHarry Wentland /* Connectivity log format: 854562236bSHarry Wentland * [time stamp] [drm] [Major_minor] [connector name] message..... 864562236bSHarry Wentland * eg: 874562236bSHarry Wentland * [ 26.590965] [drm] [Conn_LKTN] [DP-1] HBRx4 pass VS=0, PE=0^ 884562236bSHarry Wentland * [ 26.881060] [drm] [Conn_Mode] [DP-1] {2560x1080, 2784x1111@185580Khz}^ 894562236bSHarry Wentland */ 904562236bSHarry Wentland 914562236bSHarry Wentland #define CONN_DATA_DETECT(link, hex_data, hex_len, ...) \ 92e1cb3e48SNicholas Kazlauskas do { \ 93e1cb3e48SNicholas Kazlauskas (void)(link); \ 94e1cb3e48SNicholas Kazlauskas DC_LOG_EVENT_DETECTION(__VA_ARGS__); \ 95e1cb3e48SNicholas Kazlauskas } while (0) 964562236bSHarry Wentland 974562236bSHarry Wentland #define CONN_DATA_LINK_LOSS(link, hex_data, hex_len, ...) \ 98e1cb3e48SNicholas Kazlauskas do { \ 99e1cb3e48SNicholas Kazlauskas (void)(link); \ 100e1cb3e48SNicholas Kazlauskas DC_LOG_EVENT_LINK_LOSS(__VA_ARGS__); \ 101e1cb3e48SNicholas Kazlauskas } while (0) 1024562236bSHarry Wentland 1034562236bSHarry Wentland #define CONN_MSG_LT(link, ...) \ 104e1cb3e48SNicholas Kazlauskas do { \ 105e1cb3e48SNicholas Kazlauskas (void)(link); \ 106e1cb3e48SNicholas Kazlauskas DC_LOG_EVENT_LINK_TRAINING(__VA_ARGS__); \ 107e1cb3e48SNicholas Kazlauskas } while (0) 1084562236bSHarry Wentland 1094562236bSHarry Wentland #define CONN_MSG_MODE(link, ...) \ 110e1cb3e48SNicholas Kazlauskas do { \ 111e1cb3e48SNicholas Kazlauskas (void)(link); \ 112e1cb3e48SNicholas Kazlauskas DC_LOG_EVENT_MODE_SET(__VA_ARGS__); \ 113e1cb3e48SNicholas Kazlauskas } while (0) 1144562236bSHarry Wentland 1152248eb6bSTony Cheng /* 1162248eb6bSTony Cheng * Display Test Next logging 1172248eb6bSTony Cheng */ 1182248eb6bSTony Cheng #define DTN_INFO_BEGIN() \ 11946659a83SNicholas Kazlauskas dm_dtn_log_begin(dc_ctx, log_ctx) 1202248eb6bSTony Cheng 1212248eb6bSTony Cheng #define DTN_INFO(msg, ...) \ 12246659a83SNicholas Kazlauskas dm_dtn_log_append_v(dc_ctx, log_ctx, msg, ##__VA_ARGS__) 1232248eb6bSTony Cheng 1242248eb6bSTony Cheng #define DTN_INFO_END() \ 12546659a83SNicholas Kazlauskas dm_dtn_log_end(dc_ctx, log_ctx) 1262248eb6bSTony Cheng 127215a6f05SDmytro Laktyushkin #define PERFORMANCE_TRACE_START() \ 128e1cb3e48SNicholas Kazlauskas unsigned long long perf_trc_start_stmp = dm_get_timestamp(dc->ctx) 129215a6f05SDmytro Laktyushkin 130e1cb3e48SNicholas Kazlauskas #define PERFORMANCE_TRACE_END() \ 131e1cb3e48SNicholas Kazlauskas do { \ 132215a6f05SDmytro Laktyushkin unsigned long long perf_trc_end_stmp = dm_get_timestamp(dc->ctx); \ 133215a6f05SDmytro Laktyushkin if (dc->debug.performance_trace) { \ 134e1cb3e48SNicholas Kazlauskas DC_LOG_PERF_TRACE("%s duration: %lld ticks\n", __func__, \ 135215a6f05SDmytro Laktyushkin perf_trc_end_stmp - perf_trc_start_stmp); \ 136215a6f05SDmytro Laktyushkin } \ 137215a6f05SDmytro Laktyushkin } while (0) 138215a6f05SDmytro Laktyushkin 139e1cb3e48SNicholas Kazlauskas #define DISPLAY_STATS_BEGIN(entry) (void)(entry) 1405103c568SAnthony Koo 141e1cb3e48SNicholas Kazlauskas #define DISPLAY_STATS(msg, ...) DC_LOG_PERF_TRACE(msg, __VA_ARGS__) 1425103c568SAnthony Koo 143e1cb3e48SNicholas Kazlauskas #define DISPLAY_STATS_END(entry) (void)(entry) 1445103c568SAnthony Koo 145*bbdd620dSWyatt Wood #define LOG_GAMMA_WRITE(msg, ...) 146*bbdd620dSWyatt Wood 1474562236bSHarry Wentland #endif /* __DAL_LOGGER_INTERFACE_H__ */ 148