linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH V2] drm/atomic-helper: Make atomic_enable/disable crtc callbacks optional
@ 2019-03-14 18:48 Rodrigo Siqueira
  2019-03-15 11:00 ` Daniel Vetter
  0 siblings, 1 reply; 5+ messages in thread
From: Rodrigo Siqueira @ 2019-03-14 18:48 UTC (permalink / raw)
  To: Maarten Lankhorst, Maxime Ripard, Sean Paul, David Airlie,
	Daniel Vetter, Gerd Hoffmann
  Cc: dri-devel, linux-kernel

Allow atomic_enable and atomic_disable operations from
drm_crtc_helper_funcs struct optional. With this, the target display
drivers don't need to define a dummy function if they don't need one.

Changes since v2:
* Don't make funcs optional
* Update kerneldoc for atomic_enable/disable
* Replace "if (funcs->atomic_enable)" by "if (funcs->commit)"
* Improve commit message

Signed-off-by: Rodrigo Siqueira <rodrigosiqueiramelo@gmail.com>
---
 drivers/gpu/drm/drm_atomic_helper.c      | 5 ++---
 include/drm/drm_modeset_helper_vtables.h | 4 ++++
 2 files changed, 6 insertions(+), 3 deletions(-)

diff --git a/drivers/gpu/drm/drm_atomic_helper.c b/drivers/gpu/drm/drm_atomic_helper.c
index 540a77a2ade9..d506e13c2945 100644
--- a/drivers/gpu/drm/drm_atomic_helper.c
+++ b/drivers/gpu/drm/drm_atomic_helper.c
@@ -1034,7 +1034,7 @@ disable_outputs(struct drm_device *dev, struct drm_atomic_state *old_state)
 			funcs->atomic_disable(crtc, old_crtc_state);
 		else if (funcs->disable)
 			funcs->disable(crtc);
-		else
+		else if (funcs->dpms)
 			funcs->dpms(crtc, DRM_MODE_DPMS_OFF);
 
 		if (!(dev->irq_enabled && dev->num_crtcs))
@@ -1277,10 +1277,9 @@ void drm_atomic_helper_commit_modeset_enables(struct drm_device *dev,
 		if (new_crtc_state->enable) {
 			DRM_DEBUG_ATOMIC("enabling [CRTC:%d:%s]\n",
 					 crtc->base.id, crtc->name);
-
 			if (funcs->atomic_enable)
 				funcs->atomic_enable(crtc, old_crtc_state);
-			else
+			else if (funcs->commit)
 				funcs->commit(crtc);
 		}
 	}
diff --git a/include/drm/drm_modeset_helper_vtables.h b/include/drm/drm_modeset_helper_vtables.h
index cfb7be40bed7..ce4de6b1e444 100644
--- a/include/drm/drm_modeset_helper_vtables.h
+++ b/include/drm/drm_modeset_helper_vtables.h
@@ -418,6 +418,8 @@ struct drm_crtc_helper_funcs {
 	 * Drivers can use the @old_crtc_state input parameter if the operations
 	 * needed to enable the CRTC don't depend solely on the new state but
 	 * also on the transition between the old state and the new state.
+	 *
+	 * This function is optional.
 	 */
 	void (*atomic_enable)(struct drm_crtc *crtc,
 			      struct drm_crtc_state *old_crtc_state);
@@ -441,6 +443,8 @@ struct drm_crtc_helper_funcs {
 	 * parameter @old_crtc_state which could be used to access the old
 	 * state. Atomic drivers should consider to use this one instead
 	 * of @disable.
+	 *
+	 * This function is optional.
 	 */
 	void (*atomic_disable)(struct drm_crtc *crtc,
 			       struct drm_crtc_state *old_crtc_state);
-- 
2.21.0

^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH V2] drm/atomic-helper: Make atomic_enable/disable crtc callbacks optional
  2019-03-14 18:48 [PATCH V2] drm/atomic-helper: Make atomic_enable/disable crtc callbacks optional Rodrigo Siqueira
@ 2019-03-15 11:00 ` Daniel Vetter
  2019-03-25 11:29   ` Rodrigo Siqueira
  0 siblings, 1 reply; 5+ messages in thread
From: Daniel Vetter @ 2019-03-15 11:00 UTC (permalink / raw)
  To: Rodrigo Siqueira
  Cc: Maarten Lankhorst, Maxime Ripard, Sean Paul, David Airlie,
	Daniel Vetter, Gerd Hoffmann, dri-devel, linux-kernel

On Thu, Mar 14, 2019 at 03:48:45PM -0300, Rodrigo Siqueira wrote:
> Allow atomic_enable and atomic_disable operations from
> drm_crtc_helper_funcs struct optional. With this, the target display
> drivers don't need to define a dummy function if they don't need one.
> 
> Changes since v2:
> * Don't make funcs optional
> * Update kerneldoc for atomic_enable/disable
> * Replace "if (funcs->atomic_enable)" by "if (funcs->commit)"
> * Improve commit message
> 
> Signed-off-by: Rodrigo Siqueira <rodrigosiqueiramelo@gmail.com>

Reviewed-by: Daniel Vetter <daniel.vetter@ffwll.ch>

> ---
>  drivers/gpu/drm/drm_atomic_helper.c      | 5 ++---
>  include/drm/drm_modeset_helper_vtables.h | 4 ++++
>  2 files changed, 6 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/gpu/drm/drm_atomic_helper.c b/drivers/gpu/drm/drm_atomic_helper.c
> index 540a77a2ade9..d506e13c2945 100644
> --- a/drivers/gpu/drm/drm_atomic_helper.c
> +++ b/drivers/gpu/drm/drm_atomic_helper.c
> @@ -1034,7 +1034,7 @@ disable_outputs(struct drm_device *dev, struct drm_atomic_state *old_state)
>  			funcs->atomic_disable(crtc, old_crtc_state);
>  		else if (funcs->disable)
>  			funcs->disable(crtc);
> -		else
> +		else if (funcs->dpms)
>  			funcs->dpms(crtc, DRM_MODE_DPMS_OFF);
>  
>  		if (!(dev->irq_enabled && dev->num_crtcs))
> @@ -1277,10 +1277,9 @@ void drm_atomic_helper_commit_modeset_enables(struct drm_device *dev,
>  		if (new_crtc_state->enable) {
>  			DRM_DEBUG_ATOMIC("enabling [CRTC:%d:%s]\n",
>  					 crtc->base.id, crtc->name);
> -
>  			if (funcs->atomic_enable)
>  				funcs->atomic_enable(crtc, old_crtc_state);
> -			else
> +			else if (funcs->commit)
>  				funcs->commit(crtc);
>  		}
>  	}
> diff --git a/include/drm/drm_modeset_helper_vtables.h b/include/drm/drm_modeset_helper_vtables.h
> index cfb7be40bed7..ce4de6b1e444 100644
> --- a/include/drm/drm_modeset_helper_vtables.h
> +++ b/include/drm/drm_modeset_helper_vtables.h
> @@ -418,6 +418,8 @@ struct drm_crtc_helper_funcs {
>  	 * Drivers can use the @old_crtc_state input parameter if the operations
>  	 * needed to enable the CRTC don't depend solely on the new state but
>  	 * also on the transition between the old state and the new state.
> +	 *
> +	 * This function is optional.
>  	 */
>  	void (*atomic_enable)(struct drm_crtc *crtc,
>  			      struct drm_crtc_state *old_crtc_state);
> @@ -441,6 +443,8 @@ struct drm_crtc_helper_funcs {
>  	 * parameter @old_crtc_state which could be used to access the old
>  	 * state. Atomic drivers should consider to use this one instead
>  	 * of @disable.
> +	 *
> +	 * This function is optional.
>  	 */
>  	void (*atomic_disable)(struct drm_crtc *crtc,
>  			       struct drm_crtc_state *old_crtc_state);
> -- 
> 2.21.0

-- 
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH V2] drm/atomic-helper: Make atomic_enable/disable crtc callbacks optional
  2019-03-15 11:00 ` Daniel Vetter
