dri-devel.lists.freedesktop.org archive mirror
 help / color / mirror / Atom feed
From: Daniel Vetter <daniel@ffwll.ch>
To: "Ville Syrjälä" <ville.syrjala@linux.intel.com>
Cc: David Airlie <airlied@linux.ie>,
	Daniel Vetter <daniel.vetter@intel.com>,
	Maxime Ripard <maxime@cerno.tech>,
	dri-devel <dri-devel@lists.freedesktop.org>,
	Thomas Zimmermann <tzimmermann@suse.de>
Subject: Re: [PATCH 2/2] drm/atomic: Pass the full state to CRTC atomic begin and flush
Date: Sat, 31 Oct 2020 15:08:03 +0100	[thread overview]
Message-ID: <CAKMK7uHbOkLpf2m1ktpumd+5aQF7NerRZrgxAXsjTzZpF4yDrg@mail.gmail.com> (raw)
In-Reply-To: <20201031123549.GM6112@intel.com>

On Sat, Oct 31, 2020 at 1:35 PM Ville Syrjälä
<ville.syrjala@linux.intel.com> wrote:
>
> On Sat, Oct 31, 2020 at 10:59:05AM +0100, Maxime Ripard wrote:
> > On Thu, Oct 29, 2020 at 03:55:37PM +0200, Ville Syrjälä wrote:
> > > On Wed, Oct 28, 2020 at 01:32:22PM +0100, Maxime Ripard wrote:
> > > > The current atomic helpers have either their object state being passed as
> > > > an argument or the full atomic state.
> > > >
> > > > The former is the pattern that was done at first, before switching to the
> > > > latter for new hooks or when it was needed.
> > > >
> > > > Let's start convert all the remaining helpers to provide a consistent
> > > > interface, starting with the CRTC's atomic_begin and atomic_flush.
> > > >
> > > > The conversion was done using the coccinelle script below, built tested on
> > > > all the drivers and actually tested on vc4.
> > > >
> > > <snip>
> > > > @@ -323,26 +323,27 @@ static void ingenic_drm_crtc_atomic_begin(struct drm_crtc *crtc,
> > > >  }
> > > >
> > > >  static void ingenic_drm_crtc_atomic_flush(struct drm_crtc *crtc,
> > > > -                                   struct drm_crtc_state *oldstate)
> > > > +                                   struct drm_atomic_state *state)
> > > >  {
> > > >   struct ingenic_drm *priv = drm_crtc_get_priv(crtc);
> > > > - struct drm_crtc_state *state = crtc->state;
> > > > - struct drm_pending_vblank_event *event = state->event;
> > > > + struct drm_crtc_state *crtc_state = crtc->state;
> > >
> > > Looks like quite a few places could use a followup to
> > > switch to get_{old,new}_crtc_state().
> >
> > That one is not entirely clear to me. crtc->state is documented as the
> > current CRTC state, but in atomic_begin / atomic_flush, does that mean
> > that it's the old state that we're going to replace, or the new state
> > that is going to replace the current state?
>
> That depends on whether it's being used before or after the
> swap_state(). Before swap_state() foo->state is the old state,
> after swap_state() foo->state is the new state.

The problem with obj->state pointers in atomic commit is when we start
to queue up more than one commit, it gets messy. Hence the long term
push to pick the right old/new state from the drm_atomic_state, so you
know you get the right one. Plus it's more self-documenting, with the
_new_/_old_ infix. Like if you lookd at _new_ in an atomic_disable
hook, that's a good reason to double-check the code does the right
thing. Or if you look at _old_ in an enable function. For special
transitions this is sometimes required, but really should stick out as
an exception.

Hence also why replacing the various obj_old_state or obj_state
pointers is a good idea, and just passing drm_atomic_state everywhere.

Oh and I guess eventually we should we should perhaps rename
drm_atomic_state to drm_atomic_state_update or similar, to really
drive how what this thing does.
-Daniel

>
> --
> Ville Syrjälä
> Intel
> _______________________________________________
> 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
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

  reply	other threads:[~2020-10-31 14:08 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-10-28 12:32 [PATCH 1/2] drm/atomic: Pass the full state to CRTC atomic_check Maxime Ripard
2020-10-28 12:32 ` [PATCH 2/2] drm/atomic: Pass the full state to CRTC atomic begin and flush Maxime Ripard
2020-10-29  8:27   ` Daniel Vetter
2020-10-29 13:55   ` Ville Syrjälä
2020-10-31  9:59     ` Maxime Ripard
2020-10-31 12:35       ` Ville Syrjälä
2020-10-31 14:08         ` Daniel Vetter [this message]
2020-11-02  8:17   ` Thomas Zimmermann
2020-11-02  9:57     ` Daniel Vetter
2020-11-02 11:53   ` Maxime Ripard
2020-10-29 13:50 ` [PATCH 1/2] drm/atomic: Pass the full state to CRTC atomic_check Ville Syrjälä
2020-10-31  9:57   ` Maxime Ripard
2020-11-02  8:09 ` Thomas Zimmermann
2020-11-02 11:39   ` Maxime Ripard

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=CAKMK7uHbOkLpf2m1ktpumd+5aQF7NerRZrgxAXsjTzZpF4yDrg@mail.gmail.com \
    --to=daniel@ffwll.ch \
    --cc=airlied@linux.ie \
    --cc=daniel.vetter@intel.com \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=maxime@cerno.tech \
    --cc=tzimmermann@suse.de \
    --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 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).