@@ -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,
@@ -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);
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@linaro.org> --- 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(-)