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,75 +5791,79 @@ dm_determine_update_type_for_commit(struct dc *dc, ...@@ -5791,75 +5791,79 @@ 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) {
for_each_oldnew_plane_in_state(state, plane, old_plane_state, new_plane_state, j) { update_type = UPDATE_TYPE_FULL;
new_plane_crtc = new_plane_state->crtc; goto cleanup;
old_plane_crtc = old_plane_state->crtc;
new_dm_plane_state = to_dm_plane_state(new_plane_state);
old_dm_plane_state = to_dm_plane_state(old_plane_state);
if (plane->type == DRM_PLANE_TYPE_CURSOR)
continue;
if (!state->allow_modeset)
continue;
if (crtc == new_plane_crtc) {
updates[num_plane].surface = &surface[num_plane];
if (new_crtc_state->mode_changed) {
updates[num_plane].surface->src_rect =
new_dm_plane_state->dc_state->src_rect;
updates[num_plane].surface->dst_rect =
new_dm_plane_state->dc_state->dst_rect;
updates[num_plane].surface->rotation =
new_dm_plane_state->dc_state->rotation;
updates[num_plane].surface->in_transfer_func =
new_dm_plane_state->dc_state->in_transfer_func;
stream_update.dst = new_dm_crtc_state->stream->dst;
stream_update.src = new_dm_crtc_state->stream->src;
}
if (new_crtc_state->color_mgmt_changed) {
updates[num_plane].gamma =
new_dm_plane_state->dc_state->gamma_correction;
updates[num_plane].in_transfer_func =
new_dm_plane_state->dc_state->in_transfer_func;
stream_update.gamut_remap =
&new_dm_crtc_state->stream->gamut_remap_matrix;
stream_update.out_transfer_func =
new_dm_crtc_state->stream->out_transfer_func;
}
num_plane++;
}
} }
if (num_plane > 0) { continue;
ret = dm_atomic_get_state(state, &dm_state); }
if (ret)
goto cleanup;
old_dm_state = dm_atomic_get_old_state(state); for_each_oldnew_plane_in_state(state, plane, old_plane_state, new_plane_state, j) {
if (!old_dm_state) { new_plane_crtc = new_plane_state->crtc;
ret = -EINVAL; old_plane_crtc = old_plane_state->crtc;
goto cleanup; new_dm_plane_state = to_dm_plane_state(new_plane_state);
} old_dm_plane_state = to_dm_plane_state(old_plane_state);
status = dc_stream_get_status_from_state(old_dm_state->context, if (plane->type == DRM_PLANE_TYPE_CURSOR)
new_dm_crtc_state->stream); continue;
update_type = dc_check_update_surfaces_for_stream(dc, updates, num_plane, if (!state->allow_modeset)
&stream_update, status); continue;
if (update_type > UPDATE_TYPE_MED) { if (crtc != new_plane_crtc)
update_type = UPDATE_TYPE_FULL; continue;
goto cleanup;
} updates[num_plane].surface = &surface[num_plane];
if (new_crtc_state->mode_changed) {
updates[num_plane].surface->src_rect =
new_dm_plane_state->dc_state->src_rect;
updates[num_plane].surface->dst_rect =
new_dm_plane_state->dc_state->dst_rect;
updates[num_plane].surface->rotation =
new_dm_plane_state->dc_state->rotation;
updates[num_plane].surface->in_transfer_func =
new_dm_plane_state->dc_state->in_transfer_func;
stream_update.dst = new_dm_crtc_state->stream->dst;
stream_update.src = new_dm_crtc_state->stream->src;
}
if (new_crtc_state->color_mgmt_changed) {
updates[num_plane].gamma =
new_dm_plane_state->dc_state->gamma_correction;
updates[num_plane].in_transfer_func =
new_dm_plane_state->dc_state->in_transfer_func;
stream_update.gamut_remap =
&new_dm_crtc_state->stream->gamut_remap_matrix;
stream_update.out_transfer_func =
new_dm_crtc_state->stream->out_transfer_func;
} }
} else if (!new_dm_crtc_state->stream && old_dm_crtc_state->stream) { num_plane++;
}
if (num_plane == 0)
continue;
ret = dm_atomic_get_state(state, &dm_state);
if (ret)
goto cleanup;
old_dm_state = dm_atomic_get_old_state(state);
if (!old_dm_state) {
ret = -EINVAL;
goto cleanup;
}
status = dc_stream_get_status_from_state(old_dm_state->context,
new_dm_crtc_state->stream);
update_type = dc_check_update_surfaces_for_stream(dc, updates, num_plane,
&stream_update, status);
if (update_type > UPDATE_TYPE_MED) {
update_type = UPDATE_TYPE_FULL; update_type = UPDATE_TYPE_FULL;
goto cleanup; goto cleanup;
} }
......
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