Commit 2fc04340 authored by Tomi Valkeinen's avatar Tomi Valkeinen Committed by Linus Walleij
Browse files

drm/tidss: Fix enable/disable order



TI's OLDI and DSI encoders need to be set up before the crtc is enabled,
but the DRM helpers will enable the crtc first. This causes various
issues on TI platforms, like visual artifacts or crtc sync lost
warnings.

Thus drm_atomic_helper_commit_modeset_enables() and
drm_atomic_helper_commit_modeset_disables() cannot be used, as they
enable the crtc before bridges' pre-enable, and disable the crtc after
bridges' post-disable.

Open code the drm_atomic_helper_commit_modeset_enables() and
drm_atomic_helper_commit_modeset_disables(), and first call the bridges'
pre-enables, then crtc enable, then bridges' post-enable (and vice versa
for disable).

Signed-off-by: default avatarTomi Valkeinen <tomi.valkeinen@ideasonboard.com>
Cc: stable@vger.kernel.org # v6.17+
Fixes: c9b1150a ("drm/atomic-helper: Re-order bridge chain pre-enable and post-disable")
Reviewed-by: default avatarAradhya Bhatia <aradhya.bhatia@linux.dev>
Reviewed-by: default avatarMaxime Ripard <mripard@kernel.org>
Reviewed-by: default avatarLinus Walleij <linusw@kernel.org>
Tested-by: default avatarLinus Walleij <linusw@kernel.org>
Signed-off-by: default avatarLinus Walleij <linusw@kernel.org>
Link: https://patch.msgid.link/20251205-drm-seq-fix-v1-4-fda68fa1b3de@ideasonboard.com
parent d1c7dc57
Loading
Loading
Loading
Loading
+27 −3
Original line number Diff line number Diff line
@@ -26,9 +26,33 @@ static void tidss_atomic_commit_tail(struct drm_atomic_state *old_state)

	tidss_runtime_get(tidss);

	drm_atomic_helper_commit_modeset_disables(ddev, old_state);
	drm_atomic_helper_commit_planes(ddev, old_state, DRM_PLANE_COMMIT_ACTIVE_ONLY);
	drm_atomic_helper_commit_modeset_enables(ddev, old_state);
	/*
	 * TI's OLDI and DSI encoders need to be set up before the crtc is
	 * enabled. Thus drm_atomic_helper_commit_modeset_enables() and
	 * drm_atomic_helper_commit_modeset_disables() cannot be used here, as
	 * they enable the crtc before bridges' pre-enable, and disable the crtc
	 * after bridges' post-disable.
	 *
	 * Open code the functions here and first call the bridges' pre-enables,
	 * then crtc enable, then bridges' post-enable (and vice versa for
	 * disable).
	 */

	drm_atomic_helper_commit_encoder_bridge_disable(ddev, old_state);
	drm_atomic_helper_commit_crtc_disable(ddev, old_state);
	drm_atomic_helper_commit_encoder_bridge_post_disable(ddev, old_state);

	drm_atomic_helper_update_legacy_modeset_state(ddev, old_state);
	drm_atomic_helper_calc_timestamping_constants(old_state);
	drm_atomic_helper_commit_crtc_set_mode(ddev, old_state);

	drm_atomic_helper_commit_planes(ddev, old_state,
					DRM_PLANE_COMMIT_ACTIVE_ONLY);

	drm_atomic_helper_commit_encoder_bridge_pre_enable(ddev, old_state);
	drm_atomic_helper_commit_crtc_enable(ddev, old_state);
	drm_atomic_helper_commit_encoder_bridge_enable(ddev, old_state);
	drm_atomic_helper_commit_writebacks(ddev, old_state);

	drm_atomic_helper_commit_hw_done(old_state);
	drm_atomic_helper_wait_for_flip_done(ddev, old_state);