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: Nicholas Kazlauskas <nicholas.kazlauskas@amd.com>
Reviewed-by: David Francis <David.Francis@amd.com>
Acked-by: Bhawanpreet Lakha <Bhawanpreet.Lakha@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
This commit is contained in:
Nicholas Kazlauskas 2019-01-10 09:14:49 -05:00 committed by Alex Deucher
parent c7af5f77ae
commit c744e974a2

View File

@ -5791,7 +5791,14 @@ dm_determine_update_type_for_commit(struct dc *dc,
old_dm_crtc_state = to_dm_crtc_state(old_crtc_state);
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) {
new_plane_crtc = new_plane_state->crtc;
@ -5805,7 +5812,9 @@ dm_determine_update_type_for_commit(struct dc *dc,
if (!state->allow_modeset)
continue;
if (crtc == new_plane_crtc) {
if (crtc != new_plane_crtc)
continue;
updates[num_plane].surface = &surface[num_plane];
if (new_crtc_state->mode_changed) {
@ -5834,9 +5843,10 @@ dm_determine_update_type_for_commit(struct dc *dc,
num_plane++;
}
}
if (num_plane > 0) {
if (num_plane == 0)
continue;
ret = dm_atomic_get_state(state, &dm_state);
if (ret)
goto cleanup;
@ -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:
kfree(updates);
kfree(surface);