All of lore.kernel.org
 help / color / mirror / Atom feed
From: Daniel Vetter <daniel@ffwll.ch>
To: Sean Paul <sean@poorly.run>
Cc: dri-devel <dri-devel@lists.freedesktop.org>,
	"Sean Paul" <seanpaul@chromium.org>,
	"Ville Syrjälä" <ville.syrjala@linux.intel.com>,
	"Maarten Lankhorst" <maarten.lankhorst@linux.intel.com>,
	"Maxime Ripard" <maxime.ripard@bootlin.com>,
	"David Airlie" <airlied@linux.ie>,
	"Linux Kernel Mailing List" <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH v3 01/10] drm: Add atomic variants of enable/disable to encoder helper funcs
Date: Fri, 3 May 2019 16:08:14 +0200	[thread overview]
Message-ID: <CAKMK7uHO6rT=khqFrG7Saxxk_NZCC=rCYwATLUt1Cd_z+gh4rQ@mail.gmail.com> (raw)
In-Reply-To: <20190503123452.GG17077@art_vandelay>

On Fri, May 3, 2019 at 2:34 PM Sean Paul <sean@poorly.run> wrote:
>
> On Fri, May 03, 2019 at 09:51:30AM +0200, Daniel Vetter wrote:
> > On Thu, May 02, 2019 at 03:49:43PM -0400, Sean Paul wrote:
> > > From: Sean Paul <seanpaul@chromium.org>
> > >
> > > 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
> > >
> > > Cc: Daniel Vetter <daniel@ffwll.ch>
> > > Cc: Ville Syrjälä <ville.syrjala@linux.intel.com>
> > > Signed-off-by: Sean Paul <seanpaul@chromium.org>
> > > ---
> > >  drivers/gpu/drm/drm_atomic_helper.c      |  6 +++-
> > >  include/drm/drm_modeset_helper_vtables.h | 45 ++++++++++++++++++++++++
> > >  2 files changed, 50 insertions(+), 1 deletion(-)
>
> /snip
>
> > > diff --git a/include/drm/drm_modeset_helper_vtables.h b/include/drm/drm_modeset_helper_vtables.h
> > > index 8f3602811eb5..de57fb40cb6e 100644
> > > --- a/include/drm/drm_modeset_helper_vtables.h
> > > +++ b/include/drm/drm_modeset_helper_vtables.h
> > > @@ -675,6 +675,51 @@ 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. It takes priority over @disable during atomic commits.
> > > +    *
> > > +    * 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 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.
> > > +    */
> >
> > I'd add something like "For atomic drivers also consider @atomic_disable"
> > to the kerneldoc of @disable (before the NOTE: which is only relevant for
> > pre-atomic). Same for the enable side.
> >
> > > +   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. It is called in place of @enable during atomic
> > > +    * commits.
> >
> > needs to be adjusted here for "takes priority".
>
> Can you clarify this comment? I'm a little fuzzy on what it means.

Further up I suggest that @atomic_disable should take priority over
all the others (plus explain why @disable is lower than @prepare,
because of the special semantics this has in legacy crtc helpers).
Once you do that you also need to adjust the wording in the kerneldoc
here (same wording as in @atomic_enable sounds good to me), i.e.
explain that @atomic_disable takes priority over all other hooks.
-Daniel

