summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLeo (Sunpeng) Li2017-10-18 21:32:41 +0200
committerAlex Deucher2017-12-04 22:41:33 +0100
commite1fc2dca1295c4ff2de67afe2d9fac07abb0369a (patch)
tree589b0ac00b018a5275dfdcb95ff9561a2bd9470e
parentdrm/amd/display: Fix styling of freesync code in commit_tail (diff)
downloadkernel-qcow2-linux-e1fc2dca1295c4ff2de67afe2d9fac07abb0369a.tar.gz
kernel-qcow2-linux-e1fc2dca1295c4ff2de67afe2d9fac07abb0369a.tar.xz
kernel-qcow2-linux-e1fc2dca1295c4ff2de67afe2d9fac07abb0369a.zip
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: Leo (Sunpeng) Li <sunpeng.li@amd.com> Reviewed-by: Harry Wentland <Harry.Wentland@amd.com> Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
-rw-r--r--drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c36
1 files changed, 14 insertions, 22 deletions
diff --git a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
index d7dc6c248630..9c5a5f58bfe1 100644
--- a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
+++ b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
@@ -4034,10 +4034,8 @@ static void amdgpu_dm_atomic_commit_tail(struct drm_atomic_state *state)
struct amdgpu_display_manager *dm = &adev->dm;
struct dm_atomic_state *dm_state;
uint32_t i, j;
- uint32_t new_crtcs_count = 0;
struct drm_crtc *crtc;
struct drm_crtc_state *old_crtc_state, *new_crtc_state;
- struct amdgpu_crtc *new_crtcs[MAX_STREAMS];
unsigned long flags;
bool wait_for_vblank = true;
struct drm_connector *connector;
@@ -4096,25 +4094,9 @@ static void amdgpu_dm_atomic_commit_tail(struct drm_atomic_state *state)
continue;
}
-
if (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->hw_mode = 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)
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
*/
- 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_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)
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);
}