Commit c744e974 authored by Nicholas Kazlauskas's avatar Nicholas Kazlauskas Committed by Alex Deucher

drm/amd/display: Reformat dm_determine_update_type_for_commit

[Why]
The indenting for this function is a few levels too deep and can be
simplified a fair bit. This patch is in preparation for functional
changes that fix update type determination to occur less frequently
and more accurately.

[How]
Place checks early and exit/continue when possible. This isn't
a functional change.
Signed-off-by: default avatarNicholas Kazlauskas <nicholas.kazlauskas@amd.com>
Reviewed-by: default avatarDavid Francis <David.Francis@amd.com>
Acked-by: default avatarBhawanpreet Lakha <Bhawanpreet.Lakha@amd.com>
Signed-off-by: default avatarAlex Deucher <alexander.deucher@amd.com>
parent c7af5f77
...@@ -5791,7 +5791,14 @@ dm_determine_update_type_for_commit(struct dc *dc, ...@@ -5791,7 +5791,14 @@ dm_determine_update_type_for_commit(struct dc *dc,
old_dm_crtc_state = to_dm_crtc_state(old_crtc_state); old_dm_crtc_state = to_dm_crtc_state(old_crtc_state);
num_plane = 0; num_plane = 0;
if (new_dm_crtc_state->stream) { if (!new_dm_crtc_state->stream) {
if (!new_dm_crtc_state->stream && old_dm_crtc_state->stream) {
update_type = UPDATE_TYPE_FULL;
goto cleanup;
}
continue;
}
for_each_oldnew_plane_in_state(state, plane, old_plane_state, new_plane_state, j) { for_each_oldnew_plane_in_state(state, plane, old_plane_state, new_plane_state, j) {
new_plane_crtc = new_plane_state->crtc; new_plane_crtc = new_plane_state->crtc;
...@@ -5805,7 +5812,9 @@ dm_determine_update_type_for_commit(struct dc *dc, ...@@ -5805,7 +5812,9 @@ dm_determine_update_type_for_commit(struct dc *dc,
if (!state->allow_modeset) if (!state->allow_modeset)
continue; continue;
if (crtc == new_plane_crtc) { if (crtc != new_plane_crtc)
continue;
updates[num_plane].surface = &surface[num_plane]; updates[num_plane].surface = &surface[num_plane];
if (new_crtc_state->mode_changed) { if (new_crtc_state->mode_changed) {
...@@ -5834,9 +5843,10 @@ dm_determine_update_type_for_commit(struct dc *dc, ...@@ -5834,9 +5843,10 @@ dm_determine_update_type_for_commit(struct dc *dc,
num_plane++; num_plane++;
} }
}
if (num_plane > 0) { if (num_plane == 0)
continue;
ret = dm_atomic_get_state(state, &dm_state); ret = dm_atomic_get_state(state, &dm_state);
if (ret) if (ret)
goto cleanup; goto cleanup;
...@@ -5859,12 +5869,6 @@ dm_determine_update_type_for_commit(struct dc *dc, ...@@ -5859,12 +5869,6 @@ dm_determine_update_type_for_commit(struct dc *dc,
} }
} }
} else if (!new_dm_crtc_state->stream && old_dm_crtc_state->stream) {
update_type = UPDATE_TYPE_FULL;
goto cleanup;
}
}
cleanup: cleanup:
kfree(updates); kfree(updates);
kfree(surface); kfree(surface);
......
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