commit c9b1150a68d9362a0827609fc0dc1664c0d8bfe1 "drm/atomic-helper: Re-order bridge chain pre-enable and post-disable" caused a series of regressions in all panels that send DSI commands in their .prepare() and .unprepare() callbacks when used with MCDE.
As the CRTC is no longer online at bridge_pre_enable() and gone at brige_post_disable() which maps to the panel bridge .prepare()/.unprepare() callbacks, any CRTC that enable/disable the DSI transmitter in it's enable/disable callbacks will be unable to send any DSI commands in the .prepare() and .unprepare() callbacks. However the MCDE driver definitely need the CRTC to be enabled during .prepare()/.unprepare(). Solve this by implementing a custom commit tail function in the MCDE driver that always enables the CRTC first and disables it last, using the newly exported helpers. Link: https://lore.kernel.org/dri-devel/[email protected]/ Link: https://lore.kernel.org/all/20251107230517.471894-1-marek.vasut%2Brenesas%40mailbox.org/ Fixes: c9b1150a68d9 ("drm/atomic-helper: Re-order bridge chain pre-enable and post-disable") Signed-off-by: Linus Walleij <[email protected]> --- drivers/gpu/drm/mcde/mcde_drv.c | 37 ++++++++++++++++++++++++++++++++++++- 1 file changed, 36 insertions(+), 1 deletion(-) diff --git a/drivers/gpu/drm/mcde/mcde_drv.c b/drivers/gpu/drm/mcde/mcde_drv.c index 5f2c462bad7e..290082c86100 100644 --- a/drivers/gpu/drm/mcde/mcde_drv.c +++ b/drivers/gpu/drm/mcde/mcde_drv.c @@ -100,13 +100,48 @@ static const struct drm_mode_config_funcs mcde_mode_config_funcs = { .atomic_commit = drm_atomic_helper_commit, }; +/* + * This commit tail explicitly copies and changes the behaviour of + * the related core DRM atomic helper instead of trying to make + * the core helpers overly generic. + */ +static void mcde_atomic_commit_tail(struct drm_atomic_state *state) +{ + struct drm_device *dev = state->dev; + + /* Variant of drm_atomic_helper_commit_modeset_disables() */ + drm_encoder_bridge_disable(dev, state); + drm_encoder_bridge_post_disable(dev, state); + drm_crtc_disable(dev, state); + drm_atomic_helper_update_legacy_modeset_state(dev, state); + drm_atomic_helper_calc_timestamping_constants(state); + drm_crtc_set_mode(dev, state); + + /* Variant of drm_atomic_helper_commit_modeset_enables() */ + drm_crtc_enable(dev, state); + drm_encoder_bridge_pre_enable(dev, state); + drm_encoder_bridge_enable(dev, state); + drm_atomic_helper_commit_writebacks(dev, state); + + drm_atomic_helper_commit_planes(dev, state, + DRM_PLANE_COMMIT_ACTIVE_ONLY); + + drm_atomic_helper_fake_vblank(state); + + drm_atomic_helper_commit_hw_done(state); + + drm_atomic_helper_wait_for_vblanks(dev, state); + + drm_atomic_helper_cleanup_planes(dev, state); +} + static const struct drm_mode_config_helper_funcs mcde_mode_config_helpers = { /* * Using this function is necessary to commit atomic updates * that need the CRTC to be enabled before a commit, as is * the case with e.g. DSI displays. */ - .atomic_commit_tail = drm_atomic_helper_commit_tail_rpm, + .atomic_commit_tail = mcde_atomic_commit_tail, }; static irqreturn_t mcde_irq(int irq, void *data) -- 2.51.1
