From: Maxime Ripard <maxime@cerno.tech>
To: "Ville Syrjälä" <ville.syrjala@linux.intel.com>
Cc: David Airlie <airlied@linux.ie>,
Daniel Vetter <daniel.vetter@intel.com>,
dri-devel@lists.freedesktop.org,
Thomas Zimmermann <tzimmermann@suse.de>
Subject: Re: [PATCH 1/2] drm/atomic: Pass the full state to CRTC atomic_check
Date: Sat, 31 Oct 2020 10:57:29 +0100 [thread overview]
Message-ID: <20201031095729.3a7vkwnk7oj6gq7l@gilmour.lan> (raw)
In-Reply-To: <20201029135041.GA6112@intel.com>
[-- Attachment #1.1: Type: text/plain, Size: 3395 bytes --]
Hi!
Thanks for reviewing those patches
On Thu, Oct 29, 2020 at 03:50:41PM +0200, Ville Syrjälä wrote:
> On Wed, Oct 28, 2020 at 01:32:21PM +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_check.
> >
> > The conversion was done using the coccinelle script below,
> > built tested on all the drivers and actually tested on vc4.
> >
> > virtual report
>
> ?
>
> <snip>
> > @ depends on crtc_atomic_func @
> > identifier crtc_atomic_func.func;
> > expression E;
> > type T;
> > @@
> >
> > int func(...)
> > {
> > ...
> > - T state = E;
> > + T crtc_state = E;
> > <+...
> > - state
> > + crtc_state
> > ...+>
>
> > }
> >
> > @ depends on crtc_atomic_func @
> > identifier crtc_atomic_func.func;
> > type T;
> > @@
> >
> > int func(...)
> > {
> > ...
> > - T state;
> > + T crtc_state;
> > <+...
> > - state
> > + crtc_state
> > ...+>
> > }
>
> These two seem a bit fuzzy. AFAICS 'state' could be any
> kind of state given the constrainsts. Though I guess
> the fact that this is the crtc .atomic_check() it's most
> likely to either the crtc state or the whole atomic state.
>
> Not sure what would be the best way to tighten this up.
> Maybe a regex thing on the assignment? But I'm not sure
> you can even do that on an expression.
That would be a bit above my current coccinelle skills :)
I guess we could replace T by struct drm_crtc_state, that would catch
most cases like you pointed out, even though it's still not completely
accurate.
> Anyways, doesn't look like this went wrong anywhere, so
> seems good enough for a onetime job.
>
> <snip>
> > diff --git a/drivers/gpu/drm/mxsfb/mxsfb_kms.c b/drivers/gpu/drm/mxsfb/mxsfb_kms.c
> > index 956f631997f2..b0757f84a979 100644
> > --- a/drivers/gpu/drm/mxsfb/mxsfb_kms.c
> > +++ b/drivers/gpu/drm/mxsfb/mxsfb_kms.c
> > @@ -269,17 +269,19 @@ static void mxsfb_crtc_mode_set_nofb(struct mxsfb_drm_private *mxsfb)
> > }
> >
> > static int mxsfb_crtc_atomic_check(struct drm_crtc *crtc,
> > - struct drm_crtc_state *state)
> > + struct drm_atomic_state *state)
> > {
> > - bool has_primary = state->plane_mask &
> > + struct drm_crtc_state *crtc_state = drm_atomic_get_new_crtc_state(state,
> > + crtc);
> > + bool has_primary = crtc_state->plane_mask &
> > drm_plane_mask(crtc->primary);
> >
> > /* The primary plane has to be enabled when the CRTC is active. */
> > - if (state->active && !has_primary)
> > + if (crtc_state->active && !has_primary)
> > return -EINVAL;
> >
> > /* TODO: Is this needed ? */
> > - return drm_atomic_add_affected_planes(state->state, crtc);
> > + return drm_atomic_add_affected_planes(crtc_state->state, crtc);
>
> Could also s/crtc_state->state/state/ in various places.
>
> But that could done as a followup as well.
I'll send a subsequent patch for that one
> Didn't spot any mistakes:
> Reviewed-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Thanks!
Maxime
[-- Attachment #1.2: signature.asc --]
[-- Type: application/pgp-signature, Size: 228 bytes --]
[-- Attachment #2: Type: text/plain, Size: 160 bytes --]
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel
next prev parent reply other threads:[~2020-11-01 17:39 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
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 [this message]
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=20201031095729.3a7vkwnk7oj6gq7l@gilmour.lan \
--to=maxime@cerno.tech \
--cc=airlied@linux.ie \
--cc=daniel.vetter@intel.com \
--cc=dri-devel@lists.freedesktop.org \
--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).