diff mbox

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

Message ID 1471599419-29009-2-git-send-email-gnuiyl@gmail.com (mailing list archive)
State New, archived
Headers show

Commit Message

Ying Liu Aug. 19, 2016, 9:36 a.m. UTC
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@ffwll.ch>
Cc: Philipp Zabel <p.zabel@pengutronix.de>
Cc: David Airlie <airlied@linux.ie>
Cc: Russell King <linux@armlinux.org.uk>
Cc: Daniel Vetter <daniel.vetter@ffwll.ch>
Cc: Peter Senna Tschudin <peter.senna@gmail.com>
Cc: Lucas Stach <l.stach@pengutronix.de>
Signed-off-by: Liu Ying <gnuiyl@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(+)

Comments

Daniel Vetter Aug. 22, 2016, 7:01 a.m. UTC | #1
On Fri, Aug 19, 2016 at 05:36:57PM +0800, Liu Ying wrote:
> 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@ffwll.ch>
> Cc: Philipp Zabel <p.zabel@pengutronix.de>
> Cc: David Airlie <airlied@linux.ie>
> Cc: Russell King <linux@armlinux.org.uk>
> Cc: Daniel Vetter <daniel.vetter@ffwll.ch>
> Cc: Peter Senna Tschudin <peter.senna@gmail.com>
> Cc: Lucas Stach <l.stach@pengutronix.de>
> Signed-off-by: Liu Ying <gnuiyl@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.

kernel-doc is a bit lacking compared to the one for @disable. And I think
on top of that it should explain better the difference with @disable (and
@disable should reference @atomic_disable too).
-Daniel

> +	 */
> +	void (*atomic_disable)(struct drm_crtc *crtc,
> +			       struct drm_crtc_state *old_crtc_state);
>  };
>  
>  /**
> -- 
> 2.7.4
>
Ying Liu Aug. 22, 2016, 7:37 a.m. UTC | #2
On Mon, Aug 22, 2016 at 3:01 PM, Daniel Vetter <daniel@ffwll.ch> wrote:
> On Fri, Aug 19, 2016 at 05:36:57PM +0800, Liu Ying wrote:
>> 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@ffwll.ch>
>> Cc: Philipp Zabel <p.zabel@pengutronix.de>
>> Cc: David Airlie <airlied@linux.ie>
>> Cc: Russell King <linux@armlinux.org.uk>
>> Cc: Daniel Vetter <daniel.vetter@ffwll.ch>
>> Cc: Peter Senna Tschudin <peter.senna@gmail.com>
>> Cc: Lucas Stach <l.stach@pengutronix.de>
>> Signed-off-by: Liu Ying <gnuiyl@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.
>
> kernel-doc is a bit lacking compared to the one for @disable. And I think
> on top of that it should explain better the difference with @disable (and
> @disable should reference @atomic_disable too).

Will improve the kernel-doc in the next version.  Thanks.

Regards,
Liu Ying

> -Daniel
>
>> +      */
>> +     void (*atomic_disable)(struct drm_crtc *crtc,
>> +                            struct drm_crtc_state *old_crtc_state);
>>  };
>>
>>  /**
>> --
>> 2.7.4
>>
>
> --
> Daniel Vetter
> Software Engineer, Intel Corporation
> http://blog.ffwll.ch
Daniel Vetter Aug. 22, 2016, 7:54 a.m. UTC | #3
On Mon, Aug 22, 2016 at 9:37 AM, Ying Liu <gnuiyl@gmail.com> wrote:
>> kernel-doc is a bit lacking compared to the one for @disable. And I think
>> on top of that it should explain better the difference with @disable (and
>> @disable should reference @atomic_disable too).
>
> Will improve the kernel-doc in the next version.  Thanks.

For consistency pls start out with a copy of the exact text for
@disable (minus the note which is only relevant for legacy crtc
helpers ofc).
-Daniel
diff mbox

Patch

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);
 };
 
 /**