dri-devel Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: "Ville Syrjälä" <ville.syrjala@linux.intel.com>
To: Maxime Ripard <maxime@cerno.tech>
Cc: "Haneen Mohammed" <hamohammed.sa@gmail.com>,
	"Rodrigo Siqueira" <rodrigosiqueiramelo@gmail.com>,
	"David Airlie" <airlied@linux.ie>,
	dri-devel@lists.freedesktop.org,
	"Melissa Wen" <melissa.srw@gmail.com>,
	"Leo Li" <sunpeng.li@amd.com>, "Ben Skeggs" <bskeggs@redhat.com>,
	"Thomas Zimmermann" <tzimmermann@suse.de>,
	"Rodrigo Vivi" <rodrigo.vivi@intel.com>,
	"Alex Deucher" <alexander.deucher@amd.com>,
	"Daniel Vetter" <daniel.vetter@intel.com>,
	"Christian König" <christian.koenig@amd.com>
Subject: Re: [PATCH v2] drm: Pass the full state to connectors atomic functions
Date: Fri, 20 Nov 2020 18:58:50 +0200	[thread overview]
Message-ID: <20201120165850.GK6112@intel.com> (raw)
In-Reply-To: <20201120112557.wxtjzrh4msnphjlx@gilmour>

On Fri, Nov 20, 2020 at 12:25:57PM +0100, Maxime Ripard wrote:
> Hi,
> 
> On Thu, Nov 19, 2020 at 05:21:48PM +0200, Ville Syrjälä wrote:
> > On Wed, Nov 18, 2020 at 10:47:58AM +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.
> > > 
> > > Now that the CRTCs have been converted, let's move forward with the
> > > connectors to provide a consistent interface.
> > > 
> > > The conversion was done using the coccinelle script below, and built tested
> > > on all the drivers.
> > > 
> > > @@
> > > identifier connector, connector_state;
> > > @@
> > > 
> > >  struct drm_connector_helper_funcs {
> > > 	...
> > > 	struct drm_encoder* (*atomic_best_encoder)(struct drm_connector *connector,
> > > -						   struct drm_connector_state *connector_state);
> > > +						   struct drm_atomic_state *state);
> > > 	...
> > > }
> > > 
> > > @@
> > > identifier connector, connector_state;
> > > @@
> > > 
> > >  struct drm_connector_helper_funcs {
> > > 	...
> > > 	void (*atomic_commit)(struct drm_connector *connector,
> > > -			      struct drm_connector_state *connector_state);
> > > +			      struct drm_atomic_state *state);
> > > 	...
> > > }
> > > 
> > > @@
> > > struct drm_connector_helper_funcs *FUNCS;
> > > identifier state;
> > > identifier connector, connector_state;
> > > identifier f;
> > > @@
> > > 
> > >  f(..., struct drm_atomic_state *state, ...)
> > >  {
> > > 	<+...
> > > -	FUNCS->atomic_commit(connector, connector_state);
> > > +	FUNCS->atomic_commit(connector, state);
> > > 	...+>
> > >  }
> > > 
> > > @@
> > > struct drm_connector_helper_funcs *FUNCS;
> > > identifier state;
> > > identifier connector, connector_state;
> > > identifier var, f;
> > > @@
> > > 
> > >  f(struct drm_atomic_state *state, ...)
> > 
> > I think there was some way to deal with these variants using a single
> > rule, but maybe that required the use of the parameter list stuff
> > which IIRC was a bit ugly. Probably not worth the hassle here.
> 
> Do you have any recollection of some patch that used it? I couldn't find
> a cleaner way to deal with it, but I'd really like to use it if
> available.

git log --grep didn't show any commits from me using it at least.
I must have never sent them.

Digging through my pile of old cocci scripts I found a few uses. Eg.:
@r1@
identifier F !~ "_destroy$|_reset$";
identifier E;
parameter list[N] PS;
@@
F(PS,
- struct drm_encoder *E
+ struct intel_encoder *encoder
  ,...)
{ ... }

@@
identifier r1.F;
expression E;
expression list[r1.N] ES;
@@
F(ES,
- E
+ to_intel_encoder(E)
  ,...)

My vague recollection is that it would work for the
N==0 case as well.

-- 
Ville Syrjälä
Intel
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

      reply	other threads:[~2020-11-20 16:59 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-11-18  9:47 [PATCH v2] drm: Pass the full state to connectors atomic functions Maxime Ripard
2020-11-19 15:21 ` Ville Syrjälä
2020-11-20 11:25   ` Maxime Ripard
2020-11-20 16:58     ` Ville Syrjälä [this message]

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=20201120165850.GK6112@intel.com \
    --to=ville.syrjala@linux.intel.com \
    --cc=airlied@linux.ie \
    --cc=alexander.deucher@amd.com \
    --cc=bskeggs@redhat.com \
    --cc=christian.koenig@amd.com \
    --cc=daniel.vetter@intel.com \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=hamohammed.sa@gmail.com \
    --cc=maxime@cerno.tech \
    --cc=melissa.srw@gmail.com \
    --cc=rodrigo.vivi@intel.com \
    --cc=rodrigosiqueiramelo@gmail.com \
    --cc=sunpeng.li@amd.com \
    --cc=tzimmermann@suse.de \
    /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