]> git.proxmox.com Git - mirror_ubuntu-bionic-kernel.git/blob - drivers/gpu/drm/amd/display/include/logger_interface.h
0e978d921fdf105b31c58894b7185889946c0a4d
[mirror_ubuntu-bionic-kernel.git] / drivers / gpu / drm / amd / display / include / logger_interface.h
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
26 #ifndef __DAL_LOGGER_INTERFACE_H__
27 #define __DAL_LOGGER_INTERFACE_H__
28
29 #include "logger_types.h"
30
31 struct dc_context;
32 struct dc_link;
33 struct dc_surface_update;
34 struct resource_context;
35 struct validate_context;
36
37 /*
38 *
39 * DAL logger functionality
40 *
41 */
42
43 struct dal_logger *dal_logger_create(struct dc_context *ctx);
44
45 uint32_t dal_logger_destroy(struct dal_logger **logger);
46
47 void dm_logger_write(
48 struct dal_logger *logger,
49 enum dc_log_type log_type,
50 const char *msg,
51 ...);
52
53 void dm_logger_append(
54 struct log_entry *entry,
55 const char *msg,
56 ...);
57
58 void dm_logger_open(
59 struct dal_logger *logger,
60 struct log_entry *entry,
61 enum dc_log_type log_type);
62
63 void dm_logger_close(struct log_entry *entry);
64
65 void dc_conn_log(struct dc_context *ctx,
66 const struct dc_link *link,
67 uint8_t *hex_data,
68 int hex_data_count,
69 enum dc_log_type event,
70 const char *msg,
71 ...);
72
73 void logger_write(struct dal_logger *logger,
74 enum dc_log_type log_type,
75 const char *msg,
76 void *paralist);
77
78 void pre_surface_trace(
79 const struct dc *dc,
80 const struct dc_plane_state *const *surfaces,
81 int surface_count);
82
83 void update_surface_trace(
84 const struct dc *dc,
85 const struct dc_surface_update *updates,
86 int surface_count);
87
88 void post_surface_trace(const struct dc *dc);
89
90 void context_timing_trace(
91 const struct dc *dc,
92 struct resource_context *res_ctx);
93
94 void context_clock_trace(
95 const struct dc *dc,
96 struct validate_context *context);
97
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, ...) \
103 { \
104 static bool print_not_impl = true; \
105 \
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__); \
110 } \
111 }
112
113 /******************************************************************************
114 * Convenience macros to save on typing.
115 *****************************************************************************/
116
117 #define DC_ERROR(...) \
118 dm_logger_write(dc_ctx->logger, LOG_ERROR, \
119 __VA_ARGS__)
120
121 #define DC_SYNC_INFO(...) \
122 dm_logger_write(dc_ctx->logger, LOG_SYNC, \
123 __VA_ARGS__)
124
125 /* Connectivity log format:
126 * [time stamp] [drm] [Major_minor] [connector name] message.....
127 * eg:
128 * [ 26.590965] [drm] [Conn_LKTN] [DP-1] HBRx4 pass VS=0, PE=0^
129 * [ 26.881060] [drm] [Conn_Mode] [DP-1] {2560x1080, 2784x1111@185580Khz}^
130 */
131
132 #define CONN_DATA_DETECT(link, hex_data, hex_len, ...) \
133 dc_conn_log(link->ctx, link, hex_data, hex_len, \
134 LOG_EVENT_DETECTION, ##__VA_ARGS__)
135
136 #define CONN_DATA_LINK_LOSS(link, hex_data, hex_len, ...) \
137 dc_conn_log(link->ctx, link, hex_data, hex_len, \
138 LOG_EVENT_LINK_LOSS, ##__VA_ARGS__)
139
140 #define CONN_MSG_LT(link, ...) \
141 dc_conn_log(link->ctx, link, NULL, 0, \
142 LOG_EVENT_LINK_TRAINING, ##__VA_ARGS__)
143
144 #define CONN_MSG_MODE(link, ...) \
145 dc_conn_log(link->ctx, link, NULL, 0, \
146 LOG_EVENT_MODE_SET, ##__VA_ARGS__)
147
148 /*
149 * Display Test Next logging
150 */
151 #define DTN_INFO_BEGIN() \
152 dm_dtn_log_begin(dc_ctx)
153
154 #define DTN_INFO(msg, ...) \
155 dm_dtn_log_append_v(dc_ctx, msg, ##__VA_ARGS__)
156
157 #define DTN_INFO_END() \
158 dm_dtn_log_end(dc_ctx)
159
160 #endif /* __DAL_LOGGER_INTERFACE_H__ */