Skip to content

Commit

Permalink
drm/amd/display: Update VCP X.Y logging to improve usefulness
Browse files Browse the repository at this point in the history
[Why]
Recently debugging efforts have involved setting/checking the
X.Y value used during payload allocation. Current output for
Y was calculated with incorrect bitshift. Y value is also not
human readable.

[How]
Refactor logging into separate function. Fix Y calculation error
and format output to be human readable.

Reviewed-by: Wenjing Liu <wenjing.liu@amd.com>
Acked-by: Anson Jacob <Anson.Jacob@amd.com>
Signed-off-by: George Shen <george.shen@amd.com>
Tested-by: Daniel Wheeler <daniel.wheeler@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
  • Loading branch information
George Shen authored and Alex Deucher committed Sep 29, 2021
1 parent 3626a6a commit 356af2f
Showing 1 changed file with 25 additions and 24 deletions.
49 changes: 25 additions & 24 deletions drivers/gpu/drm/amd/display/dc/core/dc_link.c
Original file line number Diff line number Diff line change
Expand Up @@ -3197,6 +3197,29 @@ static void update_mst_stream_alloc_table(
work_table[i];
}
#if defined(CONFIG_DRM_AMD_DC_DCN)
static void dc_log_vcp_x_y(const struct dc_link *link, struct fixed31_32 avg_time_slots_per_mtp)
{
const uint32_t VCP_Y_PRECISION = 1000;
uint64_t vcp_x, vcp_y;

// Add 0.5*(1/VCP_Y_PRECISION) to round up to decimal precision
avg_time_slots_per_mtp = dc_fixpt_add(
avg_time_slots_per_mtp, dc_fixpt_from_fraction(1, 2 * VCP_Y_PRECISION));

vcp_x = dc_fixpt_floor(avg_time_slots_per_mtp);
vcp_y = dc_fixpt_floor(
dc_fixpt_mul_int(
dc_fixpt_sub_int(avg_time_slots_per_mtp, dc_fixpt_floor(avg_time_slots_per_mtp)),
VCP_Y_PRECISION));

if (link->type == dc_connection_mst_branch)
DC_LOG_DP2("MST Update Payload: set_throttled_vcp_size slot X.Y for MST stream "
"X: %lld Y: %lld/%d", vcp_x, vcp_y, VCP_Y_PRECISION);
else
DC_LOG_DP2("SST Update Payload: set_throttled_vcp_size slot X.Y for SST stream "
"X: %lld Y: %lld/%d", vcp_x, vcp_y, VCP_Y_PRECISION);
}

/*
* Payload allocation/deallocation for SST introduced in DP2.0
*/
Expand All @@ -3214,18 +3237,7 @@ enum dc_status dc_link_update_sst_payload(struct pipe_ctx *pipe_ctx, bool alloca
if (!allocate) {
avg_time_slots_per_mtp = dc_fixpt_from_int(0);

DC_LOG_DP2("SST Update Payload: set_throttled_vcp_size slot X.Y for SST stream"
"X: %d "
"Y: %d",
dc_fixpt_floor(
avg_time_slots_per_mtp),
dc_fixpt_ceil(
dc_fixpt_shl(
dc_fixpt_sub_int(
avg_time_slots_per_mtp,
dc_fixpt_floor(
avg_time_slots_per_mtp)),
26)));
dc_log_vcp_x_y(link, avg_time_slots_per_mtp);

hpo_dp_link_encoder->funcs->set_throttled_vcp_size(
hpo_dp_link_encoder,
Expand Down Expand Up @@ -3272,18 +3284,7 @@ enum dc_status dc_link_update_sst_payload(struct pipe_ctx *pipe_ctx, bool alloca
if (allocate) {
avg_time_slots_per_mtp = calculate_sst_avg_time_slots_per_mtp(stream, link);

DC_LOG_DP2("SST Update Payload: "
"slot.X: %d "
"slot.Y: %d",
dc_fixpt_floor(
avg_time_slots_per_mtp),
dc_fixpt_ceil(
dc_fixpt_shl(
dc_fixpt_sub_int(
avg_time_slots_per_mtp,
dc_fixpt_floor(
avg_time_slots_per_mtp)),
26)));
dc_log_vcp_x_y(link, avg_time_slots_per_mtp);

hpo_dp_link_encoder->funcs->set_throttled_vcp_size(
hpo_dp_link_encoder,
Expand Down

0 comments on commit 356af2f

Please sign in to comment.