On 2017-10-13 01:26 PM, Andrey Grodzovsky wrote: > > > On 10/13/2017 12:18 PM, Harry Wentland wrote: >> On 2017-10-12 05:15 PM, sunpeng.li at amd.com wrote: >>> From: "Leo (Sunpeng) Li" <sunpeng.li at amd.com> >>> >>> To conform to DRM's new API, we should not be accessing a DRM object's >>> internal state directly. Rather, the DRM for_each_old/new_* iterators, >>> and drm_atomic_get_old/new_* interface should be used. >>> >>> This is an ongoing process. For now, update the DRM-facing atomic >>> functions, where the atomic state object is given. >>> >>> Signed-off-by: Leo (Sunpeng) Li <sunpeng.li at amd.com> >>> --- >>> Â drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c | 131 +++++++++++----------- >>> Â 1 file changed, 66 insertions(+), 65 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 cc024ab..d4426b3 100644 >>> --- a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c >>> +++ b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c >>> @@ -3873,28 +3873,31 @@ static void amdgpu_dm_commit_planes(struct drm_atomic_state *state, >>> Â { >>> Â Â Â Â Â uint32_t i; >>> Â Â Â Â Â struct drm_plane *plane; >>> -Â Â Â struct drm_plane_state *old_plane_state; >>> +Â Â Â struct drm_plane_state *old_plane_state, *new_plane_state; >>> Â Â Â Â Â struct dc_stream_state *dc_stream_attach; >>> Â Â Â Â Â struct dc_plane_state *plane_states_constructed[MAX_SURFACES]; >>> Â Â Â Â Â struct amdgpu_crtc *acrtc_attach = to_amdgpu_crtc(pcrtc); >>> -Â Â Â struct dm_crtc_state *acrtc_state = to_dm_crtc_state(pcrtc->state); >>> +Â Â Â struct drm_crtc_state *new_pcrtc_state = >>> +Â Â Â Â Â Â Â Â Â Â Â drm_atomic_get_new_crtc_state(state, pcrtc); >>> +Â Â Â struct dm_crtc_state *acrtc_state = to_dm_crtc_state(new_pcrtc_state); >>> Â Â Â Â Â int planes_count = 0; >>> Â Â Â Â Â unsigned long flags; >>> Â Â Â Â Â Â /* update planes when needed */ >>> -Â Â Â for_each_old_plane_in_state(state, plane, old_plane_state, i) { >>> -Â Â Â Â Â Â Â struct drm_plane_state *plane_state = plane->state; >>> -Â Â Â Â Â Â Â struct drm_crtc *crtc = plane_state->crtc; >>> -Â Â Â Â Â Â Â struct drm_framebuffer *fb = plane_state->fb; >>> +Â Â Â for_each_oldnew_plane_in_state(state, plane, old_plane_state, new_plane_state, i) { >>> +Â Â Â Â Â Â Â struct drm_crtc *crtc = new_plane_state->crtc; >>> +Â Â Â Â Â Â Â struct drm_crtc_state *new_crtc_state = >>> +Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â drm_atomic_get_new_crtc_state(state, crtc); >>> +Â Â Â Â Â Â Â struct drm_framebuffer *fb = new_plane_state->fb; >>> Â Â Â Â Â Â Â Â Â bool pflip_needed; >>> -Â Â Â Â Â Â Â struct dm_plane_state *dm_plane_state = to_dm_plane_state(plane_state); >>> +Â Â Â Â Â Â Â struct dm_plane_state *dm_plane_state = to_dm_plane_state(new_plane_state); >>> Â Â Â Â Â Â Â Â Â Â if (plane->type == DRM_PLANE_TYPE_CURSOR) { >>> Â Â Â Â Â Â Â Â Â Â Â Â Â handle_cursor_update(plane, old_plane_state); >>> Â Â Â Â Â Â Â Â Â Â Â Â Â continue; >>> Â Â Â Â Â Â Â Â Â } >>> Â -Â Â Â Â Â Â Â if (!fb || !crtc || pcrtc != crtc || !crtc->state->active) >>> +Â Â Â Â Â Â Â if (!fb || !crtc || pcrtc != crtc || !new_crtc_state->active) >>> Â Â Â Â Â Â Â Â Â Â Â Â Â continue; >>> Â Â Â Â Â Â Â Â Â Â pflip_needed = !state->allow_modeset; >>> @@ -3918,13 +3921,13 @@ static void amdgpu_dm_commit_planes(struct drm_atomic_state *state, >>> Â Â Â Â Â Â Â Â Â Â Â Â Â dc_stream_attach = acrtc_state->stream; >>> Â Â Â Â Â Â Â Â Â Â Â Â Â planes_count++; >>> Â -Â Â Â Â Â Â Â } else if (crtc->state->planes_changed) { >>> +Â Â Â Â Â Â Â } else if (new_crtc_state->planes_changed) { >>> Â Â Â Â Â Â Â Â Â Â Â Â Â /* Assume even ONE crtc with immediate flip means >>> Â Â Â Â Â Â Â Â Â Â Â Â Â Â * entire can't wait for VBLANK >>> Â Â Â Â Â Â Â Â Â Â Â Â Â Â * TODO Check if it's correct >>> Â Â Â Â Â Â Â Â Â Â Â Â Â Â */ >>> Â Â Â Â Â Â Â Â Â Â Â Â Â *wait_for_vblank = >>> -Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â pcrtc->state->pageflip_flags & DRM_MODE_PAGE_FLIP_ASYNC ? >>> +Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â new_pcrtc_state->pageflip_flags & DRM_MODE_PAGE_FLIP_ASYNC ? >>> Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â false : true; >>> Â Â Â Â Â Â Â Â Â Â Â Â Â Â /* TODO: Needs rework for multiplane flip */ >>> @@ -3942,7 +3945,7 @@ static void amdgpu_dm_commit_planes(struct drm_atomic_state *state, >>> Â Â Â Â Â if (planes_count) { >>> Â Â Â Â Â Â Â Â Â unsigned long flags; >>> Â -Â Â Â Â Â Â Â if (pcrtc->state->event) { >>> +Â Â Â Â Â Â Â if (new_pcrtc_state->event) { >>> Â Â Â Â Â Â Â Â Â Â Â Â Â Â drm_crtc_vblank_get(pcrtc); >>> Â @@ -3968,7 +3971,7 @@ int amdgpu_dm_atomic_commit( >>> Â Â Â Â Â Â Â Â Â bool nonblock) >>> Â { >>> Â Â Â Â Â struct drm_crtc *crtc; >>> -Â Â Â struct drm_crtc_state *new_state; >>> +Â Â Â struct drm_crtc_state *old_crtc_state, *new_state; >>> Â Â Â Â Â struct amdgpu_device *adev = dev->dev_private; >>> Â Â Â Â Â int i; >>> Â @@ -3979,8 +3982,8 @@ int amdgpu_dm_atomic_commit( >>> Â Â Â Â Â Â * it will update crtc->dm_crtc_state->stream pointer which is used in >>> Â Â Â Â Â Â * the ISRs. >>> Â Â Â Â Â Â */ >>> -Â Â Â for_each_new_crtc_in_state(state, crtc, new_state, i) { >>> -Â Â Â Â Â Â Â struct dm_crtc_state *old_acrtc_state = to_dm_crtc_state(crtc->state); >>> +Â Â Â for_each_oldnew_crtc_in_state(state, crtc, old_crtc_state, new_state, i) { >>> +Â Â Â Â Â Â Â struct dm_crtc_state *old_acrtc_state = to_dm_crtc_state(old_crtc_state); >>> Â Â Â Â Â Â Â Â Â struct amdgpu_crtc *acrtc = to_amdgpu_crtc(crtc); >>> Â Â Â Â Â Â Â Â Â Â if (drm_atomic_crtc_needs_modeset(new_state) && old_acrtc_state->stream) >>> @@ -4002,13 +4005,13 @@ void amdgpu_dm_atomic_commit_tail( >>> Â Â Â Â Â uint32_t i, j; >>> Â Â Â Â Â uint32_t new_crtcs_count = 0; >>> Â Â Â Â Â struct drm_crtc *crtc, *pcrtc; >>> -Â Â Â struct drm_crtc_state *old_crtc_state; >>> +Â Â Â struct drm_crtc_state *old_crtc_state, *new_crtc_state; >>> Â Â Â Â Â struct amdgpu_crtc *new_crtcs[MAX_STREAMS]; >>> Â Â Â Â Â struct dc_stream_state *new_stream = NULL; >>> Â Â Â Â Â unsigned long flags; >>> Â Â Â Â Â bool wait_for_vblank = true; >>> Â Â Â Â Â struct drm_connector *connector; >>> -Â Â Â struct drm_connector_state *old_conn_state; >>> +Â Â Â struct drm_connector_state *old_conn_state, *new_con_state; >>> Â Â Â Â Â struct dm_crtc_state *old_acrtc_state, *new_acrtc_state; >>> Â Â Â Â Â Â drm_atomic_helper_update_legacy_modeset_state(dev, state); >>> @@ -4016,11 +4019,10 @@ void amdgpu_dm_atomic_commit_tail( >>> Â Â Â Â Â dm_state = to_dm_atomic_state(state); >>> Â Â Â Â Â Â /* update changed items */ >>> -Â Â Â for_each_old_crtc_in_state(state, crtc, old_crtc_state, i) { >>> +Â Â Â for_each_oldnew_crtc_in_state(state, crtc, old_crtc_state, new_crtc_state, i) { >>> Â Â Â Â Â Â Â Â Â struct amdgpu_crtc *acrtc = to_amdgpu_crtc(crtc); >>> -Â Â Â Â Â Â Â struct drm_crtc_state *new_state = crtc->state; >>> Â -Â Â Â Â Â Â Â new_acrtc_state = to_dm_crtc_state(new_state); >>> +Â Â Â Â Â Â Â new_acrtc_state = to_dm_crtc_state(new_crtc_state); >>> Â Â Â Â Â Â Â Â Â old_acrtc_state = to_dm_crtc_state(old_crtc_state); >>> Â Â Â Â Â Â Â Â Â Â DRM_DEBUG_DRIVER( >>> @@ -4028,18 +4030,18 @@ void amdgpu_dm_atomic_commit_tail( >>> Â Â Â Â Â Â Â Â Â Â Â Â Â "planes_changed:%d, mode_changed:%d,active_changed:%d," >>> Â Â Â Â Â Â Â Â Â Â Â Â Â "connectors_changed:%d\n", >>> Â Â Â Â Â Â Â Â Â Â Â Â Â acrtc->crtc_id, >>> -Â Â Â Â Â Â Â Â Â Â Â new_state->enable, >>> -Â Â Â Â Â Â Â Â Â Â Â new_state->active, >>> -Â Â Â Â Â Â Â Â Â Â Â new_state->planes_changed, >>> -Â Â Â Â Â Â Â Â Â Â Â new_state->mode_changed, >>> -Â Â Â Â Â Â Â Â Â Â Â new_state->active_changed, >>> -Â Â Â Â Â Â Â Â Â Â Â new_state->connectors_changed); >>> +Â Â Â Â Â Â Â Â Â Â Â new_crtc_state->enable, >>> +Â Â Â Â Â Â Â Â Â Â Â new_crtc_state->active, >>> +Â Â Â Â Â Â Â Â Â Â Â new_crtc_state->planes_changed, >>> +Â Â Â Â Â Â Â Â Â Â Â new_crtc_state->mode_changed, >>> +Â Â Â Â Â Â Â Â Â Â Â new_crtc_state->active_changed, >>> +Â Â Â Â Â Â Â Â Â Â Â new_crtc_state->connectors_changed); >>> Â Â Â Â Â Â Â Â Â Â /* handles headless hotplug case, updating new_state and >>> Â Â Â Â Â Â Â Â Â Â * aconnector as needed >>> Â Â Â Â Â Â Â Â Â Â */ >>> Â -Â Â Â Â Â Â Â if (modeset_required(new_state, new_acrtc_state->stream, old_acrtc_state->stream)) { >>> +Â Â Â Â Â Â Â if (modeset_required(new_crtc_state, new_acrtc_state->stream, old_acrtc_state->stream)) { >>> Â Â Â Â Â Â Â Â Â Â Â Â Â Â DRM_DEBUG_DRIVER("Atomic commit: SET crtc id %d: [%p]\n", acrtc->crtc_id, acrtc); >>> Â @@ -4082,10 +4084,11 @@ void amdgpu_dm_atomic_commit_tail( >>> Â Â Â Â Â Â Â Â Â Â Â Â Â 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 = crtc->state->mode; >>> -Â Â Â Â Â Â Â Â Â Â Â crtc->hwmode = crtc->state->mode; >>> -Â Â Â Â Â Â Â } else if (modereset_required(new_state)) { >>> +Â Â Â Â Â Â Â Â Â Â Â acrtc->hw_mode = new_crtc_state->mode; >>> +Â Â Â Â Â Â Â Â Â Â Â crtc->hwmode = new_crtc_state->mode; >>> +Â Â Â Â Â Â Â } else if (modereset_required(new_crtc_state)) { >>> Â Â Â Â Â Â Â Â Â Â Â Â Â DRM_DEBUG_DRIVER("Atomic commit: RESET. crtc id %d:[%p]\n", acrtc->crtc_id, acrtc); >>> Â Â Â Â Â Â Â Â Â Â Â Â Â Â /* i.e. reset mode */ >>> @@ -4102,7 +4105,9 @@ void amdgpu_dm_atomic_commit_tail( >>> Â Â Â Â Â Â Â Â Â for (i = 0; i < new_crtcs_count; i++) { >>> Â Â Â Â Â Â Â Â Â Â Â Â Â struct amdgpu_dm_connector *aconnector = NULL; >>> Â -Â Â Â Â Â Â Â Â Â Â Â new_acrtc_state = to_dm_crtc_state(new_crtcs[i]->base.state); >>> +Â Â Â Â Â Â Â Â Â Â Â new_crtc_state = drm_atomic_get_new_crtc_state(state, >>> +Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â &new_crtcs[i]->base); >>> +Â Â Â Â Â Â Â Â Â Â Â new_acrtc_state = to_dm_crtc_state(new_crtc_state); >>> Â Â Â Â Â Â Â Â Â Â Â Â Â Â new_stream = new_acrtc_state->stream; >>> Â Â Â Â Â Â Â Â Â Â Â Â Â aconnector = amdgpu_dm_find_first_crct_matching_connector( >>> @@ -4123,11 +4128,10 @@ void amdgpu_dm_atomic_commit_tail( >>> Â Â Â Â Â if (dm_state->context) >>> Â Â Â Â Â Â Â Â Â WARN_ON(!dc_commit_state(dm->dc, dm_state->context)); >>> Â - >>> -Â Â Â list_for_each_entry(crtc, &dev->mode_config.crtc_list, head) { >>> +Â Â Â for_each_new_crtc_in_state(state, crtc, new_crtc_state, i) { >>> Â Â Â Â Â Â Â Â Â struct amdgpu_crtc *acrtc = to_amdgpu_crtc(crtc); >>> Â -Â Â Â Â Â Â Â new_acrtc_state = to_dm_crtc_state(crtc->state); >>> +Â Â Â Â Â Â Â new_acrtc_state = to_dm_crtc_state(new_crtc_state); >>> Â Â Â Â Â Â Â Â Â Â if (new_acrtc_state->stream != NULL) { >>> Â Â Â Â Â Â Â Â Â Â Â Â Â const struct dc_stream_status *status = >>> @@ -4141,24 +4145,24 @@ void amdgpu_dm_atomic_commit_tail( >>> Â Â Â Â Â } >>> Â Â Â Â Â Â /* Handle scaling and undersacn changes*/ >>> -Â Â Â for_each_old_connector_in_state(state, connector, old_conn_state, i) { >>> -Â Â Â Â Â Â Â struct amdgpu_dm_connector *aconnector = to_amdgpu_dm_connector(connector); >>> -Â Â Â Â Â Â Â struct dm_connector_state *con_new_state = >>> -Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â to_dm_connector_state(aconnector->base.state); >>> -Â Â Â Â Â Â Â struct dm_connector_state *con_old_state = >>> -Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â to_dm_connector_state(old_conn_state); >>> +Â Â Â for_each_oldnew_connector_in_state(state, connector, old_conn_state, new_con_state, i) { >>> +Â Â Â Â Â Â Â struct dm_connector_state *con_new_state = to_dm_connector_state(new_con_state); >>> +Â Â Â Â Â Â Â struct dm_connector_state *con_old_state = to_dm_connector_state(old_conn_state); >>> Â Â Â Â Â Â Â Â Â struct amdgpu_crtc *acrtc = to_amdgpu_crtc(con_new_state->base.crtc); >>> Â Â Â Â Â Â Â Â Â struct dc_stream_status *status = NULL; >>> Â +Â Â Â Â Â Â Â if (acrtc) >>> +Â Â Â Â Â Â Â Â Â Â Â new_crtc_state = drm_atomic_get_new_crtc_state(state, &acrtc->base); >>> + >>> Â Â Â Â Â Â Â Â Â /* Skip any modesets/resets */ >>> -Â Â Â Â Â Â Â if (!acrtc || drm_atomic_crtc_needs_modeset(acrtc->base.state)) >>> +Â Â Â Â Â Â Â if (!acrtc || drm_atomic_crtc_needs_modeset(new_crtc_state)) >>> Â Â Â Â Â Â Â Â Â Â Â Â Â continue; >>> Â Â Â Â Â Â Â Â Â Â /* Skip any thing not scale or underscan changes */ >>> Â Â Â Â Â Â Â Â Â if (!is_scaling_state_different(con_new_state, con_old_state)) >>> Â Â Â Â Â Â Â Â Â Â Â Â Â continue; >>> Â -Â Â Â Â Â Â Â new_acrtc_state = to_dm_crtc_state(acrtc->base.state); >>> +Â Â Â Â Â Â Â new_acrtc_state = to_dm_crtc_state(new_crtc_state); >>> Â Â Â Â Â Â Â Â Â Â update_stream_scaling_settings(&con_new_state->base.crtc->mode, >>> Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â con_new_state, (struct dc_stream_state *)new_acrtc_state->stream); >>> @@ -4185,7 +4189,8 @@ void amdgpu_dm_atomic_commit_tail( >>> Â Â Â Â Â Â Â Â Â Â */ >>> Â Â Â Â Â Â Â Â Â struct amdgpu_crtc *acrtc = new_crtcs[i]; >>> Â -Â Â Â Â Â Â Â new_acrtc_state = to_dm_crtc_state(acrtc->base.state); >>> +Â Â Â Â Â Â Â new_crtc_state = drm_atomic_get_new_crtc_state(state, &acrtc->base); >>> +Â Â Â Â Â Â Â new_acrtc_state = to_dm_crtc_state(new_crtc_state); >>> Â Â Â Â Â Â Â Â Â Â if (adev->dm.freesync_module) >>> Â Â Â Â Â Â Â Â Â Â Â Â Â mod_freesync_notify_mode_change( >>> @@ -4195,8 +4200,8 @@ void amdgpu_dm_atomic_commit_tail( >>> Â Â Â Â Â } >>> Â Â Â Â Â Â /* update planes when needed per crtc*/ >>> -Â Â Â for_each_old_crtc_in_state(state, pcrtc, old_crtc_state, j) { >>> -Â Â Â Â Â Â Â new_acrtc_state = to_dm_crtc_state(pcrtc->state); >>> +Â Â Â for_each_new_crtc_in_state(state, pcrtc, new_crtc_state, j) { >>> +Â Â Â Â Â Â Â new_acrtc_state = to_dm_crtc_state(new_crtc_state); >>> Â Â Â Â Â Â Â Â Â Â if (new_acrtc_state->stream) >>> Â Â Â Â Â Â Â Â Â Â Â Â Â amdgpu_dm_commit_planes(state, dev, dm, pcrtc, &wait_for_vblank); >>> @@ -4208,13 +4213,12 @@ void amdgpu_dm_atomic_commit_tail( >>> Â Â Â Â Â Â * mark consumed event for drm_atomic_helper_commit_hw_done >>> Â Â Â Â Â Â */ >>> Â Â Â Â Â spin_lock_irqsave(&adev->ddev->event_lock, flags); >>> -Â Â Â for_each_old_crtc_in_state(state, crtc, old_crtc_state, i) { >>> -Â Â Â Â Â Â Â struct amdgpu_crtc *acrtc = to_amdgpu_crtc(crtc); >>> +Â Â Â for_each_new_crtc_in_state(state, crtc, new_crtc_state, i) { >> Andrey might be able to comment on this better, but weren't we intentionally >> trying to iterate the old crtc here to make sure we send any even on it? >> >> Harry > > The states we are interested in are still the new states because that where the event we want > to send resides (drm_send_event_locked(dev, &crtc->state->event->base), with the introduction of for_each_new* > iterators we should use them to iterate the new states. > I think this just looked odd because of the patches were structured but the logic is sound. Series is Reviewed-by: Harry Wentland <harry.wentland at amd.com> Harry > Thanks, > Andrey > >> >>> Â -Â Â Â Â Â Â Â if (acrtc->base.state->event) >>> -Â Â Â Â Â Â Â Â Â Â Â drm_send_event_locked(dev, &crtc->state->event->base); >>> +Â Â Â Â Â Â Â if (new_crtc_state->event) >>> +Â Â Â Â Â Â Â Â Â Â Â drm_send_event_locked(dev, &new_crtc_state->event->base); >>> Â -Â Â Â Â Â Â Â acrtc->base.state->event = NULL; >>> +Â Â Â Â Â Â Â new_crtc_state->event = NULL; >>> Â Â Â Â Â } >>> Â Â Â Â Â spin_unlock_irqrestore(&adev->ddev->event_lock, flags); >>> Â @@ -4371,7 +4375,7 @@ static int dm_update_crtcs_state( >>> Â Â Â Â Â Â Â Â Â bool *lock_and_validation_needed) >>> Â { >>> Â Â Â Â Â struct drm_crtc *crtc; >>> -Â Â Â struct drm_crtc_state *crtc_state; >>> +Â Â Â struct drm_crtc_state *old_crtc_state, *crtc_state; >>> Â Â Â Â Â int i; >>> Â Â Â Â Â struct dm_crtc_state *old_acrtc_state, *new_acrtc_state; >>> Â Â Â Â Â struct dm_atomic_state *dm_state = to_dm_atomic_state(state); >>> @@ -4380,7 +4384,7 @@ static int dm_update_crtcs_state( >>> Â Â Â Â Â Â /*TODO Move this code into dm_crtc_atomic_check once we get rid of dc_validation_set */ >>> Â Â Â Â Â /* update changed items */ >>> -Â Â Â for_each_new_crtc_in_state(state, crtc, crtc_state, i) { >>> +Â Â Â for_each_oldnew_crtc_in_state(state, crtc, old_crtc_state, crtc_state, i) { >>> Â Â Â Â Â Â Â Â Â struct amdgpu_crtc *acrtc = NULL; >>> Â Â Â Â Â Â Â Â Â struct amdgpu_dm_connector *aconnector = NULL; >>> Â Â Â Â Â Â Â Â Â struct drm_connector_state *conn_state = NULL; >>> @@ -4388,7 +4392,7 @@ static int dm_update_crtcs_state( >>> Â Â Â Â Â Â Â Â Â Â new_stream = NULL; >>> Â -Â Â Â Â Â Â Â old_acrtc_state = to_dm_crtc_state(crtc->state); >>> +Â Â Â Â Â Â Â old_acrtc_state = to_dm_crtc_state(old_crtc_state); >>> Â Â Â Â Â Â Â Â Â new_acrtc_state = to_dm_crtc_state(crtc_state); >>> Â Â Â Â Â Â Â Â Â acrtc = to_amdgpu_crtc(crtc); >>> Â @@ -4521,7 +4525,7 @@ static int dm_update_planes_state( >>> Â Â Â Â Â Â Â Â Â bool *lock_and_validation_needed) >>> Â { >>> Â Â Â Â Â struct drm_crtc *new_plane_crtc, *old_plane_crtc; >>> -Â Â Â struct drm_crtc_state *new_crtc_state; >>> +Â Â Â struct drm_crtc_state *old_crtc_state, *new_crtc_state; >>> Â Â Â Â Â struct drm_plane *plane; >>> Â Â Â Â Â struct drm_plane_state *old_plane_state, *new_plane_state; >>> Â Â Â Â Â struct dm_crtc_state *new_acrtc_state, *old_acrtc_state; >>> @@ -4552,10 +4556,9 @@ static int dm_update_planes_state( >>> Â Â Â Â Â Â Â Â Â Â Â Â Â if (!old_plane_crtc) >>> Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â continue; >>> Â -Â Â Â Â Â Â Â Â Â Â Â old_acrtc_state = to_dm_crtc_state( >>> -Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â drm_atomic_get_old_crtc_state( >>> -Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â state, >>> -Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â old_plane_crtc)); >>> +Â Â Â Â Â Â Â Â Â Â Â old_crtc_state = drm_atomic_get_old_crtc_state( >>> +Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â state, old_plane_crtc); >>> +Â Â Â Â Â Â Â Â Â Â Â old_acrtc_state = to_dm_crtc_state(old_crtc_state); >>> Â Â Â Â Â Â Â Â Â Â Â Â Â Â if (!old_acrtc_state->stream) >>> Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â continue; >>> @@ -4643,7 +4646,7 @@ int amdgpu_dm_atomic_check(struct drm_device *dev, >>> Â Â Â Â Â struct dc *dc = adev->dm.dc; >>> Â Â Â Â Â struct dm_atomic_state *dm_state = to_dm_atomic_state(state); >>> Â Â Â Â Â struct drm_connector *connector; >>> -Â Â Â struct drm_connector_state *conn_state; >>> +Â Â Â struct drm_connector_state *old_con_state, *conn_state; >>> Â Â Â Â Â struct drm_crtc *crtc; >>> Â Â Â Â Â struct drm_crtc_state *crtc_state; >>> Â @@ -4710,16 +4713,14 @@ int amdgpu_dm_atomic_check(struct drm_device *dev, >>> Â Â Â Â Â Â * new stream into context w\o causing full reset. Need to >>> Â Â Â Â Â Â * decide how to handle. >>> Â Â Â Â Â Â */ >>> -Â Â Â for_each_new_connector_in_state(state, connector, conn_state, i) { >>> -Â Â Â Â Â Â Â struct amdgpu_dm_connector *aconnector = to_amdgpu_dm_connector(connector); >>> -Â Â Â Â Â Â Â struct dm_connector_state *con_old_state = >>> -Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â to_dm_connector_state(aconnector->base.state); >>> -Â Â Â Â Â Â Â struct dm_connector_state *con_new_state = >>> -Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â to_dm_connector_state(conn_state); >>> +Â Â Â for_each_oldnew_connector_in_state(state, connector, old_con_state, conn_state, i) { >>> +Â Â Â Â Â Â Â struct dm_connector_state *con_old_state = to_dm_connector_state(old_con_state); >>> +Â Â Â Â Â Â Â struct dm_connector_state *con_new_state = to_dm_connector_state(conn_state); >>> Â Â Â Â Â Â Â Â Â struct amdgpu_crtc *acrtc = to_amdgpu_crtc(con_new_state->base.crtc); >>> Â Â Â Â Â Â Â Â Â Â /* Skip any modesets/resets */ >>> -Â Â Â Â Â Â Â if (!acrtc || drm_atomic_crtc_needs_modeset(acrtc->base.state)) >>> +Â Â Â Â Â Â Â if (!acrtc || drm_atomic_crtc_needs_modeset( >>> +Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â drm_atomic_get_new_crtc_state(state, &acrtc->base))) >>> Â Â Â Â Â Â Â Â Â Â Â Â Â continue; >>> Â Â Â Â Â Â Â Â Â Â /* Skip any thing not scale or underscan changes */ >>> >