Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

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

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
Loading
Loading
Loading
Loading
+65 −61
Original line number Diff line number Diff line
@@ -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);