For the msm/dpu driver if the CTM gets enabled or disabled, the CRTC should perform resource reallocation (to get or to free the DSPP). This requires performing a full CRTC modeset. Current code sets drm_crtc_state.mode_changed from the msm_atomic_check(), from the generic code path. Move the check to the new atomic_needs_modeset() callback, removing the need to set the flag from the generic code path. Signed-off-by: Dmitry Baryshkov <dmitry.baryshkov@xxxxxxxxxx> --- drivers/gpu/drm/msm/disp/dpu1/dpu_crtc.c | 15 +++++++++++++++ drivers/gpu/drm/msm/msm_atomic.c | 11 +---------- 2 files changed, 16 insertions(+), 10 deletions(-) diff --git a/drivers/gpu/drm/msm/disp/dpu1/dpu_crtc.c b/drivers/gpu/drm/msm/disp/dpu1/dpu_crtc.c index 65e33eba61726929b740831c95330756b2817e28..9a990386570e037f2b1c994a0140f2b7c4c84669 100644 --- a/drivers/gpu/drm/msm/disp/dpu1/dpu_crtc.c +++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_crtc.c @@ -1189,6 +1189,20 @@ static bool dpu_crtc_needs_dirtyfb(struct drm_crtc_state *cstate) return false; } +static bool dpu_crtc_atomic_needs_modeset(struct drm_crtc *crtc, + struct drm_atomic_state *state) +{ + struct drm_crtc_state *old_crtc_state, *new_crtc_state; + + if (!state->allow_modeset) + return false; + + old_crtc_state = drm_atomic_get_old_crtc_state(state, crtc); + new_crtc_state = drm_atomic_get_new_crtc_state(state, crtc); + + return !!old_crtc_state->ctm != !!new_crtc_state->ctm; +} + static int dpu_crtc_reassign_planes(struct drm_crtc *crtc, struct drm_crtc_state *crtc_state) { int total_planes = crtc->dev->mode_config.num_total_plane; @@ -1535,6 +1549,7 @@ static const struct drm_crtc_funcs dpu_crtc_funcs = { static const struct drm_crtc_helper_funcs dpu_crtc_helper_funcs = { .atomic_disable = dpu_crtc_disable, .atomic_enable = dpu_crtc_enable, + .atomic_needs_modeset = dpu_crtc_atomic_needs_modeset, .atomic_check = dpu_crtc_atomic_check, .atomic_begin = dpu_crtc_atomic_begin, .atomic_flush = dpu_crtc_atomic_flush, diff --git a/drivers/gpu/drm/msm/msm_atomic.c b/drivers/gpu/drm/msm/msm_atomic.c index fdbe49edf2e1506ebeab500e782d456d77ba4fcf..4377233bd6447060b1300cc0d6877b6a777b1edb 100644 --- a/drivers/gpu/drm/msm/msm_atomic.c +++ b/drivers/gpu/drm/msm/msm_atomic.c @@ -185,16 +185,7 @@ int msm_atomic_check(struct drm_device *dev, struct drm_atomic_state *state) { struct msm_drm_private *priv = dev->dev_private; struct msm_kms *kms = priv->kms; - struct drm_crtc_state *old_crtc_state, *new_crtc_state; - struct drm_crtc *crtc; - int i, ret = 0; - - for_each_oldnew_crtc_in_state(state, crtc, old_crtc_state, - new_crtc_state, i) { - if ((!!old_crtc_state->ctm != !!new_crtc_state->ctm) && - state->allow_modeset) - new_crtc_state->mode_changed = true; - } + int ret = 0; if (kms && kms->funcs && kms->funcs->check_mode_changed) ret = kms->funcs->check_mode_changed(kms, state); -- 2.39.5