>
>
>
> > > +    *
> > > +    * This hook is used only by atomic helpers, for symmetry with @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 (using either DPMS or the new "ACTIVE" property) works
> > > +    * @enable must be the inverse of @disable for atomic drivers.
> > > +    */
> > > +   void (*atomic_enable)(struct drm_encoder *encoder,
> > > +                         struct drm_atomic_state *state);
> > > +
> >
> > With the nits:
> >
> > Reviewed-by: Daniel Vetter <daniel.vetter@ffwll.ch>
>
> Thanks!
>
> Sean
>
> >
> > >     /**
> > >      * @disable:
> > >      *
> > > --
> > > Sean Paul, Software Engineer, Google / Chromium OS
> > >
> >
> > --
> > Daniel Vetter
> > Software Engineer, Intel Corporation
> > http://blog.ffwll.ch
>
> --
> Sean Paul, Software Engineer, Google / Chromium OS
> _______________________________________________
> dri-devel mailing list
> dri-devel@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/dri-devel



-- 
Daniel Vetter
Software Engineer, Intel Corporation
+41 (0) 79 365 57 48 - http://blog.ffwll.ch

WARNING: multiple messages have this Message-ID (diff)
From: Daniel Vetter <daniel@ffwll.ch>
To: Sean Paul <sean@poorly.run>
Cc: Maxime Ripard <maxime.ripard@bootlin.com>,
	Linux Kernel Mailing List <linux-kernel@vger.kernel.org>,
	dri-devel <dri-devel@lists.freedesktop.org>,
	David Airlie <airlied@linux.ie>,
	Sean Paul <seanpaul@chromium.org>
Subject: Re: [PATCH v3 01/10] drm: Add atomic variants of enable/disable to encoder helper funcs
Date: Fri, 3 May 2019 16:08:14 +0200	[thread overview]
Message-ID: <CAKMK7uHO6rT=khqFrG7Saxxk_NZCC=rCYwATLUt1Cd_z+gh4rQ@mail.gmail.com> (raw)
In-Reply-To: <20190503123452.GG17077@art_vandelay>

On Fri, May 3, 2019 at 2:34 PM Sean Paul <sean@poorly.run> wrote:
>
> On Fri, May 03, 2019 at 09:51:30AM +0200, Daniel Vetter wrote:
> > On Thu, May 02, 2019 at 03:49:43PM -0400, Sean Paul wrote:
> > > From: Sean Paul <seanpaul@chromium.org>
> > >
> > > 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
> > >
> > > Cc: Daniel Vetter <daniel@ffwll.ch>
> > > Cc: Ville Syrjälä <ville.syrjala@linux.intel.com>
> > > Signed-off-by: Sean Paul <seanpaul@chromium.org>
> > > ---
> > >  drivers/gpu/drm/drm_atomic_helper.c      |  6 +++-
> > >  include/drm/drm_modeset_helper_vtables.h | 45 ++++++++++++++++++++++++
> > >  2 files changed, 50 insertions(+), 1 deletion(-)
>
> /snip
>
> > > diff --git a/include/drm/drm_modeset_helper_vtables.h b/include/drm/drm_modeset_helper_vtables.h
> > > index 8f3602811eb5..de57fb40cb6e 100644
> > > --- a/include/drm/drm_modeset_helper_vtables.h
> > > +++ b/include/drm/drm_modeset_helper_vtables.h
> > > @@ -675,6 +675,51 @@ 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. It takes priority over @disable during atomic commits.
> > > +    *
> > > +    * 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 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.
> > > +    */
> >
> > I'd add something like "For atomic drivers also consider @atomic_disable"
> > to the kerneldoc of @disable (before the NOTE: which is only relevant for
> > pre-atomic). Same for the enable side.
> >
> > > +   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. It is called in place of @enable during atomic
> > > +    * commits.
> >
> > needs to be adjusted here for "takes priority".
>
> Can you clarify this comment? I'm a little fuzzy on what it means.

Further up I suggest that @atomic_disable should take priority over
all the others (plus explain why @disable is lower than @prepare,
because of the special semantics this has in legacy crtc helpers).
Once you do that you also need to adjust the wording in the kerneldoc
here (same wording as in @atomic_enable sounds good to me), i.e.
explain that @atomic_disable takes priority over all other hooks.
-Daniel

