Commit 34d95c3d authored by Mikita Lipski's avatar Mikita Lipski Committed by Alex Deucher

drm/amd/display: Check return value of drm helper

If driver fails to update update VCPI allocation during
compute_mst_dsc_configs_for_state - fail the function
by return early.
Signed-off-by: default avatarMikita Lipski <mikita.lipski@amd.com>
Acked-by: default avatarAlex Deucher <alexander.deucher@amd.com>
Signed-off-by: default avatarMikita Lipski <mikita.lipski@amd.com>
Signed-off-by: default avatarAlex Deucher <alexander.deucher@amd.com>
parent 8c20a1ed
...@@ -621,37 +621,41 @@ static void increase_dsc_bpp(struct drm_atomic_state *state, ...@@ -621,37 +621,41 @@ static void increase_dsc_bpp(struct drm_atomic_state *state,
if (initial_slack[next_index] > fair_pbn_alloc) { if (initial_slack[next_index] > fair_pbn_alloc) {
vars[next_index].pbn += fair_pbn_alloc; vars[next_index].pbn += fair_pbn_alloc;
drm_dp_atomic_find_vcpi_slots(state, if (drm_dp_atomic_find_vcpi_slots(state,
params[next_index].port->mgr, params[next_index].port->mgr,
params[next_index].port, params[next_index].port,
vars[next_index].pbn, vars[next_index].pbn,\
dm_mst_get_pbn_divider(dc_link)); dm_mst_get_pbn_divider(dc_link)) < 0)
return;
if (!drm_dp_mst_atomic_check(state)) { if (!drm_dp_mst_atomic_check(state)) {
vars[next_index].bpp_x16 = bpp_x16_from_pbn(params[next_index], vars[next_index].pbn); vars[next_index].bpp_x16 = bpp_x16_from_pbn(params[next_index], vars[next_index].pbn);
} else { } else {
vars[next_index].pbn -= fair_pbn_alloc; vars[next_index].pbn -= fair_pbn_alloc;
drm_dp_atomic_find_vcpi_slots(state, if (drm_dp_atomic_find_vcpi_slots(state,
params[next_index].port->mgr, params[next_index].port->mgr,
params[next_index].port, params[next_index].port,
vars[next_index].pbn, vars[next_index].pbn,
dm_mst_get_pbn_divider(dc_link)); dm_mst_get_pbn_divider(dc_link)) < 0)
return;
} }
} else { } else {
vars[next_index].pbn += initial_slack[next_index]; vars[next_index].pbn += initial_slack[next_index];
drm_dp_atomic_find_vcpi_slots(state, if (drm_dp_atomic_find_vcpi_slots(state,
params[next_index].port->mgr, params[next_index].port->mgr,
params[next_index].port, params[next_index].port,
vars[next_index].pbn, vars[next_index].pbn,
dm_mst_get_pbn_divider(dc_link)); dm_mst_get_pbn_divider(dc_link)) < 0)
return;
if (!drm_dp_mst_atomic_check(state)) { if (!drm_dp_mst_atomic_check(state)) {
vars[next_index].bpp_x16 = params[next_index].bw_range.max_target_bpp_x16; vars[next_index].bpp_x16 = params[next_index].bw_range.max_target_bpp_x16;
} else { } else {
vars[next_index].pbn -= initial_slack[next_index]; vars[next_index].pbn -= initial_slack[next_index];
drm_dp_atomic_find_vcpi_slots(state, if (drm_dp_atomic_find_vcpi_slots(state,
params[next_index].port->mgr, params[next_index].port->mgr,
params[next_index].port, params[next_index].port,
vars[next_index].pbn, vars[next_index].pbn,
dm_mst_get_pbn_divider(dc_link)); dm_mst_get_pbn_divider(dc_link)) < 0)
return;
} }
} }
...@@ -700,22 +704,24 @@ static void try_disable_dsc(struct drm_atomic_state *state, ...@@ -700,22 +704,24 @@ static void try_disable_dsc(struct drm_atomic_state *state,
break; break;
vars[next_index].pbn = kbps_to_peak_pbn(params[next_index].bw_range.stream_kbps); vars[next_index].pbn = kbps_to_peak_pbn(params[next_index].bw_range.stream_kbps);
drm_dp_atomic_find_vcpi_slots(state, if (drm_dp_atomic_find_vcpi_slots(state,
params[next_index].port->mgr, params[next_index].port->mgr,
params[next_index].port, params[next_index].port,
vars[next_index].pbn, vars[next_index].pbn,
0); 0) < 0)
return;
if (!drm_dp_mst_atomic_check(state)) { if (!drm_dp_mst_atomic_check(state)) {
vars[next_index].dsc_enabled = false; vars[next_index].dsc_enabled = false;
vars[next_index].bpp_x16 = 0; vars[next_index].bpp_x16 = 0;
} else { } else {
vars[next_index].pbn = kbps_to_peak_pbn(params[next_index].bw_range.max_kbps); vars[next_index].pbn = kbps_to_peak_pbn(params[next_index].bw_range.max_kbps);
drm_dp_atomic_find_vcpi_slots(state, if (drm_dp_atomic_find_vcpi_slots(state,
params[next_index].port->mgr, params[next_index].port->mgr,
params[next_index].port, params[next_index].port,
vars[next_index].pbn, vars[next_index].pbn,
dm_mst_get_pbn_divider(dc_link)); dm_mst_get_pbn_divider(dc_link)) < 0)
return;
} }
tried[next_index] = true; tried[next_index] = true;
...@@ -769,11 +775,12 @@ static bool compute_mst_dsc_configs_for_link(struct drm_atomic_state *state, ...@@ -769,11 +775,12 @@ static bool compute_mst_dsc_configs_for_link(struct drm_atomic_state *state,
vars[i].pbn = kbps_to_peak_pbn(params[i].bw_range.stream_kbps); vars[i].pbn = kbps_to_peak_pbn(params[i].bw_range.stream_kbps);
vars[i].dsc_enabled = false; vars[i].dsc_enabled = false;
vars[i].bpp_x16 = 0; vars[i].bpp_x16 = 0;
drm_dp_atomic_find_vcpi_slots(state, if (drm_dp_atomic_find_vcpi_slots(state,
params[i].port->mgr, params[i].port->mgr,
params[i].port, params[i].port,
vars[i].pbn, vars[i].pbn,
0); 0) < 0)
return false;
} }
if (!drm_dp_mst_atomic_check(state)) { if (!drm_dp_mst_atomic_check(state)) {
set_dsc_configs_from_fairness_vars(params, vars, count); set_dsc_configs_from_fairness_vars(params, vars, count);
...@@ -786,20 +793,22 @@ static bool compute_mst_dsc_configs_for_link(struct drm_atomic_state *state, ...@@ -786,20 +793,22 @@ static bool compute_mst_dsc_configs_for_link(struct drm_atomic_state *state,
vars[i].pbn = kbps_to_peak_pbn(params[i].bw_range.min_kbps); vars[i].pbn = kbps_to_peak_pbn(params[i].bw_range.min_kbps);
vars[i].dsc_enabled = true; vars[i].dsc_enabled = true;
vars[i].bpp_x16 = params[i].bw_range.min_target_bpp_x16; vars[i].bpp_x16 = params[i].bw_range.min_target_bpp_x16;
drm_dp_atomic_find_vcpi_slots(state, if (drm_dp_atomic_find_vcpi_slots(state,
params[i].port->mgr, params[i].port->mgr,
params[i].port, params[i].port,
vars[i].pbn, vars[i].pbn,
dm_mst_get_pbn_divider(dc_link)); dm_mst_get_pbn_divider(dc_link)) < 0)
return false;
} else { } else {
vars[i].pbn = kbps_to_peak_pbn(params[i].bw_range.stream_kbps); vars[i].pbn = kbps_to_peak_pbn(params[i].bw_range.stream_kbps);
vars[i].dsc_enabled = false; vars[i].dsc_enabled = false;
vars[i].bpp_x16 = 0; vars[i].bpp_x16 = 0;
drm_dp_atomic_find_vcpi_slots(state, if (drm_dp_atomic_find_vcpi_slots(state,
params[i].port->mgr, params[i].port->mgr,
params[i].port, params[i].port,
vars[i].pbn, vars[i].pbn,
0); 0) < 0)
return false;
} }
} }
if (drm_dp_mst_atomic_check(state)) if (drm_dp_mst_atomic_check(state))
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment