Commit 3ddd9c83 authored by Wenjing Liu's avatar Wenjing Liu Committed by Alex Deucher

drm/amd/display: remove dpp pipes on failure to update pipe params

[why]
There are cases where update pipe params could fail but dpp pipes are already
added to the state. In this case, we should remove dpp pipes so dc state is
restored back. If it is not restored, dc state is corrupted after calling this
function, so if we call the same interface with the corrupted state again, we
may end up programming pipe topology based on a corrupted dc state.
Reviewed-by: default avatarDillon Varone <dillon.varone@amd.com>
Acked-by: default avatarZaeem Mohamed <zaeem.mohamed@amd.com>
Signed-off-by: default avatarWenjing Liu <wenjing.liu@amd.com>
Tested-by: default avatarDaniel Wheeler <daniel.wheeler@amd.com>
Signed-off-by: default avatarAlex Deucher <alexander.deucher@amd.com>
parent 466423c6
...@@ -2789,6 +2789,7 @@ bool resource_append_dpp_pipes_for_plane_composition( ...@@ -2789,6 +2789,7 @@ bool resource_append_dpp_pipes_for_plane_composition(
struct dc_plane_state *plane_state) struct dc_plane_state *plane_state)
{ {
bool success; bool success;
if (otg_master_pipe->plane_state == NULL) if (otg_master_pipe->plane_state == NULL)
success = add_plane_to_opp_head_pipes(otg_master_pipe, success = add_plane_to_opp_head_pipes(otg_master_pipe,
plane_state, new_ctx); plane_state, new_ctx);
...@@ -2796,10 +2797,15 @@ bool resource_append_dpp_pipes_for_plane_composition( ...@@ -2796,10 +2797,15 @@ bool resource_append_dpp_pipes_for_plane_composition(
success = acquire_secondary_dpp_pipes_and_add_plane( success = acquire_secondary_dpp_pipes_and_add_plane(
otg_master_pipe, plane_state, new_ctx, otg_master_pipe, plane_state, new_ctx,
cur_ctx, pool); cur_ctx, pool);
if (success) if (success) {
/* when appending a plane mpc slice count changes from 0 to 1 */ /* when appending a plane mpc slice count changes from 0 to 1 */
success = update_pipe_params_after_mpc_slice_count_change( success = update_pipe_params_after_mpc_slice_count_change(
plane_state, new_ctx, pool); plane_state, new_ctx, pool);
if (!success)
resource_remove_dpp_pipes_for_plane_composition(new_ctx,
pool, plane_state);
}
return success; return success;
} }
...@@ -2809,6 +2815,7 @@ void resource_remove_dpp_pipes_for_plane_composition( ...@@ -2809,6 +2815,7 @@ void resource_remove_dpp_pipes_for_plane_composition(
const struct dc_plane_state *plane_state) const struct dc_plane_state *plane_state)
{ {
int i; int i;
for (i = pool->pipe_count - 1; i >= 0; i--) { for (i = pool->pipe_count - 1; i >= 0; i--) {
struct pipe_ctx *pipe_ctx = &context->res_ctx.pipe_ctx[i]; struct pipe_ctx *pipe_ctx = &context->res_ctx.pipe_ctx[i];
......
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