@@ -828,6 +828,15 @@ static int dpu_encoder_virt_atomic_check(
global_state, crtc_state);
}
+ if (crtc_state->ctm) {
+ struct dpu_crtc_state *cstate = to_dpu_crtc_state(crtc_state);
+ int i;
+
+ for (i = 0; i < cstate->num_mixers; i++)
+ if (!cstate->mixers[i].hw_dspp)
+ return -EINVAL;
+ }
+
trace_dpu_enc_atomic_check_flags(DRMID(drm_enc), adj_mode->flags);
return ret;
@@ -189,17 +189,11 @@ int msm_atomic_check(struct drm_device *dev, struct drm_atomic_state *state)
struct drm_crtc *crtc;
int i, ret = 0;
- /*
- * FIXME: stop setting allow_modeset and move this check to the DPU
- * driver.
- */
for_each_oldnew_crtc_in_state(state, crtc, old_crtc_state,
new_crtc_state, i) {
- if ((old_crtc_state->ctm && !new_crtc_state->ctm) ||
- (!old_crtc_state->ctm && new_crtc_state->ctm)) {
+ if ((!!old_crtc_state->ctm != !!new_crtc_state->ctm) &&
+ state->allow_modeset)
new_crtc_state->mode_changed = true;
- state->allow_modeset = true;
- }
}
if (kms && kms->funcs && kms->funcs->check_mode_changed)
As pointed out by the commit c5e3306a424b ("drm/atomic: clarify the rules around drm_atomic_state->allow_modeset"), the drivers are now allowed to set the drm_atomic_state.allow_modeset flag, as it might break userspace API. Stop upgrading the commit to full modeset. Instead set the drm_crtc_state.mode_changed if modeset is allowed and if CTM has been enabled or disabled AND check that DSPPs are assigned to the CRTC if CTM is enabled. NOTE: This change has userspace impact, as now non-modeset commits which enable CTM will fail. Fixes: 82836692d5d7 ("drm/msm/dpu: manage DPU resources if CTM is requested") Reported-by: Simona Vetter <simona.vetter@ffwll.ch> Closes: https://lore.kernel.org/r/20231010170746.617366-1-daniel.vetter@ffwll.ch/ Signed-off-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org> --- drivers/gpu/drm/msm/disp/dpu1/dpu_encoder.c | 9 +++++++++ drivers/gpu/drm/msm/msm_atomic.c | 10 ++-------- 2 files changed, 11 insertions(+), 8 deletions(-)