Loading...
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 | /*
* Copyright 2012-15 Advanced Micro Devices, Inc.
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
* to deal in the Software without restriction, including without limitation
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
* and/or sell copies of the Software, and to permit persons to whom the
* Software is furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
* THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR
* OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
* ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
* OTHER DEALINGS IN THE SOFTWARE.
*
* Authors: AMD
*
*/
#ifndef __DAL_LOGGER_INTERFACE_H__
#define __DAL_LOGGER_INTERFACE_H__
#include "logger_types.h"
struct dc_context;
struct dc_link;
struct dc_surface_update;
struct resource_context;
struct dc_state;
/*
*
* DAL logger functionality
*
*/
struct dal_logger *dal_logger_create(struct dc_context *ctx, uint32_t log_mask);
uint32_t dal_logger_destroy(struct dal_logger **logger);
void dm_logger_flush_buffer(struct dal_logger *logger, bool should_warn);
void dm_logger_write(
struct dal_logger *logger,
enum dc_log_type log_type,
const char *msg,
...);
void dm_logger_append(
struct log_entry *entry,
const char *msg,
...);
void dm_logger_append_va(
struct log_entry *entry,
const char *msg,
va_list args);
void dm_logger_open(
struct dal_logger *logger,
struct log_entry *entry,
enum dc_log_type log_type);
void dm_logger_close(struct log_entry *entry);
void dc_conn_log(struct dc_context *ctx,
const struct dc_link *link,
uint8_t *hex_data,
int hex_data_count,
enum dc_log_type event,
const char *msg,
...);
void logger_write(struct dal_logger *logger,
enum dc_log_type log_type,
const char *msg,
void *paralist);
void pre_surface_trace(
struct dc *dc,
const struct dc_plane_state *const *plane_states,
int surface_count);
void update_surface_trace(
struct dc *dc,
const struct dc_surface_update *updates,
int surface_count);
void post_surface_trace(struct dc *dc);
void context_timing_trace(
struct dc *dc,
struct resource_context *res_ctx);
void context_clock_trace(
struct dc *dc,
struct dc_state *context);
/* Any function which is empty or have incomplete implementation should be
* marked by this macro.
* Note that the message will be printed exactly once for every function
* it is used in order to avoid repeating of the same message. */
#define DAL_LOGGER_NOT_IMPL(fmt, ...) \
{ \
static bool print_not_impl = true; \
\
if (print_not_impl == true) { \
print_not_impl = false; \
dm_logger_write(ctx->logger, LOG_WARNING, \
"DAL_NOT_IMPL: " fmt, ##__VA_ARGS__); \
} \
}
/******************************************************************************
* Convenience macros to save on typing.
*****************************************************************************/
#define DC_ERROR(...) \
dm_logger_write(dc_ctx->logger, LOG_ERROR, \
__VA_ARGS__)
#define DC_SYNC_INFO(...) \
dm_logger_write(dc_ctx->logger, LOG_SYNC, \
__VA_ARGS__)
/* Connectivity log format:
* [time stamp] [drm] [Major_minor] [connector name] message.....
* eg:
* [ 26.590965] [drm] [Conn_LKTN] [DP-1] HBRx4 pass VS=0, PE=0^
* [ 26.881060] [drm] [Conn_Mode] [DP-1] {2560x1080, 2784x1111@185580Khz}^
*/
#define CONN_DATA_DETECT(link, hex_data, hex_len, ...) \
dc_conn_log(link->ctx, link, hex_data, hex_len, \
LOG_EVENT_DETECTION, ##__VA_ARGS__)
#define CONN_DATA_LINK_LOSS(link, hex_data, hex_len, ...) \
dc_conn_log(link->ctx, link, hex_data, hex_len, \
LOG_EVENT_LINK_LOSS, ##__VA_ARGS__)
#define CONN_MSG_LT(link, ...) \
dc_conn_log(link->ctx, link, NULL, 0, \
LOG_EVENT_LINK_TRAINING, ##__VA_ARGS__)
#define CONN_MSG_MODE(link, ...) \
dc_conn_log(link->ctx, link, NULL, 0, \
LOG_EVENT_MODE_SET, ##__VA_ARGS__)
/*
* Display Test Next logging
*/
#define DTN_INFO_BEGIN() \
dm_dtn_log_begin(dc_ctx)
#define DTN_INFO(msg, ...) \
dm_dtn_log_append_v(dc_ctx, msg, ##__VA_ARGS__)
#define DTN_INFO_END() \
dm_dtn_log_end(dc_ctx)
#define PERFORMANCE_TRACE_START() \
unsigned long long perf_trc_start_stmp = dm_get_timestamp(dc->ctx); \
unsigned long long perf_trc_start_log_msk = dc->ctx->logger->mask; \
unsigned int perf_trc_start_log_flags = dc->ctx->logger->flags.value; \
if (dc->debug.performance_trace) {\
dm_logger_flush_buffer(dc->ctx->logger, false);\
dc->ctx->logger->mask = 1<<LOG_PERF_TRACE;\
dc->ctx->logger->flags.bits.ENABLE_CONSOLE = 0;\
dc->ctx->logger->flags.bits.ENABLE_BUFFER = 1;\
}
#define PERFORMANCE_TRACE_END() do {\
unsigned long long perf_trc_end_stmp = dm_get_timestamp(dc->ctx);\
if (dc->debug.performance_trace) {\
dm_logger_write(dc->ctx->logger, \
LOG_PERF_TRACE, \
"%s duration: %d ticks\n", __func__,\
perf_trc_end_stmp - perf_trc_start_stmp); \
if (perf_trc_start_log_msk != 1<<LOG_PERF_TRACE) {\
dc->ctx->logger->mask = perf_trc_start_log_msk;\
dc->ctx->logger->flags.value = perf_trc_start_log_flags;\
dm_logger_flush_buffer(dc->ctx->logger, false);\
} \
} \
} while (0)
#endif /* __DAL_LOGGER_INTERFACE_H__ */
|