[PATCH v3 1/3] drm/atomic-helper: Add atomic_disable CRTC helper callback

Liu Ying gnuiyl at gmail.com
Fri Aug 19 09:36:57 UTC 2016


Some display controllers need plane(s) to be disabled together with
the relevant CRTC, e.g., the IPUv3 display controller for imx-drm.
This patch adds atomic_disable CRTC helper callback so that
old_crtc_state(as a parameter of the callback) could be used
to get all appropriate active plane(s) of the old CRTC state for
disable operation.

Suggested-by: Daniel Vetter <daniel.vetter at ffwll.ch>
Cc: Philipp Zabel <p.zabel at pengutronix.de>
Cc: David Airlie <airlied at linux.ie>
Cc: Russell King <linux at armlinux.org.uk>
Cc: Daniel Vetter <daniel.vetter at ffwll.ch>
Cc: Peter Senna Tschudin <peter.senna at gmail.com>
Cc: Lucas Stach <l.stach at pengutronix.de>
Signed-off-by: Liu Ying <gnuiyl at gmail.com>
---
v3:
* Newly introduced in v3.

 drivers/gpu/drm/drm_atomic_helper.c      |  2 ++
 include/drm/drm_modeset_helper_vtables.h | 14 ++++++++++++++
 2 files changed, 16 insertions(+)

diff --git a/drivers/gpu/drm/drm_atomic_helper.c b/drivers/gpu/drm/drm_atomic_helper.c
index 9abe0a2..254bdde 100644
--- a/drivers/gpu/drm/drm_atomic_helper.c
+++ b/drivers/gpu/drm/drm_atomic_helper.c
@@ -749,6 +749,8 @@ disable_outputs(struct drm_device *dev, struct drm_atomic_state *old_state)
 		/* Right function depends upon target state. */
 		if (crtc->state->enable && funcs->prepare)
 			funcs->prepare(crtc);
+		else if (funcs->atomic_disable)
+			 funcs->atomic_disable(crtc, old_crtc_state);
 		else if (funcs->disable)
 			funcs->disable(crtc);
 		else
diff --git a/include/drm/drm_modeset_helper_vtables.h b/include/drm/drm_modeset_helper_vtables.h
index 686feec..16fd918 100644
--- a/include/drm/drm_modeset_helper_vtables.h
+++ b/include/drm/drm_modeset_helper_vtables.h
@@ -391,6 +391,20 @@ struct drm_crtc_helper_funcs {
 	 */
 	void (*atomic_flush)(struct drm_crtc *crtc,
 			     struct drm_crtc_state *old_crtc_state);
+
+	/**
+	 * @atomic_disable:
+	 *
+	 * This callback should be used to disable the CRTC. It is called
+	 * after all encoders connected to this CRTC have been shut off
+	 * already using their own ->disable hook.
+	 *
+	 * This hook is used only by atomic helpers. Atomic drivers don't
+	 * need to implement it if there's no need to disable anything at the
+	 * CRTC level.
+	 */
+	void (*atomic_disable)(struct drm_crtc *crtc,
+			       struct drm_crtc_state *old_crtc_state);
 };
 
 /**
-- 
2.7.4



More information about the dri-devel mailing list