2 * Copyright 2012-15 Advanced Micro Devices, Inc.
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:
11 * The above copyright notice and this permission notice shall be included in
12 * all copies or substantial portions of the Software.
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.
26 #ifndef __DAL_LOGGER_INTERFACE_H__
27 #define __DAL_LOGGER_INTERFACE_H__
29 #include "logger_types.h"
33 struct dc_surface_update;
34 struct resource_context;
35 struct validate_context;
39 * DAL logger functionality
43 struct dal_logger *dal_logger_create(struct dc_context *ctx);
45 uint32_t dal_logger_destroy(struct dal_logger **logger);
48 struct dal_logger *logger,
49 enum dc_log_type log_type,
53 void dm_logger_append(
54 struct log_entry *entry,
59 struct dal_logger *logger,
60 struct log_entry *entry,
61 enum dc_log_type log_type);
63 void dm_logger_close(struct log_entry *entry);
65 void dc_conn_log(struct dc_context *ctx,
66 const struct dc_link *link,
69 enum dc_log_type event,
73 void logger_write(struct dal_logger *logger,
74 enum dc_log_type log_type,
78 void pre_surface_trace(
80 const struct dc_surface *const *surfaces,
83 void update_surface_trace(
85 const struct dc_surface_update *updates,
88 void post_surface_trace(const struct dc *dc);
90 void context_timing_trace(
92 struct resource_context *res_ctx);
94 void context_clock_trace(
96 struct validate_context *context);
98 /* Any function which is empty or have incomplete implementation should be
99 * marked by this macro.
100 * Note that the message will be printed exactly once for every function
101 * it is used in order to avoid repeating of the same message. */
102 #define DAL_LOGGER_NOT_IMPL(fmt, ...) \
104 static bool print_not_impl = true; \
106 if (print_not_impl == true) { \
107 print_not_impl = false; \
108 dm_logger_write(ctx->logger, LOG_WARNING, \
109 "DAL_NOT_IMPL: " fmt, ##__VA_ARGS__); \
113 /******************************************************************************
114 * Convenience macros to save on typing.
115 *****************************************************************************/
117 #define DC_ERROR(...) \
118 dm_logger_write(dc_ctx->logger, LOG_ERROR, \
121 #define DC_SYNC_INFO(...) \
122 dm_logger_write(dc_ctx->logger, LOG_SYNC, \
126 /* Connectivity log format:
127 * [time stamp] [drm] [Major_minor] [connector name] message.....
129 * [ 26.590965] [drm] [Conn_LKTN] [DP-1] HBRx4 pass VS=0, PE=0^
130 * [ 26.881060] [drm] [Conn_Mode] [DP-1] {2560x1080, 2784x1111@185580Khz}^
133 #define CONN_DATA_DETECT(link, hex_data, hex_len, ...) \
134 dc_conn_log(link->ctx, &link->public, hex_data, hex_len, \
135 LOG_EVENT_DETECTION, ##__VA_ARGS__)
137 #define CONN_DATA_LINK_LOSS(link, hex_data, hex_len, ...) \
138 dc_conn_log(link->ctx, &link->public, hex_data, hex_len, \
139 LOG_EVENT_LINK_LOSS, ##__VA_ARGS__)
141 #define CONN_MSG_LT(link, ...) \
142 dc_conn_log(link->ctx, &link->public, NULL, 0, \
143 LOG_EVENT_LINK_TRAINING, ##__VA_ARGS__)
145 #define CONN_MSG_MODE(link, ...) \
146 dc_conn_log(link->ctx, &link->public, NULL, 0, \
147 LOG_EVENT_MODE_SET, ##__VA_ARGS__)
149 #endif /* __DAL_LOGGER_INTERFACE_H__ */