diff options
Diffstat (limited to 'drivers/gpu/drm/amd/display/include')
| -rw-r--r-- | drivers/gpu/drm/amd/display/include/dpcd_defs.h | 3 | ||||
| -rw-r--r-- | drivers/gpu/drm/amd/display/include/logger_interface.h | 138 | ||||
| -rw-r--r-- | drivers/gpu/drm/amd/display/include/logger_types.h | 59 |
3 files changed, 49 insertions, 151 deletions
diff --git a/drivers/gpu/drm/amd/display/include/dpcd_defs.h b/drivers/gpu/drm/amd/display/include/dpcd_defs.h index d8e52e3b8e3c..1c66166d0a94 100644 --- a/drivers/gpu/drm/amd/display/include/dpcd_defs.h +++ b/drivers/gpu/drm/amd/display/include/dpcd_defs.h | |||
| @@ -27,6 +27,9 @@ | |||
| 27 | #define __DAL_DPCD_DEFS_H__ | 27 | #define __DAL_DPCD_DEFS_H__ |
| 28 | 28 | ||
| 29 | #include <drm/drm_dp_helper.h> | 29 | #include <drm/drm_dp_helper.h> |
| 30 | #ifndef DP_SINK_HW_REVISION_START // can remove this once the define gets into linux drm_dp_helper.h | ||
| 31 | #define DP_SINK_HW_REVISION_START 0x409 | ||
| 32 | #endif | ||
| 30 | 33 | ||
| 31 | enum dpcd_revision { | 34 | enum dpcd_revision { |
| 32 | DPCD_REV_10 = 0x10, | 35 | DPCD_REV_10 = 0x10, |
diff --git a/drivers/gpu/drm/amd/display/include/logger_interface.h b/drivers/gpu/drm/amd/display/include/logger_interface.h index 0f10ed710e0d..e3c79616682d 100644 --- a/drivers/gpu/drm/amd/display/include/logger_interface.h +++ b/drivers/gpu/drm/amd/display/include/logger_interface.h | |||
| @@ -40,49 +40,7 @@ struct dc_state; | |||
| 40 | * | 40 | * |
| 41 | */ | 41 | */ |
| 42 | 42 | ||
| 43 | struct dal_logger *dal_logger_create(struct dc_context *ctx, uint32_t log_mask); | 43 | void dc_conn_log_hex_linux(const uint8_t *hex_data, int hex_data_count); |
| 44 | |||
| 45 | uint32_t dal_logger_destroy(struct dal_logger **logger); | ||
| 46 | |||
| 47 | void dm_logger_flush_buffer(struct dal_logger *logger, bool should_warn); | ||
| 48 | |||
| 49 | void dm_logger_write( | ||
| 50 | struct dal_logger *logger, | ||
| 51 | enum dc_log_type log_type, | ||
| 52 | const char *msg, | ||
| 53 | ...); | ||
| 54 | |||
| 55 | void dm_logger_append( | ||
| 56 | struct log_entry *entry, | ||
| 57 | const char *msg, | ||
| 58 | ...); | ||
| 59 | |||
| 60 | void dm_logger_append_va( | ||
| 61 | struct log_entry *entry, | ||
| 62 | const char *msg, | ||
| 63 | va_list args); | ||
| 64 | |||
| 65 | void dm_logger_append_heading(struct log_entry *entry); | ||
| 66 | |||
| 67 | void dm_logger_open( | ||
| 68 | struct dal_logger *logger, | ||
| 69 | struct log_entry *entry, | ||
| 70 | enum dc_log_type log_type); | ||
| 71 | |||
| 72 | void dm_logger_close(struct log_entry *entry); | ||
| 73 | |||
| 74 | void dc_conn_log(struct dc_context *ctx, | ||
| 75 | const struct dc_link *link, | ||
| 76 | uint8_t *hex_data, | ||
| 77 | int hex_data_count, | ||
| 78 | enum dc_log_type event, | ||
| 79 | const char *msg, | ||
| 80 | ...); | ||
| 81 | |||
| 82 | void logger_write(struct dal_logger *logger, | ||
| 83 | enum dc_log_type log_type, | ||
| 84 | const char *msg, | ||
| 85 | void *paralist); | ||
| 86 | 44 | ||
| 87 | void pre_surface_trace( | 45 | void pre_surface_trace( |
| 88 | struct dc *dc, | 46 | struct dc *dc, |
| @@ -108,28 +66,31 @@ void context_clock_trace( | |||
| 108 | * marked by this macro. | 66 | * marked by this macro. |
| 109 | * Note that the message will be printed exactly once for every function | 67 | * Note that the message will be printed exactly once for every function |
| 110 | * it is used in order to avoid repeating of the same message. */ | 68 | * it is used in order to avoid repeating of the same message. */ |
| 69 | |||
| 111 | #define DAL_LOGGER_NOT_IMPL(fmt, ...) \ | 70 | #define DAL_LOGGER_NOT_IMPL(fmt, ...) \ |
| 112 | { \ | 71 | do { \ |
| 113 | static bool print_not_impl = true; \ | 72 | static bool print_not_impl = true; \ |
| 114 | \ | 73 | if (print_not_impl == true) { \ |
| 115 | if (print_not_impl == true) { \ | 74 | print_not_impl = false; \ |
| 116 | print_not_impl = false; \ | 75 | DRM_WARN("DAL_NOT_IMPL: " fmt, ##__VA_ARGS__); \ |
| 117 | dm_logger_write(ctx->logger, LOG_WARNING, \ | 76 | } \ |
| 118 | "DAL_NOT_IMPL: " fmt, ##__VA_ARGS__); \ | 77 | } while (0) |
| 119 | } \ | ||
| 120 | } | ||
| 121 | 78 | ||
| 122 | /****************************************************************************** | 79 | /****************************************************************************** |
| 123 | * Convenience macros to save on typing. | 80 | * Convenience macros to save on typing. |
| 124 | *****************************************************************************/ | 81 | *****************************************************************************/ |
| 125 | 82 | ||
| 126 | #define DC_ERROR(...) \ | 83 | #define DC_ERROR(...) \ |
| 127 | dm_logger_write(dc_ctx->logger, LOG_ERROR, \ | 84 | do { \ |
| 128 | __VA_ARGS__) | 85 | (void)(dc_ctx); \ |
| 86 | DC_LOG_ERROR(__VA_ARGS__); \ | ||
| 87 | } while (0) | ||
| 129 | 88 | ||
| 130 | #define DC_SYNC_INFO(...) \ | 89 | #define DC_SYNC_INFO(...) \ |
| 131 | dm_logger_write(dc_ctx->logger, LOG_SYNC, \ | 90 | do { \ |
| 132 | __VA_ARGS__) | 91 | (void)(dc_ctx); \ |
| 92 | DC_LOG_SYNC(__VA_ARGS__); \ | ||
| 93 | } while (0) | ||
| 133 | 94 | ||
| 134 | /* Connectivity log format: | 95 | /* Connectivity log format: |
| 135 | * [time stamp] [drm] [Major_minor] [connector name] message..... | 96 | * [time stamp] [drm] [Major_minor] [connector name] message..... |
| @@ -139,20 +100,30 @@ void context_clock_trace( | |||
| 139 | */ | 100 | */ |
| 140 | 101 | ||
| 141 | #define CONN_DATA_DETECT(link, hex_data, hex_len, ...) \ | 102 | #define CONN_DATA_DETECT(link, hex_data, hex_len, ...) \ |
| 142 | dc_conn_log(link->ctx, link, hex_data, hex_len, \ | 103 | do { \ |
| 143 | LOG_EVENT_DETECTION, ##__VA_ARGS__) | 104 | (void)(link); \ |
| 105 | dc_conn_log_hex_linux(hex_data, hex_len); \ | ||
| 106 | DC_LOG_EVENT_DETECTION(__VA_ARGS__); \ | ||
| 107 | } while (0) | ||
| 144 | 108 | ||
| 145 | #define CONN_DATA_LINK_LOSS(link, hex_data, hex_len, ...) \ | 109 | #define CONN_DATA_LINK_LOSS(link, hex_data, hex_len, ...) \ |
| 146 | dc_conn_log(link->ctx, link, hex_data, hex_len, \ | 110 | do { \ |
| 147 | LOG_EVENT_LINK_LOSS, ##__VA_ARGS__) | 111 | (void)(link); \ |
| 112 | dc_conn_log_hex_linux(hex_data, hex_len); \ | ||
| 113 | DC_LOG_EVENT_LINK_LOSS(__VA_ARGS__); \ | ||
| 114 | } while (0) | ||
| 148 | 115 | ||
| 149 | #define CONN_MSG_LT(link, ...) \ | 116 | #define CONN_MSG_LT(link, ...) \ |
| 150 | dc_conn_log(link->ctx, link, NULL, 0, \ | 117 | do { \ |
| 151 | LOG_EVENT_LINK_TRAINING, ##__VA_ARGS__) | 118 | (void)(link); \ |
| 119 | DC_LOG_EVENT_LINK_TRAINING(__VA_ARGS__); \ | ||
| 120 | } while (0) | ||
| 152 | 121 | ||
| 153 | #define CONN_MSG_MODE(link, ...) \ | 122 | #define CONN_MSG_MODE(link, ...) \ |
| 154 | dc_conn_log(link->ctx, link, NULL, 0, \ | 123 | do { \ |
| 155 | LOG_EVENT_MODE_SET, ##__VA_ARGS__) | 124 | (void)(link); \ |
| 125 | DC_LOG_EVENT_MODE_SET(__VA_ARGS__); \ | ||
| 126 | } while (0) | ||
| 156 | 127 | ||
| 157 | /* | 128 | /* |
| 158 | * Display Test Next logging | 129 | * Display Test Next logging |
| @@ -167,38 +138,21 @@ void context_clock_trace( | |||
| 167 | dm_dtn_log_end(dc_ctx) | 138 | dm_dtn_log_end(dc_ctx) |
| 168 | 139 | ||
| 169 | #define PERFORMANCE_TRACE_START() \ | 140 | #define PERFORMANCE_TRACE_START() \ |
| 170 | unsigned long long perf_trc_start_stmp = dm_get_timestamp(dc->ctx); \ | 141 | unsigned long long perf_trc_start_stmp = dm_get_timestamp(dc->ctx) |
| 171 | unsigned long long perf_trc_start_log_msk = dc->ctx->logger->mask; \ | 142 | |
| 172 | unsigned int perf_trc_start_log_flags = dc->ctx->logger->flags.value; \ | 143 | #define PERFORMANCE_TRACE_END() \ |
| 173 | if (dc->debug.performance_trace) {\ | 144 | do { \ |
| 174 | dm_logger_flush_buffer(dc->ctx->logger, false);\ | 145 | unsigned long long perf_trc_end_stmp = dm_get_timestamp(dc->ctx); \ |
| 175 | dc->ctx->logger->mask = 1<<LOG_PERF_TRACE;\ | 146 | if (dc->debug.performance_trace) { \ |
| 176 | dc->ctx->logger->flags.bits.ENABLE_CONSOLE = 0;\ | 147 | DC_LOG_PERF_TRACE("%s duration: %lld ticks\n", __func__, \ |
| 177 | dc->ctx->logger->flags.bits.ENABLE_BUFFER = 1;\ | ||
| 178 | } | ||
| 179 | |||
| 180 | #define PERFORMANCE_TRACE_END() do {\ | ||
| 181 | unsigned long long perf_trc_end_stmp = dm_get_timestamp(dc->ctx);\ | ||
| 182 | if (dc->debug.performance_trace) {\ | ||
| 183 | dm_logger_write(dc->ctx->logger, \ | ||
| 184 | LOG_PERF_TRACE, \ | ||
| 185 | "%s duration: %d ticks\n", __func__,\ | ||
| 186 | perf_trc_end_stmp - perf_trc_start_stmp); \ | 148 | perf_trc_end_stmp - perf_trc_start_stmp); \ |
| 187 | if (perf_trc_start_log_msk != 1<<LOG_PERF_TRACE) {\ | ||
| 188 | dc->ctx->logger->mask = perf_trc_start_log_msk;\ | ||
| 189 | dc->ctx->logger->flags.value = perf_trc_start_log_flags;\ | ||
| 190 | dm_logger_flush_buffer(dc->ctx->logger, false);\ | ||
| 191 | } \ | 149 | } \ |
| 192 | } \ | 150 | } while (0) |
| 193 | } while (0) | ||
| 194 | 151 | ||
| 195 | #define DISPLAY_STATS_BEGIN(entry) \ | 152 | #define DISPLAY_STATS_BEGIN(entry) (void)(entry) |
| 196 | dm_logger_open(dc->ctx->logger, &entry, LOG_DISPLAYSTATS) | ||
| 197 | 153 | ||
| 198 | #define DISPLAY_STATS(msg, ...) \ | 154 | #define DISPLAY_STATS(msg, ...) DC_LOG_PERF_TRACE(msg, __VA_ARGS__) |
| 199 | dm_logger_append(&log_entry, msg, ##__VA_ARGS__) | ||
| 200 | 155 | ||
| 201 | #define DISPLAY_STATS_END(entry) \ | 156 | #define DISPLAY_STATS_END(entry) (void)(entry) |
| 202 | dm_logger_close(&entry) | ||
| 203 | 157 | ||
| 204 | #endif /* __DAL_LOGGER_INTERFACE_H__ */ | 158 | #endif /* __DAL_LOGGER_INTERFACE_H__ */ |
diff --git a/drivers/gpu/drm/amd/display/include/logger_types.h b/drivers/gpu/drm/amd/display/include/logger_types.h index 0a540b9897a6..ad3695e67b76 100644 --- a/drivers/gpu/drm/amd/display/include/logger_types.h +++ b/drivers/gpu/drm/amd/display/include/logger_types.h | |||
| @@ -138,63 +138,4 @@ enum dc_log_type { | |||
| 138 | (1 << LOG_HW_AUDIO)| \ | 138 | (1 << LOG_HW_AUDIO)| \ |
| 139 | (1 << LOG_BANDWIDTH_CALCS)*/ | 139 | (1 << LOG_BANDWIDTH_CALCS)*/ |
| 140 | 140 | ||
| 141 | union logger_flags { | ||
| 142 | struct { | ||
| 143 | uint32_t ENABLE_CONSOLE:1; /* Print to console */ | ||
| 144 | uint32_t ENABLE_BUFFER:1; /* Print to buffer */ | ||
| 145 | uint32_t RESERVED:30; | ||
| 146 | } bits; | ||
| 147 | uint32_t value; | ||
| 148 | }; | ||
| 149 | |||
| 150 | struct log_entry { | ||
| 151 | struct dal_logger *logger; | ||
| 152 | enum dc_log_type type; | ||
| 153 | |||
| 154 | char *buf; | ||
| 155 | uint32_t buf_offset; | ||
| 156 | uint32_t max_buf_bytes; | ||
| 157 | }; | ||
| 158 | |||
| 159 | /** | ||
| 160 | * Structure for enumerating log types | ||
| 161 | */ | ||
| 162 | struct dc_log_type_info { | ||
| 163 | enum dc_log_type type; | ||
| 164 | char name[MAX_NAME_LEN]; | ||
| 165 | }; | ||
| 166 | |||
| 167 | /* Structure for keeping track of offsets, buffer, etc */ | ||
| 168 | |||
| 169 | #define DAL_LOGGER_BUFFER_MAX_SIZE 2048 | ||
| 170 | |||
| 171 | /*Connectivity log needs to output EDID, which needs at lease 256x3 bytes, | ||
| 172 | * change log line size to 896 to meet the request. | ||
| 173 | */ | ||
| 174 | #define LOG_MAX_LINE_SIZE 896 | ||
| 175 | |||
| 176 | struct dal_logger { | ||
| 177 | |||
| 178 | /* How far into the circular buffer has been read by dsat | ||
| 179 | * Read offset should never cross write offset. Write \0's to | ||
| 180 | * read data just to be sure? | ||
| 181 | */ | ||
| 182 | uint32_t buffer_read_offset; | ||
| 183 | |||
| 184 | /* How far into the circular buffer we have written | ||
| 185 | * Write offset should never cross read offset | ||
| 186 | */ | ||
| 187 | uint32_t buffer_write_offset; | ||
| 188 | |||
| 189 | uint32_t open_count; | ||
| 190 | |||
| 191 | char *log_buffer; /* Pointer to malloc'ed buffer */ | ||
| 192 | uint32_t log_buffer_size; /* Size of circular buffer */ | ||
| 193 | |||
| 194 | uint32_t mask; /*array of masks for major elements*/ | ||
| 195 | |||
| 196 | union logger_flags flags; | ||
| 197 | struct dc_context *ctx; | ||
| 198 | }; | ||
| 199 | |||
| 200 | #endif /* __DAL_LOGGER_TYPES_H__ */ | 141 | #endif /* __DAL_LOGGER_TYPES_H__ */ |
