Back to home page

OSCL-LXR

 
 

    


0001 /*
0002  * Copyright 2012-15 Advanced Micro Devices, Inc.
0003  *
0004  * Permission is hereby granted, free of charge, to any person obtaining a
0005  * copy of this software and associated documentation files (the "Software"),
0006  * to deal in the Software without restriction, including without limitation
0007  * the rights to use, copy, modify, merge, publish, distribute, sublicense,
0008  * and/or sell copies of the Software, and to permit persons to whom the
0009  * Software is furnished to do so, subject to the following conditions:
0010  *
0011  * The above copyright notice and this permission notice shall be included in
0012  * all copies or substantial portions of the Software.
0013  *
0014  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
0015  * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
0016  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
0017  * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR
0018  * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
0019  * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
0020  * OTHER DEALINGS IN THE SOFTWARE.
0021  *
0022  * Authors: AMD
0023  *
0024  */
0025 
0026 #ifndef __DAL_LOGGER_INTERFACE_H__
0027 #define __DAL_LOGGER_INTERFACE_H__
0028 
0029 #include "logger_types.h"
0030 
0031 struct dc_context;
0032 struct dc_link;
0033 struct dc_surface_update;
0034 struct resource_context;
0035 struct dc_state;
0036 
0037 /*
0038  *
0039  * DAL logger functionality
0040  *
0041  */
0042 
0043 void pre_surface_trace(
0044         struct dc *dc,
0045         const struct dc_plane_state *const *plane_states,
0046         int surface_count);
0047 
0048 void update_surface_trace(
0049         struct dc *dc,
0050         const struct dc_surface_update *updates,
0051         int surface_count);
0052 
0053 void post_surface_trace(struct dc *dc);
0054 
0055 void context_timing_trace(
0056         struct dc *dc,
0057         struct resource_context *res_ctx);
0058 
0059 void context_clock_trace(
0060         struct dc *dc,
0061         struct dc_state *context);
0062 
0063 /* Any function which is empty or have incomplete implementation should be
0064  * marked by this macro.
0065  * Note that the message will be printed exactly once for every function
0066  * it is used in order to avoid repeating of the same message. */
0067 
0068 #define DAL_LOGGER_NOT_IMPL(fmt, ...) \
0069     do { \
0070         static bool print_not_impl = true; \
0071         if (print_not_impl == true) { \
0072             print_not_impl = false; \
0073             DRM_WARN("DAL_NOT_IMPL: " fmt, ##__VA_ARGS__); \
0074         } \
0075     } while (0)
0076 
0077 /******************************************************************************
0078  * Convenience macros to save on typing.
0079  *****************************************************************************/
0080 
0081 #define DC_ERROR(...) \
0082         do { \
0083             (void)(dc_ctx); \
0084             DC_LOG_ERROR(__VA_ARGS__); \
0085         } while (0)
0086 
0087 #define DC_SYNC_INFO(...) \
0088         do { \
0089             (void)(dc_ctx); \
0090             DC_LOG_SYNC(__VA_ARGS__); \
0091         } while (0)
0092 
0093 /* Connectivity log format:
0094  * [time stamp]   [drm] [Major_minor] [connector name] message.....
0095  * eg:
0096  * [   26.590965] [drm] [Conn_LKTN]   [DP-1] HBRx4 pass VS=0, PE=0^
0097  * [   26.881060] [drm] [Conn_Mode]   [DP-1] {2560x1080, 2784x1111@185580Khz}^
0098  */
0099 
0100 #define CONN_DATA_DETECT(link, hex_data, hex_len, ...) \
0101         do { \
0102             (void)(link); \
0103             DC_LOG_EVENT_DETECTION(__VA_ARGS__); \
0104         } while (0)
0105 
0106 #define CONN_DATA_LINK_LOSS(link, hex_data, hex_len, ...) \
0107         do { \
0108             (void)(link); \
0109             DC_LOG_EVENT_LINK_LOSS(__VA_ARGS__); \
0110         } while (0)
0111 
0112 #define CONN_MSG_LT(link, ...) \
0113         do { \
0114             (void)(link); \
0115             DC_LOG_EVENT_LINK_TRAINING(__VA_ARGS__); \
0116         } while (0)
0117 
0118 #define CONN_MSG_MODE(link, ...) \
0119         do { \
0120             (void)(link); \
0121             DC_LOG_EVENT_MODE_SET(__VA_ARGS__); \
0122         } while (0)
0123 
0124 /*
0125  * Display Test Next logging
0126  */
0127 #define DTN_INFO_BEGIN() \
0128     dm_dtn_log_begin(dc_ctx, log_ctx)
0129 
0130 #define DTN_INFO(msg, ...) \
0131     dm_dtn_log_append_v(dc_ctx, log_ctx, msg, ##__VA_ARGS__)
0132 
0133 #define DTN_INFO_END() \
0134     dm_dtn_log_end(dc_ctx, log_ctx)
0135 
0136 #define PERFORMANCE_TRACE_START() \
0137     unsigned long long perf_trc_start_stmp = dm_get_timestamp(dc->ctx)
0138 
0139 #define PERFORMANCE_TRACE_END() \
0140     do { \
0141         unsigned long long perf_trc_end_stmp = dm_get_timestamp(dc->ctx); \
0142         if (dc->debug.performance_trace) { \
0143             DC_LOG_PERF_TRACE("%s duration: %lld ticks\n", __func__, \
0144                 perf_trc_end_stmp - perf_trc_start_stmp); \
0145         } \
0146     } while (0)
0147 
0148 #define DISPLAY_STATS_BEGIN(entry) (void)(entry)
0149 
0150 #define DISPLAY_STATS(msg, ...) DC_LOG_PERF_TRACE(msg, __VA_ARGS__)
0151 
0152 #define DISPLAY_STATS_END(entry) (void)(entry)
0153 
0154 #define LOG_GAMMA_WRITE(msg, ...)
0155 
0156 #endif /* __DAL_LOGGER_INTERFACE_H__ */