Commit e1cb3e48 authored by Nicholas Kazlauskas's avatar Nicholas Kazlauskas Committed by Alex Deucher

drm/amd/display: Convert remaining loggers off dc_logger

- Removed dal/dm/dc loggers from linux, switched to kernel prints
- Modified functions that used these directly to use macros
- dc_logger support is completely dropped from Linux
Signed-off-by: default avatarNicholas Kazlauskas <nicholas.kazlauskas@amd.com>
Reviewed-by: default avatarHarry Wentland <Harry.Wentland@amd.com>
Signed-off-by: default avatarAlex Deucher <alexander.deucher@amd.com>
parent 084b3765
...@@ -97,10 +97,10 @@ share it with drivers. But that's a very long term goal, and by far not just an ...@@ -97,10 +97,10 @@ share it with drivers. But that's a very long term goal, and by far not just an
issue with DC - other drivers, especially around DP sink handling, are equally issue with DC - other drivers, especially around DP sink handling, are equally
guilty. guilty.
19. The DC logger is still a rather sore thing, but I know that the DRM_DEBUG 19. DONE - The DC logger is still a rather sore thing, but I know that the
stuff just isn't up to the challenges either. We need to figure out something DRM_DEBUG stuff just isn't up to the challenges either. We need to figure out
that integrates better with DRM and linux debug printing, while not being something that integrates better with DRM and linux debug printing, while not
useless with filtering output. dynamic debug printing might be an option. being useless with filtering output. dynamic debug printing might be an option.
20. Use kernel i2c device to program HDMI retimer. Some boards have an HDMI 20. Use kernel i2c device to program HDMI retimer. Some boards have an HDMI
retimer that we need to program to pass PHY compliance. Currently that's retimer that we need to program to pass PHY compliance. Currently that's
......
...@@ -25,7 +25,7 @@ ...@@ -25,7 +25,7 @@
# subcomponents. # subcomponents.
BASICS = conversion.o fixpt31_32.o \ BASICS = conversion.o fixpt31_32.o \
logger.o log_helpers.o vector.o log_helpers.o vector.o
AMD_DAL_BASICS = $(addprefix $(AMDDALPATH)/dc/basics/,$(BASICS)) AMD_DAL_BASICS = $(addprefix $(AMDDALPATH)/dc/basics/,$(BASICS))
......
...@@ -28,77 +28,12 @@ ...@@ -28,77 +28,12 @@
#include "include/logger_interface.h" #include "include/logger_interface.h"
#include "dm_helpers.h" #include "dm_helpers.h"
#define NUM_ELEMENTS(a) (sizeof(a) / sizeof((a)[0])) void dc_conn_log_hex_linux(const uint8_t *hex_data, int hex_data_count)
struct dc_signal_type_info {
enum signal_type type;
char name[MAX_NAME_LEN];
};
static const struct dc_signal_type_info signal_type_info_tbl[] = {
{SIGNAL_TYPE_NONE, "NC"},
{SIGNAL_TYPE_DVI_SINGLE_LINK, "DVI"},
{SIGNAL_TYPE_DVI_DUAL_LINK, "DDVI"},
{SIGNAL_TYPE_HDMI_TYPE_A, "HDMIA"},
{SIGNAL_TYPE_LVDS, "LVDS"},
{SIGNAL_TYPE_RGB, "VGA"},
{SIGNAL_TYPE_DISPLAY_PORT, "DP"},
{SIGNAL_TYPE_DISPLAY_PORT_MST, "MST"},
{SIGNAL_TYPE_EDP, "eDP"},
{SIGNAL_TYPE_VIRTUAL, "Virtual"}
};
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,
...)
{ {
int i; int i;
va_list args;
struct log_entry entry = { 0 };
enum signal_type signal;
if (link->local_sink)
signal = link->local_sink->sink_signal;
else
signal = link->connector_signal;
if (link->type == dc_connection_mst_branch)
signal = SIGNAL_TYPE_DISPLAY_PORT_MST;
dm_logger_open(ctx->logger, &entry, event);
for (i = 0; i < NUM_ELEMENTS(signal_type_info_tbl); i++)
if (signal == signal_type_info_tbl[i].type)
break;
if (i == NUM_ELEMENTS(signal_type_info_tbl))
goto fail;
dm_logger_append_heading(&entry);
dm_logger_append(&entry, "[%s][ConnIdx:%d] ",
signal_type_info_tbl[i].name,
link->link_index);
va_start(args, msg);
dm_logger_append_va(&entry, msg, args);
if (entry.buf_offset > 0 &&
entry.buf[entry.buf_offset - 1] == '\n')
entry.buf_offset--;
if (hex_data) if (hex_data)
for (i = 0; i < hex_data_count; i++) for (i = 0; i < hex_data_count; i++)
dm_logger_append(&entry, "%2.2X ", hex_data[i]); DC_LOG_DEBUG("%2.2X ", hex_data[i]);
dm_logger_append(&entry, "^\n");
fail:
dm_logger_close(&entry);
va_end(args);
} }
This diff is collapsed.
...@@ -25,10 +25,9 @@ ...@@ -25,10 +25,9 @@
#ifndef _CALCS_CALCS_LOGGER_H_ #ifndef _CALCS_CALCS_LOGGER_H_
#define _CALCS_CALCS_LOGGER_H_ #define _CALCS_CALCS_LOGGER_H_
#define DC_LOGGER \ #define DC_LOGGER ctx->logger
logger
static void print_bw_calcs_dceip(struct dal_logger *logger, const struct bw_calcs_dceip *dceip) static void print_bw_calcs_dceip(struct dc_context *ctx, const struct bw_calcs_dceip *dceip)
{ {
DC_LOG_BANDWIDTH_CALCS("#####################################################################"); DC_LOG_BANDWIDTH_CALCS("#####################################################################");
...@@ -122,7 +121,7 @@ static void print_bw_calcs_dceip(struct dal_logger *logger, const struct bw_calc ...@@ -122,7 +121,7 @@ static void print_bw_calcs_dceip(struct dal_logger *logger, const struct bw_calc
} }
static void print_bw_calcs_vbios(struct dal_logger *logger, const struct bw_calcs_vbios *vbios) static void print_bw_calcs_vbios(struct dc_context *ctx, const struct bw_calcs_vbios *vbios)
{ {
DC_LOG_BANDWIDTH_CALCS("#####################################################################"); DC_LOG_BANDWIDTH_CALCS("#####################################################################");
...@@ -181,7 +180,7 @@ static void print_bw_calcs_vbios(struct dal_logger *logger, const struct bw_calc ...@@ -181,7 +180,7 @@ static void print_bw_calcs_vbios(struct dal_logger *logger, const struct bw_calc
} }
static void print_bw_calcs_data(struct dal_logger *logger, struct bw_calcs_data *data) static void print_bw_calcs_data(struct dc_context *ctx, struct bw_calcs_data *data)
{ {
int i, j, k; int i, j, k;
......
...@@ -3010,9 +3010,9 @@ bool bw_calcs(struct dc_context *ctx, ...@@ -3010,9 +3010,9 @@ bool bw_calcs(struct dc_context *ctx,
struct bw_fixed low_yclk = vbios->low_yclk; struct bw_fixed low_yclk = vbios->low_yclk;
if (ctx->dc->debug.bandwidth_calcs_trace) { if (ctx->dc->debug.bandwidth_calcs_trace) {
print_bw_calcs_dceip(ctx->logger, dceip); print_bw_calcs_dceip(ctx, dceip);
print_bw_calcs_vbios(ctx->logger, vbios); print_bw_calcs_vbios(ctx, vbios);
print_bw_calcs_data(ctx->logger, data); print_bw_calcs_data(ctx, data);
} }
calculate_bandwidth(dceip, vbios, data); calculate_bandwidth(dceip, vbios, data);
......
...@@ -467,9 +467,6 @@ static void destruct(struct dc *dc) ...@@ -467,9 +467,6 @@ static void destruct(struct dc *dc)
if (dc->ctx->created_bios) if (dc->ctx->created_bios)
dal_bios_parser_destroy(&dc->ctx->dc_bios); dal_bios_parser_destroy(&dc->ctx->dc_bios);
if (dc->ctx->logger)
dal_logger_destroy(&dc->ctx->logger);
kfree(dc->ctx); kfree(dc->ctx);
dc->ctx = NULL; dc->ctx = NULL;
...@@ -492,7 +489,6 @@ static void destruct(struct dc *dc) ...@@ -492,7 +489,6 @@ static void destruct(struct dc *dc)
static bool construct(struct dc *dc, static bool construct(struct dc *dc,
const struct dc_init_data *init_params) const struct dc_init_data *init_params)
{ {
struct dal_logger *logger;
struct dc_context *dc_ctx; struct dc_context *dc_ctx;
struct bw_calcs_dceip *dc_dceip; struct bw_calcs_dceip *dc_dceip;
struct bw_calcs_vbios *dc_vbios; struct bw_calcs_vbios *dc_vbios;
...@@ -557,14 +553,7 @@ static bool construct(struct dc *dc, ...@@ -557,14 +553,7 @@ static bool construct(struct dc *dc,
} }
/* Create logger */ /* Create logger */
logger = dal_logger_create(dc_ctx, init_params->log_mask);
if (!logger) {
/* can *not* call logger. call base driver 'print error' */
dm_error("%s: failed to create Logger!\n", __func__);
goto fail;
}
dc_ctx->logger = logger;
dc_ctx->dce_environment = init_params->dce_environment; dc_ctx->dce_environment = init_params->dce_environment;
dc_version = resource_parse_asic_id(init_params->asic_id); dc_version = resource_parse_asic_id(init_params->asic_id);
...@@ -983,9 +972,7 @@ bool dc_commit_state(struct dc *dc, struct dc_state *context) ...@@ -983,9 +972,7 @@ bool dc_commit_state(struct dc *dc, struct dc_state *context)
for (i = 0; i < context->stream_count; i++) { for (i = 0; i < context->stream_count; i++) {
struct dc_stream_state *stream = context->streams[i]; struct dc_stream_state *stream = context->streams[i];
dc_stream_log(stream, dc_stream_log(dc, stream);
dc->ctx->logger,
LOG_DC);
} }
result = dc_commit_state_no_check(dc, context); result = dc_commit_state_no_check(dc, context);
......
...@@ -30,6 +30,8 @@ ...@@ -30,6 +30,8 @@
#include "ipp.h" #include "ipp.h"
#include "timing_generator.h" #include "timing_generator.h"
#define DC_LOGGER dc->ctx->logger
/******************************************************************************* /*******************************************************************************
* Private functions * Private functions
******************************************************************************/ ******************************************************************************/
...@@ -317,16 +319,10 @@ bool dc_stream_get_scanoutpos(const struct dc_stream_state *stream, ...@@ -317,16 +319,10 @@ bool dc_stream_get_scanoutpos(const struct dc_stream_state *stream,
return ret; return ret;
} }
void dc_stream_log(const struct dc *dc, const struct dc_stream_state *stream)
void dc_stream_log(
const struct dc_stream_state *stream,
struct dal_logger *dm_logger,
enum dc_log_type log_type)
{ {
DC_LOG_DC(
dm_logger_write(dm_logger, "core_stream 0x%p: src: %d, %d, %d, %d; dst: %d, %d, %d, %d, colorSpace:%d\n",
log_type,
"core_stream 0x%x: src: %d, %d, %d, %d; dst: %d, %d, %d, %d, colorSpace:%d\n",
stream, stream,
stream->src.x, stream->src.x,
stream->src.y, stream->src.y,
...@@ -337,21 +333,18 @@ void dc_stream_log( ...@@ -337,21 +333,18 @@ void dc_stream_log(
stream->dst.width, stream->dst.width,
stream->dst.height, stream->dst.height,
stream->output_color_space); stream->output_color_space);
dm_logger_write(dm_logger, DC_LOG_DC(
log_type,
"\tpix_clk_khz: %d, h_total: %d, v_total: %d, pixelencoder:%d, displaycolorDepth:%d\n", "\tpix_clk_khz: %d, h_total: %d, v_total: %d, pixelencoder:%d, displaycolorDepth:%d\n",
stream->timing.pix_clk_khz, stream->timing.pix_clk_khz,
stream->timing.h_total, stream->timing.h_total,
stream->timing.v_total, stream->timing.v_total,
stream->timing.pixel_encoding, stream->timing.pixel_encoding,
stream->timing.display_color_depth); stream->timing.display_color_depth);
dm_logger_write(dm_logger, DC_LOG_DC(
log_type,
"\tsink name: %s, serial: %d\n", "\tsink name: %s, serial: %d\n",
stream->sink->edid_caps.display_name, stream->sink->edid_caps.display_name,
stream->sink->edid_caps.serial_number); stream->sink->edid_caps.serial_number);
dm_logger_write(dm_logger, DC_LOG_DC(
log_type,
"\tlink: %d\n", "\tlink: %d\n",
stream->sink->link->link_index); stream->sink->link->link_index);
} }
...@@ -147,10 +147,7 @@ void dc_commit_updates_for_stream(struct dc *dc, ...@@ -147,10 +147,7 @@ void dc_commit_updates_for_stream(struct dc *dc,
/* /*
* Log the current stream state. * Log the current stream state.
*/ */
void dc_stream_log( void dc_stream_log(const struct dc *dc, const struct dc_stream_state *stream);
const struct dc_stream_state *stream,
struct dal_logger *dc_logger,
enum dc_log_type log_type);
uint8_t dc_get_current_stream_count(struct dc *dc); uint8_t dc_get_current_stream_count(struct dc *dc);
struct dc_stream_state *dc_get_stream_at_index(struct dc *dc, uint8_t i); struct dc_stream_state *dc_get_stream_at_index(struct dc *dc, uint8_t i);
......
...@@ -77,8 +77,6 @@ struct dc_context { ...@@ -77,8 +77,6 @@ struct dc_context {
struct dc *dc; struct dc *dc;
void *driver_context; /* e.g. amdgpu_device */ void *driver_context; /* e.g. amdgpu_device */
struct dal_logger *logger;
void *cgs_device; void *cgs_device;
enum dce_environment dce_environment; enum dce_environment dce_environment;
......
...@@ -794,43 +794,38 @@ static bool dce110_validate_bandwidth( ...@@ -794,43 +794,38 @@ static bool dce110_validate_bandwidth(
if (memcmp(&dc->current_state->bw.dce, if (memcmp(&dc->current_state->bw.dce,
&context->bw.dce, sizeof(context->bw.dce))) { &context->bw.dce, sizeof(context->bw.dce))) {
struct log_entry log_entry;
dm_logger_open( DC_LOG_BANDWIDTH_CALCS(
dc->ctx->logger, "%s: finish,\n"
&log_entry, "nbpMark_b: %d nbpMark_a: %d urgentMark_b: %d urgentMark_a: %d\n"
LOG_BANDWIDTH_CALCS); "stutMark_b: %d stutMark_a: %d\n"
dm_logger_append(&log_entry, "%s: finish,\n"
"nbpMark_b: %d nbpMark_a: %d urgentMark_b: %d urgentMark_a: %d\n" "nbpMark_b: %d nbpMark_a: %d urgentMark_b: %d urgentMark_a: %d\n"
"stutMark_b: %d stutMark_a: %d\n", "stutMark_b: %d stutMark_a: %d\n"
"nbpMark_b: %d nbpMark_a: %d urgentMark_b: %d urgentMark_a: %d\n"
"stutMark_b: %d stutMark_a: %d stutter_mode_enable: %d\n"
"cstate: %d pstate: %d nbpstate: %d sync: %d dispclk: %d\n"
"sclk: %d sclk_sleep: %d yclk: %d blackout_recovery_time_us: %d\n"
,
__func__, __func__,
context->bw.dce.nbp_state_change_wm_ns[0].b_mark, context->bw.dce.nbp_state_change_wm_ns[0].b_mark,
context->bw.dce.nbp_state_change_wm_ns[0].a_mark, context->bw.dce.nbp_state_change_wm_ns[0].a_mark,
context->bw.dce.urgent_wm_ns[0].b_mark, context->bw.dce.urgent_wm_ns[0].b_mark,
context->bw.dce.urgent_wm_ns[0].a_mark, context->bw.dce.urgent_wm_ns[0].a_mark,
context->bw.dce.stutter_exit_wm_ns[0].b_mark, context->bw.dce.stutter_exit_wm_ns[0].b_mark,
context->bw.dce.stutter_exit_wm_ns[0].a_mark); context->bw.dce.stutter_exit_wm_ns[0].a_mark,
dm_logger_append(&log_entry,
"nbpMark_b: %d nbpMark_a: %d urgentMark_b: %d urgentMark_a: %d\n"
"stutMark_b: %d stutMark_a: %d\n",
context->bw.dce.nbp_state_change_wm_ns[1].b_mark, context->bw.dce.nbp_state_change_wm_ns[1].b_mark,
context->bw.dce.nbp_state_change_wm_ns[1].a_mark, context->bw.dce.nbp_state_change_wm_ns[1].a_mark,
context->bw.dce.urgent_wm_ns[1].b_mark, context->bw.dce.urgent_wm_ns[1].b_mark,
context->bw.dce.urgent_wm_ns[1].a_mark, context->bw.dce.urgent_wm_ns[1].a_mark,
context->bw.dce.stutter_exit_wm_ns[1].b_mark, context->bw.dce.stutter_exit_wm_ns[1].b_mark,
context->bw.dce.stutter_exit_wm_ns[1].a_mark); context->bw.dce.stutter_exit_wm_ns[1].a_mark,
dm_logger_append(&log_entry,
"nbpMark_b: %d nbpMark_a: %d urgentMark_b: %d urgentMark_a: %d\n"
"stutMark_b: %d stutMark_a: %d stutter_mode_enable: %d\n",
context->bw.dce.nbp_state_change_wm_ns[2].b_mark, context->bw.dce.nbp_state_change_wm_ns[2].b_mark,
context->bw.dce.nbp_state_change_wm_ns[2].a_mark, context->bw.dce.nbp_state_change_wm_ns[2].a_mark,
context->bw.dce.urgent_wm_ns[2].b_mark, context->bw.dce.urgent_wm_ns[2].b_mark,
context->bw.dce.urgent_wm_ns[2].a_mark, context->bw.dce.urgent_wm_ns[2].a_mark,
context->bw.dce.stutter_exit_wm_ns[2].b_mark, context->bw.dce.stutter_exit_wm_ns[2].b_mark,
context->bw.dce.stutter_exit_wm_ns[2].a_mark, context->bw.dce.stutter_exit_wm_ns[2].a_mark,
context->bw.dce.stutter_mode_enable); context->bw.dce.stutter_mode_enable,
dm_logger_append(&log_entry,
"cstate: %d pstate: %d nbpstate: %d sync: %d dispclk: %d\n"
"sclk: %d sclk_sleep: %d yclk: %d blackout_recovery_time_us: %d\n",
context->bw.dce.cpuc_state_change_enable, context->bw.dce.cpuc_state_change_enable,
context->bw.dce.cpup_state_change_enable, context->bw.dce.cpup_state_change_enable,
context->bw.dce.nbp_state_change_enable, context->bw.dce.nbp_state_change_enable,
...@@ -840,7 +835,6 @@ static bool dce110_validate_bandwidth( ...@@ -840,7 +835,6 @@ static bool dce110_validate_bandwidth(
context->bw.dce.sclk_deep_sleep_khz, context->bw.dce.sclk_deep_sleep_khz,
context->bw.dce.yclk_khz, context->bw.dce.yclk_khz,
context->bw.dce.blackout_recovery_time_us); context->bw.dce.blackout_recovery_time_us);
dm_logger_close(&log_entry);
} }
return result; return result;
} }
......
...@@ -744,43 +744,38 @@ bool dce112_validate_bandwidth( ...@@ -744,43 +744,38 @@ bool dce112_validate_bandwidth(
if (memcmp(&dc->current_state->bw.dce, if (memcmp(&dc->current_state->bw.dce,
&context->bw.dce, sizeof(context->bw.dce))) { &context->bw.dce, sizeof(context->bw.dce))) {
struct log_entry log_entry;
dm_logger_open( DC_LOG_BANDWIDTH_CALCS(
dc->ctx->logger, "%s: finish,\n"
&log_entry, "nbpMark_b: %d nbpMark_a: %d urgentMark_b: %d urgentMark_a: %d\n"
LOG_BANDWIDTH_CALCS); "stutMark_b: %d stutMark_a: %d\n"
dm_logger_append(&log_entry, "%s: finish,\n"
"nbpMark_b: %d nbpMark_a: %d urgentMark_b: %d urgentMark_a: %d\n" "nbpMark_b: %d nbpMark_a: %d urgentMark_b: %d urgentMark_a: %d\n"
"stutMark_b: %d stutMark_a: %d\n", "stutMark_b: %d stutMark_a: %d\n"
"nbpMark_b: %d nbpMark_a: %d urgentMark_b: %d urgentMark_a: %d\n"
"stutMark_b: %d stutMark_a: %d stutter_mode_enable: %d\n"
"cstate: %d pstate: %d nbpstate: %d sync: %d dispclk: %d\n"
"sclk: %d sclk_sleep: %d yclk: %d blackout_recovery_time_us: %d\n"
,
__func__, __func__,
context->bw.dce.nbp_state_change_wm_ns[0].b_mark, context->bw.dce.nbp_state_change_wm_ns[0].b_mark,
context->bw.dce.nbp_state_change_wm_ns[0].a_mark, context->bw.dce.nbp_state_change_wm_ns[0].a_mark,
context->bw.dce.urgent_wm_ns[0].b_mark, context->bw.dce.urgent_wm_ns[0].b_mark,
context->bw.dce.urgent_wm_ns[0].a_mark, context->bw.dce.urgent_wm_ns[0].a_mark,
context->bw.dce.stutter_exit_wm_ns[0].b_mark, context->bw.dce.stutter_exit_wm_ns[0].b_mark,
context->bw.dce.stutter_exit_wm_ns[0].a_mark); context->bw.dce.stutter_exit_wm_ns[0].a_mark,
dm_logger_append(&log_entry,
"nbpMark_b: %d nbpMark_a: %d urgentMark_b: %d urgentMark_a: %d\n"
"stutMark_b: %d stutMark_a: %d\n",
context->bw.dce.nbp_state_change_wm_ns[1].b_mark, context->bw.dce.nbp_state_change_wm_ns[1].b_mark,
context->bw.dce.nbp_state_change_wm_ns[1].a_mark, context->bw.dce.nbp_state_change_wm_ns[1].a_mark,
context->bw.dce.urgent_wm_ns[1].b_mark, context->bw.dce.urgent_wm_ns[1].b_mark,
context->bw.dce.urgent_wm_ns[1].a_mark, context->bw.dce.urgent_wm_ns[1].a_mark,
context->bw.dce.stutter_exit_wm_ns[1].b_mark, context->bw.dce.stutter_exit_wm_ns[1].b_mark,
context->bw.dce.stutter_exit_wm_ns[1].a_mark); context->bw.dce.stutter_exit_wm_ns[1].a_mark,
dm_logger_append(&log_entry,
"nbpMark_b: %d nbpMark_a: %d urgentMark_b: %d urgentMark_a: %d\n"
"stutMark_b: %d stutMark_a: %d stutter_mode_enable: %d\n",
context->bw.dce.nbp_state_change_wm_ns[2].b_mark, context->bw.dce.nbp_state_change_wm_ns[2].b_mark,
context->bw.dce.nbp_state_change_wm_ns[2].a_mark, context->bw.dce.nbp_state_change_wm_ns[2].a_mark,
context->bw.dce.urgent_wm_ns[2].b_mark, context->bw.dce.urgent_wm_ns[2].b_mark,
context->bw.dce.urgent_wm_ns[2].a_mark, context->bw.dce.urgent_wm_ns[2].a_mark,
context->bw.dce.stutter_exit_wm_ns[2].b_mark, context->bw.dce.stutter_exit_wm_ns[2].b_mark,
context->bw.dce.stutter_exit_wm_ns[2].a_mark, context->bw.dce.stutter_exit_wm_ns[2].a_mark,
context->bw.dce.stutter_mode_enable); context->bw.dce.stutter_mode_enable,
dm_logger_append(&log_entry,
"cstate: %d pstate: %d nbpstate: %d sync: %d dispclk: %d\n"
"sclk: %d sclk_sleep: %d yclk: %d blackout_recovery_time_us: %d\n",
context->bw.dce.cpuc_state_change_enable, context->bw.dce.cpuc_state_change_enable,
context->bw.dce.cpup_state_change_enable, context->bw.dce.cpup_state_change_enable,
context->bw.dce.nbp_state_change_enable, context->bw.dce.nbp_state_change_enable,
...@@ -790,7 +785,6 @@ bool dce112_validate_bandwidth( ...@@ -790,7 +785,6 @@ bool dce112_validate_bandwidth(
context->bw.dce.sclk_deep_sleep_khz, context->bw.dce.sclk_deep_sleep_khz,
context->bw.dce.yclk_khz, context->bw.dce.yclk_khz,
context->bw.dce.blackout_recovery_time_us); context->bw.dce.blackout_recovery_time_us);
dm_logger_close(&log_entry);
} }
return result; return result;
} }
......
...@@ -40,49 +40,7 @@ struct dc_state; ...@@ -40,49 +40,7 @@ struct dc_state;
* *
*/ */
struct dal_logger *dal_logger_create(struct dc_context *ctx, uint32_t log_mask); void dc_conn_log_hex_linux(const uint8_t *hex_data, int hex_data_count);
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_append_heading(struct log_entry *entry);
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( void pre_surface_trace(
struct dc *dc, struct dc *dc,
...@@ -108,28 +66,31 @@ void context_clock_trace( ...@@ -108,28 +66,31 @@ void context_clock_trace(
* marked by this macro. * marked by this macro.
* Note that the message will be printed exactly once for every function * Note that the message will be printed exactly once for every function
* it is used in order to avoid repeating of the same message. */ * it is used in order to avoid repeating of the same message. */
#define DAL_LOGGER_NOT_IMPL(fmt, ...) \ #define DAL_LOGGER_NOT_IMPL(fmt, ...) \
{ \ do { \
static bool print_not_impl = true; \ static bool print_not_impl = true; \
\ if (print_not_impl == true) { \
if (print_not_impl == true) { \ print_not_impl = false; \
print_not_impl = false; \ DRM_WARN("DAL_NOT_IMPL: " fmt, ##__VA_ARGS__); \
dm_logger_write(ctx->logger, LOG_WARNING, \ } \
"DAL_NOT_IMPL: " fmt, ##__VA_ARGS__); \ } while (0)
} \
}
/****************************************************************************** /******************************************************************************
* Convenience macros to save on typing. * Convenience macros to save on typing.
*****************************************************************************/ *****************************************************************************/
#define DC_ERROR(...) \ #define DC_ERROR(...) \
dm_logger_write(dc_ctx->logger, LOG_ERROR, \ do { \
__VA_ARGS__) (void)(dc_ctx); \
DC_LOG_ERROR(__VA_ARGS__); \
} while (0)
#define DC_SYNC_INFO(...) \ #define DC_SYNC_INFO(...) \
dm_logger_write(dc_ctx->logger, LOG_SYNC, \ do { \
__VA_ARGS__) (void)(dc_ctx); \
DC_LOG_SYNC(__VA_ARGS__); \
} while (0)
/* Connectivity log format: /* Connectivity log format:
* [time stamp] [drm] [Major_minor] [connector name] message..... * [time stamp] [drm] [Major_minor] [connector name] message.....
...@@ -139,20 +100,30 @@ void context_clock_trace( ...@@ -139,20 +100,30 @@ void context_clock_trace(
*/ */
#define CONN_DATA_DETECT(link, hex_data, hex_len, ...) \ #define CONN_DATA_DETECT(link, hex_data, hex_len, ...) \
dc_conn_log(link->ctx, link, hex_data, hex_len, \ do { \
LOG_EVENT_DETECTION, ##__VA_ARGS__) (void)(link); \
dc_conn_log_hex_linux(hex_data, hex_len); \
DC_LOG_EVENT_DETECTION(__VA_ARGS__); \
} while (0)
#define CONN_DATA_LINK_LOSS(link, hex_data, hex_len, ...) \ #define CONN_DATA_LINK_LOSS(link, hex_data, hex_len, ...) \
dc_conn_log(link->ctx, link, hex_data, hex_len, \ do { \
LOG_EVENT_LINK_LOSS, ##__VA_ARGS__) (void)(link); \
dc_conn_log_hex_linux(hex_data, hex_len); \
DC_LOG_EVENT_LINK_LOSS(__VA_ARGS__); \
} while (0)
#define CONN_MSG_LT(link, ...) \ #define CONN_MSG_LT(link, ...) \
dc_conn_log(link->ctx, link, NULL, 0, \ do { \
LOG_EVENT_LINK_TRAINING, ##__VA_ARGS__) (void)(link); \
DC_LOG_EVENT_LINK_TRAINING(__VA_ARGS__); \
} while (0)
#define CONN_MSG_MODE(link, ...) \ #define CONN_MSG_MODE(link, ...) \
dc_conn_log(link->ctx, link, NULL, 0, \ do { \
LOG_EVENT_MODE_SET, ##__VA_ARGS__) (void)(link); \
DC_LOG_EVENT_MODE_SET(__VA_ARGS__); \
} while (0)
/* /*
* Display Test Next logging * Display Test Next logging
...@@ -167,38 +138,21 @@ void context_clock_trace( ...@@ -167,38 +138,21 @@ void context_clock_trace(
dm_dtn_log_end(dc_ctx) dm_dtn_log_end(dc_ctx)
#define PERFORMANCE_TRACE_START() \ #define PERFORMANCE_TRACE_START() \
unsigned long long perf_trc_start_stmp = dm_get_timestamp(dc->ctx); \ 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; \ #define PERFORMANCE_TRACE_END() \
if (dc->debug.performance_trace) {\ do { \
dm_logger_flush_buffer(dc->ctx->logger, false);\ unsigned long long perf_trc_end_stmp = dm_get_timestamp(dc->ctx); \
dc->ctx->logger->mask = 1<<LOG_PERF_TRACE;\ if (dc->debug.performance_trace) { \
dc->ctx->logger->flags.bits.ENABLE_CONSOLE = 0;\ DC_LOG_PERF_TRACE("%s duration: %lld ticks\n", __func__, \
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); \ 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)
} while (0)
#define DISPLAY_STATS_BEGIN(entry) \ #define DISPLAY_STATS_BEGIN(entry) (void)(entry)
dm_logger_open(dc->ctx->logger, &entry, LOG_DISPLAYSTATS)
#define DISPLAY_STATS(msg, ...) \ #define DISPLAY_STATS(msg, ...) DC_LOG_PERF_TRACE(msg, __VA_ARGS__)
dm_logger_append(&log_entry, msg, ##__VA_ARGS__)
#define DISPLAY_STATS_END(entry) \ #define DISPLAY_STATS_END(entry) (void)(entry)
dm_logger_close(&entry)
#endif /* __DAL_LOGGER_INTERFACE_H__ */ #endif /* __DAL_LOGGER_INTERFACE_H__ */
...@@ -138,63 +138,4 @@ enum dc_log_type { ...@@ -138,63 +138,4 @@ enum dc_log_type {
(1 << LOG_HW_AUDIO)| \ (1 << LOG_HW_AUDIO)| \
(1 << LOG_BANDWIDTH_CALCS)*/ (1 << LOG_BANDWIDTH_CALCS)*/
union logger_flags {
struct {
uint32_t ENABLE_CONSOLE:1; /* Print to console */
uint32_t ENABLE_BUFFER:1; /* Print to buffer */
uint32_t RESERVED:30;
} bits;
uint32_t value;
};
struct log_entry {
struct dal_logger *logger;
enum dc_log_type type;
char *buf;
uint32_t buf_offset;
uint32_t max_buf_bytes;
};
/**
* Structure for enumerating log types
*/
struct dc_log_type_info {
enum dc_log_type type;
char name[MAX_NAME_LEN];
};
/* Structure for keeping track of offsets, buffer, etc */
#define DAL_LOGGER_BUFFER_MAX_SIZE 2048
/*Connectivity log needs to output EDID, which needs at lease 256x3 bytes,
* change log line size to 896 to meet the request.
*/
#define LOG_MAX_LINE_SIZE 896
struct dal_logger {
/* How far into the circular buffer has been read by dsat
* Read offset should never cross write offset. Write \0's to
* read data just to be sure?
*/
uint32_t buffer_read_offset;
/* How far into the circular buffer we have written
* Write offset should never cross read offset
*/
uint32_t buffer_write_offset;
uint32_t open_count;
char *log_buffer; /* Pointer to malloc'ed buffer */
uint32_t log_buffer_size; /* Size of circular buffer */
uint32_t mask; /*array of masks for major elements*/
union logger_flags flags;
struct dc_context *ctx;
};
#endif /* __DAL_LOGGER_TYPES_H__ */ #endif /* __DAL_LOGGER_TYPES_H__ */
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment