Commit e1fc2dca authored by Leo (Sunpeng) Li's avatar Leo (Sunpeng) Li Committed by Alex Deucher

drm/amd/display: Complete TODO item: use new DRM iterator

Abandon new_crtcs array and use for_each_new iterator to acquire new
crtcs.
Signed-off-by: default avatarLeo (Sunpeng) Li <sunpeng.li@amd.com>
Reviewed-by: default avatarHarry Wentland <Harry.Wentland@amd.com>
Signed-off-by: default avatarAlex Deucher <alexander.deucher@amd.com>
parent 8b8f27f9
...@@ -4034,10 +4034,8 @@ static void amdgpu_dm_atomic_commit_tail(struct drm_atomic_state *state) ...@@ -4034,10 +4034,8 @@ static void amdgpu_dm_atomic_commit_tail(struct drm_atomic_state *state)
struct amdgpu_display_manager *dm = &adev->dm; struct amdgpu_display_manager *dm = &adev->dm;
struct dm_atomic_state *dm_state; struct dm_atomic_state *dm_state;
uint32_t i, j; uint32_t i, j;
uint32_t new_crtcs_count = 0;
struct drm_crtc *crtc; struct drm_crtc *crtc;
struct drm_crtc_state *old_crtc_state, *new_crtc_state; struct drm_crtc_state *old_crtc_state, *new_crtc_state;
struct amdgpu_crtc *new_crtcs[MAX_STREAMS];
unsigned long flags; unsigned long flags;
bool wait_for_vblank = true; bool wait_for_vblank = true;
struct drm_connector *connector; struct drm_connector *connector;
...@@ -4096,25 +4094,9 @@ static void amdgpu_dm_atomic_commit_tail(struct drm_atomic_state *state) ...@@ -4096,25 +4094,9 @@ static void amdgpu_dm_atomic_commit_tail(struct drm_atomic_state *state)
continue; continue;
} }
if (dm_old_crtc_state->stream) if (dm_old_crtc_state->stream)
remove_stream(adev, acrtc, dm_old_crtc_state->stream); remove_stream(adev, acrtc, dm_old_crtc_state->stream);
/*
* this loop saves set mode crtcs
* we needed to enable vblanks once all
* resources acquired in dc after dc_commit_streams
*/
/*TODO move all this into dm_crtc_state, get rid of
* new_crtcs array and use old and new atomic states
* instead
*/
new_crtcs[new_crtcs_count] = acrtc;
new_crtcs_count++;
new_crtc_state = drm_atomic_get_new_crtc_state(state, crtc);
acrtc->enabled = true; acrtc->enabled = true;
acrtc->hw_mode = new_crtc_state->mode; acrtc->hw_mode = new_crtc_state->mode;
crtc->hwmode = new_crtc_state->mode; crtc->hwmode = new_crtc_state->mode;
...@@ -4242,18 +4224,28 @@ static void amdgpu_dm_atomic_commit_tail(struct drm_atomic_state *state) ...@@ -4242,18 +4224,28 @@ static void amdgpu_dm_atomic_commit_tail(struct drm_atomic_state *state)
dm_error("%s: Failed to update stream scaling!\n", __func__); dm_error("%s: Failed to update stream scaling!\n", __func__);
} }
for (i = 0; i < new_crtcs_count; i++) { for_each_oldnew_crtc_in_state(state, crtc, old_crtc_state,
new_crtc_state, i) {
/* /*
* loop to enable interrupts on newly arrived crtc * loop to enable interrupts on newly arrived crtc
*/ */
struct amdgpu_crtc *acrtc = new_crtcs[i]; struct amdgpu_crtc *acrtc = to_amdgpu_crtc(crtc);
bool modeset_needed;
new_crtc_state = drm_atomic_get_new_crtc_state(state, &acrtc->base);
dm_new_crtc_state = to_dm_crtc_state(new_crtc_state); dm_new_crtc_state = to_dm_crtc_state(new_crtc_state);
dm_old_crtc_state = to_dm_crtc_state(old_crtc_state);
modeset_needed = modeset_required(
new_crtc_state,
dm_new_crtc_state->stream,
dm_old_crtc_state->stream);
if (dm_new_crtc_state->stream == NULL || !modeset_needed)
continue;
if (adev->dm.freesync_module) if (adev->dm.freesync_module)
mod_freesync_notify_mode_change( mod_freesync_notify_mode_change(
adev->dm.freesync_module, &dm_new_crtc_state->stream, 1); adev->dm.freesync_module,
&dm_new_crtc_state->stream, 1);
manage_dm_interrupts(adev, acrtc, true); manage_dm_interrupts(adev, acrtc, true);
} }
......
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