>
>
>
> > > +    *
> > > +    * This hook is used only by atomic helpers, for symmetry with @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 (using either DPMS or the new "ACTIVE" property) works
> > > +    * @enable must be the inverse of @disable for atomic drivers.
> > > +    */
> > > +   void (*atomic_enable)(struct drm_encoder *encoder,
> > > +                         struct drm_atomic_state *state);
> > > +
> >
> > With the nits:
> >
> > Reviewed-by: Daniel Vetter <daniel.vetter@ffwll.ch>
>
> Thanks!
>
> Sean
>
> >
> > >     /**
> > >      * @disable:
> > >      *
> > > --
> > > Sean Paul, Software Engineer, Google / Chromium OS
> > >
> >
> > --
> > Daniel Vetter
> > Software Engineer, Intel Corporation
> > http://blog.ffwll.ch
>
> --
> Sean Paul, Software Engineer, Google / Chromium OS
> _______________________________________________
> dri-devel mailing list
> dri-devel@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/dri-devel



-- 
Daniel Vetter
Software Engineer, Intel Corporation
+41 (0) 79 365 57 48 - http://blog.ffwll.ch
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

  reply	other threads:[~2019-05-03 14:08 UTC|newest]

Thread overview: 52+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-05-02 19:49 [PATCH v3 00/10] drm: Add self refresh helpers Sean Paul
2019-05-02 19:49 ` [PATCH v3 01/10] drm: Add atomic variants of enable/disable to encoder helper funcs Sean Paul
2019-05-03  7:51   ` Daniel Vetter
2019-05-03 12:34     ` Sean Paul
2019-05-03 14:08       ` Daniel Vetter [this message]
2019-05-03 14:08         ` Daniel Vetter
2019-05-02 19:49 ` [PATCH v3 02/10] drm: Add drm_atomic_crtc_state_for_encoder helper Sean Paul
2019-05-02 19:49   ` Sean Paul
2019-05-03  8:18   ` Daniel Vetter
2019-05-03 12:47     ` Sean Paul
2019-05-03 14:06       ` Daniel Vetter
2019-05-05 21:15         ` Daniel Vetter
2019-05-05 22:01           ` Laurent Pinchart
2019-05-05 22:01             ` Laurent Pinchart
2019-05-02 19:49 ` [PATCH v3 03/10] drm: Add atomic variants for bridge enable/disable Sean Paul
2019-05-03  7:45   ` Daniel Vetter
2019-05-02 19:49 ` [PATCH v3 04/10] drm: Convert connector_helper_funcs->atomic_check to accept drm_atomic_state Sean Paul
2019-05-02 19:49   ` Sean Paul
2019-05-03  8:19   ` Daniel Vetter
2019-05-11 19:12   ` Laurent Pinchart
2019-05-11 19:12     ` Laurent Pinchart
2019-05-13 14:38     ` Sean Paul
2019-05-13 14:38       ` Sean Paul
2019-05-16 12:00       ` Laurent Pinchart
2019-05-16 12:00         ` Laurent Pinchart
2019-05-16 14:21         ` Sean Paul
2019-05-16 14:21           ` Sean Paul
2019-05-13 14:47     ` Daniel Vetter
2019-05-13 14:47       ` Daniel Vetter
2019-05-16 12:02       ` Laurent Pinchart
2019-05-16 12:02         ` Laurent Pinchart
2019-05-16 12:07         ` Daniel Vetter
2019-05-16 12:07           ` Daniel Vetter
2019-05-16 13:28           ` Ville Syrjälä
2019-05-16 13:28             ` Ville Syrjälä
2019-05-02 19:49 ` [PATCH v3 05/10] drm: Add helpers to kick off self refresh mode in drivers Sean Paul
2019-05-02 19:49   ` Sean Paul
2019-05-03  7:36   ` Daniel Vetter
2019-05-02 19:49 ` [PATCH v3 06/10] drm/rockchip: Use dirtyfb helper Sean Paul
2019-05-02 19:49   ` Sean Paul
2019-05-02 19:49   ` Sean Paul
2019-05-02 19:49 ` [PATCH v3 07/10] drm/rockchip: Check for fast link training before enabling psr Sean Paul
2019-05-02 19:49   ` Sean Paul
2019-05-02 19:49 ` [PATCH v3 08/10] drm/rockchip: Use the helpers for PSR Sean Paul
2019-05-02 19:49   ` Sean Paul
2019-05-02 19:49   ` Sean Paul
2019-05-02 19:49 ` [PATCH v3 09/10] drm/rockchip: Don't fully disable vop on self refresh Sean Paul
2019-05-02 19:49   ` Sean Paul
2019-05-02 19:49   ` Sean Paul
2019-05-02 19:49 ` [PATCH v3 10/10] drm/rockchip: Use drm_atomic_helper_commit_tail_rpm Sean Paul
2019-05-02 19:49   ` Sean Paul
2019-05-02 19:49   ` Sean Paul

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='CAKMK7uHO6rT=khqFrG7Saxxk_NZCC=rCYwATLUt1Cd_z+gh4rQ@mail.gmail.com' \
    --to=daniel@ffwll.ch \
    --cc=airlied@linux.ie \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=maarten.lankhorst@linux.intel.com \
    --cc=maxime.ripard@bootlin.com \
    --cc=sean@poorly.run \
    --cc=seanpaul@chromium.org \
    --cc=ville.syrjala@linux.intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.