diff options
author | George Shen <[email protected]> | 2021-09-16 19:59:34 -0400 |
---|---|---|
committer | Alex Deucher <[email protected]> | 2021-09-29 17:30:00 -0400 |
commit | 356af2f32f443b89ac2ebb033f325c9dd93884e9 (patch) | |
tree | 146add4687fac61e81e7df74b2d5d6285658a8d8 | |
parent | 3626a6aebe62ce7067cdc460c0c644e9445386bb (diff) |
drm/amd/display: Update VCP X.Y logging to improve usefulness
[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 <[email protected]>
Acked-by: Anson Jacob <[email protected]>
Signed-off-by: George Shen <[email protected]>
Tested-by: Daniel Wheeler <[email protected]>
Signed-off-by: Alex Deucher <[email protected]>
-rw-r--r-- | drivers/gpu/drm/amd/display/dc/core/dc_link.c | 49 |
1 files changed, 25 insertions, 24 deletions
diff --git a/drivers/gpu/drm/amd/display/dc/core/dc_link.c b/drivers/gpu/drm/amd/display/dc/core/dc_link.c index f3a1219c0bb9..02c7a18c095f 100644 --- a/drivers/gpu/drm/amd/display/dc/core/dc_link.c +++ b/drivers/gpu/drm/amd/display/dc/core/dc_link.c @@ -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 */ @@ -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, @@ -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, |