@ 2019-03-25 11:29   ` Rodrigo Siqueira
  2019-03-26  7:50     ` Daniel Vetter
  0 siblings, 1 reply; 5+ messages in thread
From: Rodrigo Siqueira @ 2019-03-25 11:29 UTC (permalink / raw)
  To: Maarten Lankhorst, Maxime Ripard, Sean Paul, David Airlie,
	Gerd Hoffmann, dri-devel, linux-kernel

[-- Attachment #1: Type: text/plain, Size: 3232 bytes --]

On 03/15, Daniel Vetter wrote:
> On Thu, Mar 14, 2019 at 03:48:45PM -0300, Rodrigo Siqueira wrote:
> > Allow atomic_enable and atomic_disable operations from
> > drm_crtc_helper_funcs struct optional. With this, the target display
> > drivers don't need to define a dummy function if they don't need one.
> > 
> > Changes since v2:
> > * Don't make funcs optional
> > * Update kerneldoc for atomic_enable/disable
> > * Replace "if (funcs->atomic_enable)" by "if (funcs->commit)"
> > * Improve commit message
> > 
> > Signed-off-by: Rodrigo Siqueira <rodrigosiqueiramelo@gmail.com>
> 
> Reviewed-by: Daniel Vetter <daniel.vetter@ffwll.ch>

Hi,
Is it ok if I apply this patch?
 
> > ---
> >  drivers/gpu/drm/drm_atomic_helper.c      | 5 ++---
> >  include/drm/drm_modeset_helper_vtables.h | 4 ++++
> >  2 files changed, 6 insertions(+), 3 deletions(-)
> > 
> > diff --git a/drivers/gpu/drm/drm_atomic_helper.c b/drivers/gpu/drm/drm_atomic_helper.c
> > index 540a77a2ade9..d506e13c2945 100644
> > --- a/drivers/gpu/drm/drm_atomic_helper.c
> > +++ b/drivers/gpu/drm/drm_atomic_helper.c
> > @@ -1034,7 +1034,7 @@ disable_outputs(struct drm_device *dev, struct drm_atomic_state *old_state)
> >  			funcs->atomic_disable(crtc, old_crtc_state);
> >  		else if (funcs->disable)
> >  			funcs->disable(crtc);
> > -		else
> > +		else if (funcs->dpms)
> >  			funcs->dpms(crtc, DRM_MODE_DPMS_OFF);
> >  
> >  		if (!(dev->irq_enabled && dev->num_crtcs))
> > @@ -1277,10 +1277,9 @@ void drm_atomic_helper_commit_modeset_enables(struct drm_device *dev,
> >  		if (new_crtc_state->enable) {
> >  			DRM_DEBUG_ATOMIC("enabling [CRTC:%d:%s]\n",
> >  					 crtc->base.id, crtc->name);
> > -
> >  			if (funcs->atomic_enable)
> >  				funcs->atomic_enable(crtc, old_crtc_state);
> > -			else
> > +			else if (funcs->commit)
> >  				funcs->commit(crtc);
> >  		}
> >  	}
> > diff --git a/include/drm/drm_modeset_helper_vtables.h b/include/drm/drm_modeset_helper_vtables.h
> > index cfb7be40bed7..ce4de6b1e444 100644
> > --- a/include/drm/drm_modeset_helper_vtables.h
> > +++ b/include/drm/drm_modeset_helper_vtables.h
> > @@ -418,6 +418,8 @@ struct drm_crtc_helper_funcs {
> >  	 * Drivers can use the @old_crtc_state input parameter if the operations
> >  	 * needed to enable the CRTC don't depend solely on the new state but
> >  	 * also on the transition between the old state and the new state.
> > +	 *
> > +	 * This function is optional.
> >  	 */
> >  	void (*atomic_enable)(struct drm_crtc *crtc,
> >  			      struct drm_crtc_state *old_crtc_state);
> > @@ -441,6 +443,8 @@ struct drm_crtc_helper_funcs {
> >  	 * parameter @old_crtc_state which could be used to access the old
> >  	 * state. Atomic drivers should consider to use this one instead
> >  	 * of @disable.
> > +	 *
> > +	 * This function is optional.
> >  	 */
> >  	void (*atomic_disable)(struct drm_crtc *crtc,
> >  			       struct drm_crtc_state *old_crtc_state);
> > -- 
> > 2.21.0
> 
> -- 
> Daniel Vetter
> Software Engineer, Intel Corporation
> http://blog.ffwll.ch

-- 
Rodrigo Siqueira
https://siqueira.tech
Graduate Student
Department of Computer Science
University of São Paulo

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH V2] drm/atomic-helper: Make atomic_enable/disable crtc callbacks optional
  2019-03-25 11:29   ` Rodrigo Siqueira
@ 2019-03-26  7:50     ` Daniel Vetter
  2019-03-29 10:58       ` Gerd Hoffmann
  0 siblings, 1 reply; 5+ messages in thread
From: Daniel Vetter @ 2019-03-26  7:50 UTC (permalink / raw)
  To: Rodrigo Siqueira
  Cc: Maarten Lankhorst, Maxime Ripard, Sean Paul, David Airlie,
	Gerd Hoffmann, dri-devel, linux-kernel

On Mon, Mar 25, 2019 at 08:29:06AM -0300, Rodrigo Siqueira wrote:
> On 03/15, Daniel Vetter wrote:
> > On Thu, Mar 14, 2019 at 03:48:45PM -0300, Rodrigo Siqueira wrote:
> > > Allow atomic_enable and atomic_disable operations from
> > > drm_crtc_helper_funcs struct optional. With this, the target display
> > > drivers don't need to define a dummy function if they don't need one.
> > > 
> > > Changes since v2:
> > > * Don't make funcs optional
> > > * Update kerneldoc for atomic_enable/disable
> > > * Replace "if (funcs->atomic_enable)" by "if (funcs->commit)"
> > > * Improve commit message
> > > 
> > > Signed-off-by: Rodrigo Siqueira <rodrigosiqueiramelo@gmail.com>
> > 
> > Reviewed-by: Daniel Vetter <daniel.vetter@ffwll.ch>
> 
> Hi,
> Is it ok if I apply this patch?

Sure.
-Daniel

>  
> > > ---
> > >  drivers/gpu/drm/drm_atomic_helper.c      | 5 ++---
> > >  include/drm/drm_modeset_helper_vtables.h | 4 ++++
> > >  2 files changed, 6 insertions(+), 3 deletions(-)
> > > 
> > > diff --git a/drivers/gpu/drm/drm_atomic_helper.c b/drivers/gpu/drm/drm_atomic_helper.c
> > > index 540a77a2ade9..d506e13c2945 100644
> > > --- a/drivers/gpu/drm/drm_atomic_helper.c
> > > +++ b/drivers/gpu/drm/drm_atomic_helper.c
> > > @@ -1034,7 +1034,7 @@ disable_outputs(struct drm_device *dev, struct drm_atomic_state *old_state)
> > >  			funcs->atomic_disable(crtc, old_crtc_state);
> > >  		else if (funcs->disable)
> > >  			funcs->disable(crtc);
> > > -		else
> > > +		else if (funcs->dpms)
> > >  			funcs->dpms(crtc, DRM_MODE_DPMS_OFF);
> > >  
> > >  		if (!(dev->irq_enabled && dev->num_crtcs))
> > > @@ -1277,10 +1277,9 @@ void drm_atomic_helper_commit_modeset_enables(struct drm_device *dev,
> > >  		if (new_crtc_state->enable) {
> > >  			DRM_DEBUG_ATOMIC("enabling [CRTC:%d:%s]\n",
> > >  					 crtc->base.id, crtc->name);
> > > -
> > >  			if (funcs->atomic_enable)
> > >  				funcs->atomic_enable(crtc, old_crtc_state);
> > > -			else
> > > +			else if (funcs->commit)
> > >  				funcs->commit(crtc);
> > >  		}
> > >  	}
> > > diff --git a/include/drm/drm_modeset_helper_vtables.h b/include/drm/drm_modeset_helper_vtables.h
> > > index cfb7be40bed7..ce4de6b1e444 100644
> > > --- a/include/drm/drm_modeset_helper_vtables.h
> > > +++ b/include/drm/drm_modeset_helper_vtables.h
> > > @@ -418,6 +418,8 @@ struct drm_crtc_helper_funcs {
> > >  	 * Drivers can use the @old_crtc_state input parameter if the operations
> > >  	 * needed to enable the CRTC don't depend solely on the new state but
> > >  	 * also on the transition between the old state and the new state.
> > > +	 *
> > > +	 * This function is optional.
> > >  	 */
> > >  	void (*atomic_enable)(struct drm_crtc *crtc,
> > >  			      struct drm_crtc_state *old_crtc_state);
> > > @@ -441,6 +443,8 @@ struct drm_crtc_helper_funcs {
> > >  	 * parameter @old_crtc_state which could be used to access the old
> > >  	 * state. Atomic drivers should consider to use this one instead
> > >  	 * of @disable.
> > > +	 *
> > > +	 * This function is optional.
> > >  	 */
> > >  	void (*atomic_disable)(struct drm_crtc *crtc,
> > >  			       struct drm_crtc_state *old_crtc_state);
> > > -- 
> > > 2.21.0
> > 
> > -- 
> > Daniel Vetter
> > Software Engineer, Intel Corporation
> > http://blog.ffwll.ch
> 
> -- 
> Rodrigo Siqueira
> https://siqueira.tech
> Graduate Student
> Department of Computer Science
> University of São Paulo



> _______________________________________________
> dri-devel mailing list
> dri-devel@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/dri-devel


-- 
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH V2] drm/atomic-helper: Make atomic_enable/disable crtc callbacks optional
  2019-03-26  7:50     ` Daniel Vetter
@ 2019-03-29 10:58       ` Gerd Hoffmann
  0 siblings, 0 replies; 5+ messages in thread
From: Gerd Hoffmann @ 2019-03-29 10:58 UTC (permalink / raw)
  To: Rodrigo Siqueira, Maarten Lankhorst, Maxime Ripard, Sean Paul,
	David Airlie, dri-devel, linux-kernel

On Tue, Mar 26, 2019 at 08:50:03AM +0100, Daniel Vetter wrote:
> On Mon, Mar 25, 2019 at 08:29:06AM -0300, Rodrigo Siqueira wrote:
> > On 03/15, Daniel Vetter wrote:
> > > On Thu, Mar 14, 2019 at 03:48:45PM -0300, Rodrigo Siqueira wrote:
> > > > Allow atomic_enable and atomic_disable operations from
> > > > drm_crtc_helper_funcs struct optional. With this, the target display
> > > > drivers don't need to define a dummy function if they don't need one.
> > > > 
> > > > Changes since v2:
> > > > * Don't make funcs optional
> > > > * Update kerneldoc for atomic_enable/disable
> > > > * Replace "if (funcs->atomic_enable)" by "if (funcs->commit)"
> > > > * Improve commit message
> > > > 
> > > > Signed-off-by: Rodrigo Siqueira <rodrigosiqueiramelo@gmail.com>
> > > 
> > > Reviewed-by: Daniel Vetter <daniel.vetter@ffwll.ch>
> > 
> > Hi,
> > Is it ok if I apply this patch?
> 
> Sure.
> -Daniel

Hmm, seems to not be applied yet.  Pushed to drm-misc-fixes.

cheers,
  Gerd


^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2019-03-29 10:58 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-03-14 18:48 [PATCH V2] drm/atomic-helper: Make atomic_enable/disable crtc callbacks optional Rodrigo Siqueira
2019-03-15 11:00 ` Daniel Vetter
2019-03-25 11:29   ` Rodrigo Siqueira
2019-03-26  7:50     ` Daniel Vetter
2019-03-29 10:58       ` Gerd Hoffmann

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).