Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

drm/amd/display: Restore Optimized pbn Value if Failed to Disable DSC

Existing last step of dsc policy is to restore pbn value under minimum compression
when try to greedily disable dsc for a stream failed to fit in MST bw.
Optimized dsc params result from optimization step is not necessarily the minimum compression,
therefore it is not correct to restore the pbn under minimum compression rate.

Restore the pbn under minimum compression instead of the value from optimized pbn could result
in the dsc params not correct at the modeset where atomic_check failed due to not
enough bw. One or more monitors connected could not light up in such case.

Restore the optimized pbn value, instead of using the pbn value under minimum
compression.

Cc: Mario Limonciello <mario.limonciello@amd.com>
Cc: Alex Deucher <alexander.deucher@amd.com>
Reviewed-by: Wayne Lin <wayne.lin@amd.com>
Signed-off-by: Fangzhi Zuo <Jerry.Zuo@amd.com>
Signed-off-by: Aurabindo Pillai <aurabindo.pillai@amd.com>
Tested-by: Daniel Wheeler <daniel.wheeler@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>

authored by

Fangzhi Zuo and committed by
Alex Deucher
352c3165 559dc44f

+13 -4
+13 -4
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_mst_types.c
··· 1027 1027 int remaining_to_try = 0; 1028 1028 int ret; 1029 1029 uint16_t fec_overhead_multiplier_x1000 = get_fec_overhead_multiplier(dc_link); 1030 + int var_pbn; 1030 1031 1031 1032 for (i = 0; i < count; i++) { 1032 1033 if (vars[i + k].dsc_enabled ··· 1058 1057 break; 1059 1058 1060 1059 DRM_DEBUG_DRIVER("MST_DSC index #%d, try no compression\n", next_index); 1060 + var_pbn = vars[next_index].pbn; 1061 1061 vars[next_index].pbn = kbps_to_peak_pbn(params[next_index].bw_range.stream_kbps, fec_overhead_multiplier_x1000); 1062 1062 ret = drm_dp_atomic_find_time_slots(state, 1063 1063 params[next_index].port->mgr, 1064 1064 params[next_index].port, 1065 1065 vars[next_index].pbn); 1066 - if (ret < 0) 1066 + if (ret < 0) { 1067 + DRM_DEBUG_DRIVER("%s:%d MST_DSC index #%d, failed to set pbn to the state, %d\n", 1068 + __func__, __LINE__, next_index, ret); 1069 + vars[next_index].pbn = var_pbn; 1067 1070 return ret; 1071 + } 1068 1072 1069 1073 ret = drm_dp_mst_atomic_check(state); 1070 1074 if (ret == 0) { ··· 1077 1071 vars[next_index].dsc_enabled = false; 1078 1072 vars[next_index].bpp_x16 = 0; 1079 1073 } else { 1080 - DRM_DEBUG_DRIVER("MST_DSC index #%d, restore minimum compression\n", next_index); 1081 - vars[next_index].pbn = kbps_to_peak_pbn(params[next_index].bw_range.max_kbps, fec_overhead_multiplier_x1000); 1074 + DRM_DEBUG_DRIVER("MST_DSC index #%d, restore optimized pbn value\n", next_index); 1075 + vars[next_index].pbn = var_pbn; 1082 1076 ret = drm_dp_atomic_find_time_slots(state, 1083 1077 params[next_index].port->mgr, 1084 1078 params[next_index].port, 1085 1079 vars[next_index].pbn); 1086 - if (ret < 0) 1080 + if (ret < 0) { 1081 + DRM_DEBUG_DRIVER("%s:%d MST_DSC index #%d, failed to set pbn to the state, %d\n", 1082 + __func__, __LINE__, next_index, ret); 1087 1083 return ret; 1084 + } 1088 1085 } 1089 1086 1090 1087 tried[next_index] = true;