The CRTC .prepare() helper operation is legacy code, drivers should use the .atomic_disable() operation instead. When a CRTC is temporarily disabled prior to a mode set, the atomic helpers call the .prepare() operation if provided instead of the .atomic_disable() operation. In order to avoid modifying the driver's behaviour that has an empty .prepare() implementation, we need to return from the .atomic_disable() operation without performing any action if the CRTC will be reenabled. Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas@xxxxxxxxxxxxxxxx> --- drivers/gpu/drm/vmwgfx/vmwgfx_scrn.c | 15 +++------------ drivers/gpu/drm/vmwgfx/vmwgfx_stdu.c | 10 +++------- 2 files changed, 6 insertions(+), 19 deletions(-) This patch is based on top of "[PATCH 0/8] Cleanup CRTC .enable()/.disable() cargo-cult". diff --git a/drivers/gpu/drm/vmwgfx/vmwgfx_scrn.c b/drivers/gpu/drm/vmwgfx/vmwgfx_scrn.c index 854403509216..bdf6349de250 100644 --- a/drivers/gpu/drm/vmwgfx/vmwgfx_scrn.c +++ b/drivers/gpu/drm/vmwgfx/vmwgfx_scrn.c @@ -259,17 +259,6 @@ static void vmw_sou_crtc_mode_set_nofb(struct drm_crtc *crtc) } /** - * vmw_sou_crtc_helper_prepare - Noop - * - * @crtc: CRTC associated with the new screen - * - * Prepares the CRTC for a mode set, but we don't need to do anything here. - */ -static void vmw_sou_crtc_helper_prepare(struct drm_crtc *crtc) -{ -} - -/** * vmw_sou_crtc_atomic_enable - Noop * * @crtc: CRTC associated with the new screen @@ -299,6 +288,9 @@ static void vmw_sou_crtc_atomic_disable(struct drm_crtc *crtc, return; } + if (crtc->state->enable) + return; + sou = vmw_crtc_to_sou(crtc); dev_priv = vmw_priv(crtc->dev); @@ -574,7 +566,6 @@ drm_plane_helper_funcs vmw_sou_primary_plane_helper_funcs = { }; static const struct drm_crtc_helper_funcs vmw_sou_crtc_helper_funcs = { - .prepare = vmw_sou_crtc_helper_prepare, .mode_set_nofb = vmw_sou_crtc_mode_set_nofb, .atomic_check = vmw_du_crtc_atomic_check, .atomic_begin = vmw_du_crtc_atomic_begin, diff --git a/drivers/gpu/drm/vmwgfx/vmwgfx_stdu.c b/drivers/gpu/drm/vmwgfx/vmwgfx_stdu.c index ed9404a7f457..c3bd4a012b64 100644 --- a/drivers/gpu/drm/vmwgfx/vmwgfx_stdu.c +++ b/drivers/gpu/drm/vmwgfx/vmwgfx_stdu.c @@ -406,12 +406,6 @@ static void vmw_stdu_crtc_mode_set_nofb(struct drm_crtc *crtc) crtc->x, crtc->y); } - -static void vmw_stdu_crtc_helper_prepare(struct drm_crtc *crtc) -{ -} - - static void vmw_stdu_crtc_atomic_enable(struct drm_crtc *crtc, struct drm_crtc_state *old_state) { @@ -446,6 +440,9 @@ static void vmw_stdu_crtc_atomic_disable(struct drm_crtc *crtc, return; } + if (crtc->state->enable) + return; + stdu = vmw_crtc_to_stdu(crtc); dev_priv = vmw_priv(crtc->dev); @@ -1416,7 +1413,6 @@ drm_plane_helper_funcs vmw_stdu_primary_plane_helper_funcs = { }; static const struct drm_crtc_helper_funcs vmw_stdu_crtc_helper_funcs = { - .prepare = vmw_stdu_crtc_helper_prepare, .mode_set_nofb = vmw_stdu_crtc_mode_set_nofb, .atomic_check = vmw_du_crtc_atomic_check, .atomic_begin = vmw_du_crtc_atomic_begin, -- Regards, Laurent Pinchart _______________________________________________ dri-devel mailing list dri-devel@xxxxxxxxxxxxxxxxxxxxx https://lists.freedesktop.org/mailman/listinfo/dri-devel