Skip to content

Commit d51160a

Browse files
Fangzhi Zuoalexdeucher
authored andcommitted
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 <[email protected]> Cc: Alex Deucher <[email protected]> Reviewed-by: Wayne Lin <[email protected]> Signed-off-by: Fangzhi Zuo <[email protected]> Signed-off-by: Aurabindo Pillai <[email protected]> Tested-by: Daniel Wheeler <[email protected]> Signed-off-by: Alex Deucher <[email protected]> (cherry picked from commit 352c316) Cc: [email protected]
1 parent 0d5e5e8 commit d51160a

File tree

1 file changed

+13
-4
lines changed

1 file changed

+13
-4
lines changed

drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_mst_types.c

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1027,6 +1027,7 @@ static int try_disable_dsc(struct drm_atomic_state *state,
10271027
int remaining_to_try = 0;
10281028
int ret;
10291029
uint16_t fec_overhead_multiplier_x1000 = get_fec_overhead_multiplier(dc_link);
1030+
int var_pbn;
10301031

10311032
for (i = 0; i < count; i++) {
10321033
if (vars[i + k].dsc_enabled
@@ -1057,28 +1058,36 @@ static int try_disable_dsc(struct drm_atomic_state *state,
10571058
break;
10581059

10591060
DRM_DEBUG_DRIVER("MST_DSC index #%d, try no compression\n", next_index);
1061+
var_pbn = vars[next_index].pbn;
10601062
vars[next_index].pbn = kbps_to_peak_pbn(params[next_index].bw_range.stream_kbps, fec_overhead_multiplier_x1000);
10611063
ret = drm_dp_atomic_find_time_slots(state,
10621064
params[next_index].port->mgr,
10631065
params[next_index].port,
10641066
vars[next_index].pbn);
1065-
if (ret < 0)
1067+
if (ret < 0) {
1068+
DRM_DEBUG_DRIVER("%s:%d MST_DSC index #%d, failed to set pbn to the state, %d\n",
1069+
__func__, __LINE__, next_index, ret);
1070+
vars[next_index].pbn = var_pbn;
10661071
return ret;
1072+
}
10671073

10681074
ret = drm_dp_mst_atomic_check(state);
10691075
if (ret == 0) {
10701076
DRM_DEBUG_DRIVER("MST_DSC index #%d, greedily disable dsc\n", next_index);
10711077
vars[next_index].dsc_enabled = false;
10721078
vars[next_index].bpp_x16 = 0;
10731079
} else {
1074-
DRM_DEBUG_DRIVER("MST_DSC index #%d, restore minimum compression\n", next_index);
1075-
vars[next_index].pbn = kbps_to_peak_pbn(params[next_index].bw_range.max_kbps, fec_overhead_multiplier_x1000);
1080+
DRM_DEBUG_DRIVER("MST_DSC index #%d, restore optimized pbn value\n", next_index);
1081+
vars[next_index].pbn = var_pbn;
10761082
ret = drm_dp_atomic_find_time_slots(state,
10771083
params[next_index].port->mgr,
10781084
params[next_index].port,
10791085
vars[next_index].pbn);
1080-
if (ret < 0)
1086+
if (ret < 0) {
1087+
DRM_DEBUG_DRIVER("%s:%d MST_DSC index #%d, failed to set pbn to the state, %d\n",
1088+
__func__, __LINE__, next_index, ret);
10811089
return ret;
1090+
}
10821091
}
10831092

10841093
tried[next_index] = true;

0 commit comments

Comments
 (0)