]> Git Repo - linux.git/blob - drivers/gpu/drm/amd/display/include/logger_interface.h
Merge tag 'drm-misc-fixes-2024-11-21' of https://gitlab.freedesktop.org/drm/misc...
[linux.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 dc_state;
36
37 /*
38  *
39  * DAL logger functionality
40  *
41  */
42
43 void pre_surface_trace(
44                 struct dc *dc,
45                 const struct dc_plane_state *const *plane_states,
46                 int surface_count);
47
48 void update_surface_trace(
49                 struct dc *dc,
50                 const struct dc_surface_update *updates,
51                 int surface_count);
52
53 void post_surface_trace(struct dc *dc);
54
55 void context_clock_trace(
56                 struct dc *dc,
57                 struct dc_state *context);
58
59 /* Any function which is empty or have incomplete implementation should be
60  * marked by this macro.
61  * Note that the message will be printed exactly once for every function
62  * it is used in order to avoid repeating of the same message. */
63
64 #define DAL_LOGGER_NOT_IMPL(fmt, ...) \
65         do { \
66                 static bool print_not_impl = true; \
67                 if (print_not_impl == true) { \
68                         print_not_impl = false; \
69                         DRM_WARN("DAL_NOT_IMPL: " fmt, ##__VA_ARGS__); \
70                 } \
71         } while (0)
72
73 /******************************************************************************
74  * Convenience macros to save on typing.
75  *****************************************************************************/
76
77 #define DC_ERROR(...) \
78                 do { \
79                         (void)(dc_ctx); \
80                         DC_LOG_ERROR(__VA_ARGS__); \
81                 } while (0)
82
83 #define DC_SYNC_INFO(...) \
84                 do { \
85                         (void)(dc_ctx); \
86                         DC_LOG_SYNC(__VA_ARGS__); \
87                 } while (0)
88
89 /* Connectivity log format:
90  * [time stamp]   [drm] [Major_minor] [connector name] message.....
91  * eg:
92  * [   26.590965] [drm] [Conn_LKTN]       [DP-1] HBRx4 pass VS=0, PE=0^
93  * [   26.881060] [drm] [Conn_Mode]       [DP-1] {2560x1080, 2784x1111@185580Khz}^
94  */
95
96 #define CONN_DATA_DETECT(link, hex_data, hex_len, ...) \
97                 do { \
98                         (void)(link); \
99                         DC_LOG_EVENT_DETECTION(__VA_ARGS__); \
100                 } while (0)
101
102 #define CONN_DATA_LINK_LOSS(link, hex_data, hex_len, ...) \
103                 do { \
104                         (void)(link); \
105                         DC_LOG_EVENT_LINK_LOSS(__VA_ARGS__); \
106                 } while (0)
107
108 #define CONN_MSG_LT(link, ...) \
109                 do { \
110                         (void)(link); \
111                         DC_LOG_EVENT_LINK_TRAINING(__VA_ARGS__); \
112                 } while (0)
113
114 #define CONN_MSG_MODE(link, ...) \
115                 do { \
116                         (void)(link); \
117                         DC_LOG_EVENT_MODE_SET(__VA_ARGS__); \
118                 } while (0)
119
120 /*
121  * Display Test Next logging
122  */
123 #define DTN_INFO_BEGIN() \
124         dm_dtn_log_begin(dc_ctx, log_ctx)
125
126 #define DTN_INFO(msg, ...) \
127         dm_dtn_log_append_v(dc_ctx, log_ctx, msg, ##__VA_ARGS__)
128
129 #define DTN_INFO_END() \
130         dm_dtn_log_end(dc_ctx, log_ctx)
131
132 #define PERFORMANCE_TRACE_START() \
133         unsigned long long perf_trc_start_stmp = dm_get_timestamp(dc->ctx)
134
135 #define PERFORMANCE_TRACE_END() \
136         do { \
137                 unsigned long long perf_trc_end_stmp = dm_get_timestamp(dc->ctx); \
138                 if (dc->debug.performance_trace) { \
139                         DC_LOG_PERF_TRACE("%s duration: %lld ticks\n", __func__, \
140                                 perf_trc_end_stmp - perf_trc_start_stmp); \
141                 } \
142         } while (0)
143
144 #define DISPLAY_STATS_BEGIN(entry) (void)(entry)
145
146 #define DISPLAY_STATS(msg, ...) DC_LOG_PERF_TRACE(msg, __VA_ARGS__)
147
148 #define DISPLAY_STATS_END(entry) (void)(entry)
149
150 #define LOG_GAMMA_WRITE(msg, ...)
151
152 #endif /* __DAL_LOGGER_INTERFACE_H__ */
This page took 0.040299 seconds and 4 git commands to generate.