From 43c76d72ea853ccaeb22a497c13d3cd946869ec6 Mon Sep 17 00:00:00 2001 From: Sean Paul Date: Tue, 11 Jun 2019 16:49:53 -0400 Subject: drm: Add atomic variants of enable/disable to encoder helper funcs MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This patch adds atomic_enable and atomic_disable callbacks to the encoder helpers. This will allow encoders to make informed decisions in their start-up/shutdown based on the committed state. Aside from the new hooks, this patch also introduces the new signature for .atomic_* functions going forward. Instead of passing object state (well, encoders don't have atomic state, but let's ignore that), we pass the entire atomic state so the driver can inspect more than what's happening locally. This is particularly important for the upcoming self refresh helpers. Changes in v3: - Added patch to the set Changes in v4: - Move atomic_disable above prepare (Daniel) - Add breadcrumb to .enable() docbook (Daniel) Changes in v5: - None Changes in v6: - Tweak kerneldoc some more (Sam) Link to v3: https://patchwork.freedesktop.org/patch/msgid/20190502194956.218441-2-sean@poorly.run Link to v4: https://patchwork.freedesktop.org/patch/msgid/20190508160920.144739-2-sean@poorly.run Link to v5: https://patchwork.freedesktop.org/patch/msgid/20190611160844.257498-2-sean@poorly.run Cc: Daniel Vetter Cc: Ville Syrjälä Cc: Sam Ravnborg Tested-by: Heiko Stuebner Reviewed-by: Daniel Vetter Signed-off-by: Sean Paul Link: https://patchwork.freedesktop.org/patch/msgid/20190611204959.180855-1-sean@poorly.run --- include/drm/drm_modeset_helper_vtables.h | 49 ++++++++++++++++++++++++++++++++ 1 file changed, 49 insertions(+) (limited to 'include/drm/drm_modeset_helper_vtables.h') diff --git a/include/drm/drm_modeset_helper_vtables.h b/include/drm/drm_modeset_helper_vtables.h index df80131bb10f..13f0e3ca0a29 100644 --- a/include/drm/drm_modeset_helper_vtables.h +++ b/include/drm/drm_modeset_helper_vtables.h @@ -679,6 +679,52 @@ struct drm_encoder_helper_funcs { enum drm_connector_status (*detect)(struct drm_encoder *encoder, struct drm_connector *connector); + /** + * @atomic_disable: + * + * This callback should be used to disable the encoder. With the atomic + * drivers it is called before this encoder's CRTC has been shut off + * using their own &drm_crtc_helper_funcs.atomic_disable hook. If that + * sequence is too simple drivers can just add their own driver private + * encoder hooks and call them from CRTC's callback by looping over all + * encoders connected to it using for_each_encoder_on_crtc(). + * + * This callback is a variant of @disable that provides the atomic state + * to the driver. If @atomic_disable is implemented, @disable is not + * called by the helpers. + * + * This hook is only used by atomic helpers. Atomic drivers don't need + * to implement it if there's no need to disable anything at the encoder + * level. To ensure that runtime PM handling (using either DPMS or the + * new "ACTIVE" property) works @atomic_disable must be the inverse of + * @atomic_enable. + */ + void (*atomic_disable)(struct drm_encoder *encoder, + struct drm_atomic_state *state); + + /** + * @atomic_enable: + * + * This callback should be used to enable the encoder. It is called + * after this encoder's CRTC has been enabled using their own + * &drm_crtc_helper_funcs.atomic_enable hook. If that sequence is + * too simple drivers can just add their own driver private encoder + * hooks and call them from CRTC's callback by looping over all encoders + * connected to it using for_each_encoder_on_crtc(). + * + * This callback is a variant of @enable that provides the atomic state + * to the driver. If @atomic_enable is implemented, @enable is not + * called by the helpers. + * + * This hook is only used by atomic helpers, it is the opposite of + * @atomic_disable. Atomic drivers don't need to implement it if there's + * no need to enable anything at the encoder level. To ensure that + * runtime PM handling works @atomic_enable must be the inverse of + * @atomic_disable. + */ + void (*atomic_enable)(struct drm_encoder *encoder, + struct drm_atomic_state *state); + /** * @disable: * @@ -695,6 +741,9 @@ struct drm_encoder_helper_funcs { * handling (using either DPMS or the new "ACTIVE" property) works * @disable must be the inverse of @enable for atomic drivers. * + * For atomic drivers also consider @atomic_disable and save yourself + * from having to read the NOTE below! + * * NOTE: * * With legacy CRTC helpers there's a big semantic difference between -- cgit v1.2.3