From: Fangzhi Zuo Date: Thu, 10 Jul 2025 01:42:54 +0000 (-0400) Subject: drm/amd/display: Avoid Read Remote DPCD Many Times X-Git-Tag: v6.18-rc1~134^2~19^2~168 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=fa5f99ee7260e067e4e3c1350243471862fad11c;p=thirdparty%2Flinux.git drm/amd/display: Avoid Read Remote DPCD Many Times Reading remote dpcd is time consuming. Instead of reading each byte one by one, read 16 bytes together. Reviewed-by: ChiaHsuan (Tom) Chung Signed-off-by: Fangzhi Zuo Signed-off-by: Wayne Lin Signed-off-by: Roman Li Tested-by: Daniel Wheeler Signed-off-by: Alex Deucher --- diff --git a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_mst_types.c b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_mst_types.c index 137f18d41f1b1..32281bf62f706 100644 --- a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_mst_types.c +++ b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_mst_types.c @@ -1763,14 +1763,17 @@ static bool dp_get_link_current_set_bw(struct drm_dp_aux *aux, uint32_t *cur_lin union lane_count_set lane_count; u8 dp_link_encoding; u8 link_bw_set = 0; + u8 data[16] = {0}; *cur_link_bw = 0; - if (drm_dp_dpcd_read(aux, DP_MAIN_LINK_CHANNEL_CODING_SET, &dp_link_encoding, 1) != 1 || - drm_dp_dpcd_read(aux, DP_LANE_COUNT_SET, &lane_count.raw, 1) != 1 || - drm_dp_dpcd_read(aux, DP_LINK_BW_SET, &link_bw_set, 1) != 1) + if (drm_dp_dpcd_read(aux, DP_LINK_BW_SET, data, 16) != 16) return false; + dp_link_encoding = data[DP_MAIN_LINK_CHANNEL_CODING_SET - DP_LINK_BW_SET]; + link_bw_set = data[DP_LINK_BW_SET - DP_LINK_BW_SET]; + lane_count.raw = data[DP_LANE_COUNT_SET - DP_LINK_BW_SET]; + switch (dp_link_encoding) { case DP_8b_10b_ENCODING: link_rate = link_bw_set;