All of lore.kernel.org
 help / color / mirror / Atom feed
From: Maxime Ripard <maxime@cerno.tech>
To: Thomas Zimmermann <tzimmermann@suse.de>
Cc: "Maarten Lankhorst" <maarten.lankhorst@linux.intel.com>,
	"Daniel Vetter" <daniel.vetter@intel.com>,
	"David Airlie" <airlied@linux.ie>,
	dri-devel@lists.freedesktop.org,
	"Ville Syrjälä" <ville.syrjala@linux.intel.com>,
	"Philipp Zabel" <p.zabel@pengutronix.de>,
	"Daniel Vetter" <daniel@ffwll.ch>,
	"Shawn Guo" <shawnguo@kernel.org>,
	"Sascha Hauer" <s.hauer@pengutronix.de>,
	"Pengutronix Kernel Team" <kernel@pengutronix.de>,
	"Fabio Estevam" <festevam@gmail.com>,
	"NXP Linux Team" <linux-imx@nxp.com>,
	"Paul Cercueil" <paul@crapouillou.net>,
	"Rob Clark" <robdclark@gmail.com>, "Sean Paul" <sean@poorly.run>,
	"Jyri Sarha" <jyri.sarha@iki.fi>,
	"Tomi Valkeinen" <tomba@kernel.org>,
	linux-arm-kernel@lists.infradead.org,
	linux-kernel@vger.kernel.org, linux-mips@vger.kernel.org,
	linux-arm-msm@vger.kernel.org, freedreno@lists.freedesktop.org
Subject: Re: [PATCH v3 06/11] drm: Use state helper instead of plane state pointer in atomic_check
Date: Tue, 23 Feb 2021 15:41:17 +0100	[thread overview]
Message-ID: <20210223144117.6lhuizr2zrutbkzi@gilmour> (raw)
In-Reply-To: <e6e8191d-08d9-7144-bb1a-ddaa6c21eccb@suse.de>

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

Hi Thomas,

On Mon, Feb 22, 2021 at 10:12:49AM +0100, Thomas Zimmermann wrote:
> Am 19.02.21 um 13:00 schrieb Maxime Ripard:
> > Many drivers reference the plane->state pointer in order to get the
> > current plane state in their atomic_check hook, which would be the old
> > plane state in the global atomic state since _swap_state hasn't happened
> > when atomic_check is run.
> > 
> > Use the drm_atomic_get_old_plane_state helper to get that state to make
> > it more obvious.
> > 
> > This was made using the coccinelle script below:
> > 
> > @ plane_atomic_func @
> > identifier helpers;
> > identifier func;
> > @@
> > 
> > static struct drm_plane_helper_funcs helpers = {
> > 	...,
> > 	.atomic_check = func,
> > 	...,
> > };
> > 
> > @ replaces_old_state @
> > identifier plane_atomic_func.func;
> > identifier plane, state, plane_state;
> > @@
> > 
> >   func(struct drm_plane *plane, struct drm_atomic_state *state) {
> >   	...
> > -	struct drm_plane_state *plane_state = plane->state;
> > +	struct drm_plane_state *plane_state = drm_atomic_get_old_plane_state(state, plane);
> >   	...
> >   }
> > 
> > @@
> > identifier plane_atomic_func.func;
> > identifier plane, state, plane_state;
> > @@
> > 
> >   func(struct drm_plane *plane, struct drm_atomic_state *state) {
> >   	struct drm_plane_state *plane_state = drm_atomic_get_old_plane_state(state, plane);
> >   	<...
> > -	plane->state
> > +	plane_state
> >   	...>
> >   }
> > 
> > @ adds_old_state @
> > identifier plane_atomic_func.func;
> > identifier plane, state;
> > @@
> > 
> >   func(struct drm_plane *plane, struct drm_atomic_state *state) {
> > +	struct drm_plane_state *old_plane_state = drm_atomic_get_old_plane_state(state, plane);
> >   	<...
> > -	plane->state
> > +	old_plane_state
> >   	...>
> >   }
> > 
> > @ include depends on adds_old_state || replaces_old_state @
> > @@
> > 
> >   #include <drm/drm_atomic.h>
> > 
> > @ no_include depends on !include && (adds_old_state || replaces_old_state) @
> > @@
> > 
> > + #include <drm/drm_atomic.h>
> >    #include <drm/...>
> > 
> > Reviewed-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
> > Signed-off-by: Maxime Ripard <maxime@cerno.tech>
> 
> Acked-by: Thomas Zimmermann <tzimmermann@suse.de>
> 
> However, I find 'old plane state' somewhat confusing in this context,
> because it's actually the current plane state. Would it make sense to use
> drm_atomic_get_existing_plane_state() instead?

drm_atomic_get_existing_plane_state is deprecated nowadays, in favour of either
drm_atomic_get_old_plane_state or drm_atomic_get_new_plane_state

Maxime

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

WARNING: multiple messages have this Message-ID (diff)
From: Maxime Ripard <maxime@cerno.tech>
To: Thomas Zimmermann <tzimmermann@suse.de>
Cc: "David Airlie" <airlied@linux.ie>,
	dri-devel@lists.freedesktop.org, linux-mips@vger.kernel.org,
	"Paul Cercueil" <paul@crapouillou.net>,
	"Daniel Vetter" <daniel.vetter@intel.com>,
	"Fabio Estevam" <festevam@gmail.com>,
	"Ville Syrjälä" <ville.syrjala@linux.intel.com>,
	"NXP Linux Team" <linux-imx@nxp.com>,
	"Philipp Zabel" <p.zabel@pengutronix.de>,
	linux-arm-msm@vger.kernel.org,
	"Sascha Hauer" <s.hauer@pengutronix.de>,
	"Maarten Lankhorst" <maarten.lankhorst@linux.intel.com>,
	"Shawn Guo" <shawnguo@kernel.org>, "Sean Paul" <sean@poorly.run>,
	"Pengutronix Kernel Team" <kernel@pengutronix.de>,
	linux-arm-kernel@lists.infradead.org,
	"Tomi Valkeinen" <tomba@kernel.org>,
	"Jyri Sarha" <jyri.sarha@iki.fi>,
	linux-kernel@vger.kernel.org, "Rob Clark" <robdclark@gmail.com>,
	"Daniel Vetter" <daniel@ffwll.ch>,
	freedreno@lists.freedesktop.org
Subject: Re: [PATCH v3 06/11] drm: Use state helper instead of plane state pointer in atomic_check
Date: Tue, 23 Feb 2021 15:41:17 +0100	[thread overview]
Message-ID: <20210223144117.6lhuizr2zrutbkzi@gilmour> (raw)
In-Reply-To: <e6e8191d-08d9-7144-bb1a-ddaa6c21eccb@suse.de>


[-- Attachment #1.1: Type: text/plain, Size: 2677 bytes --]

Hi Thomas,

On Mon, Feb 22, 2021 at 10:12:49AM +0100, Thomas Zimmermann wrote:
> Am 19.02.21 um 13:00 schrieb Maxime Ripard:
> > Many drivers reference the plane->state pointer in order to get the
> > current plane state in their atomic_check hook, which would be the old
> > plane state in the global atomic state since _swap_state hasn't happened
> > when atomic_check is run.
> > 
> > Use the drm_atomic_get_old_plane_state helper to get that state to make
> > it more obvious.
> > 
> > This was made using the coccinelle script below:
> > 
> > @ plane_atomic_func @
> > identifier helpers;
> > identifier func;
> > @@
> > 
> > static struct drm_plane_helper_funcs helpers = {
> > 	...,
> > 	.atomic_check = func,
> > 	...,
> > };
> > 
> > @ replaces_old_state @
> > identifier plane_atomic_func.func;
> > identifier plane, state, plane_state;
> > @@
> > 
> >   func(struct drm_plane *plane, struct drm_atomic_state *state) {
> >   	...
> > -	struct drm_plane_state *plane_state = plane->state;
> > +	struct drm_plane_state *plane_state = drm_atomic_get_old_plane_state(state, plane);
> >   	...
> >   }
> > 
> > @@
> > identifier plane_atomic_func.func;
> > identifier plane, state, plane_state;
> > @@
> > 
> >   func(struct drm_plane *plane, struct drm_atomic_state *state) {
> >   	struct drm_plane_state *plane_state = drm_atomic_get_old_plane_state(state, plane);
> >   	<...
> > -	plane->state
> > +	plane_state
> >   	...>
> >   }
> > 
> > @ adds_old_state @
> > identifier plane_atomic_func.func;
> > identifier plane, state;
> > @@
> > 
> >   func(struct drm_plane *plane, struct drm_atomic_state *state) {
> > +	struct drm_plane_state *old_plane_state = drm_atomic_get_old_plane_state(state, plane);
> >   	<...
> > -	plane->state
> > +	old_plane_state
> >   	...>
> >   }
> > 
> > @ include depends on adds_old_state || replaces_old_state @
> > @@
> > 
> >   #include <drm/drm_atomic.h>
> > 
> > @ no_include depends on !include && (adds_old_state || replaces_old_state) @
> > @@
> > 
> > + #include <drm/drm_atomic.h>
> >    #include <drm/...>
> > 
> > Reviewed-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
> > Signed-off-by: Maxime Ripard <maxime@cerno.tech>
> 
> Acked-by: Thomas Zimmermann <tzimmermann@suse.de>
> 
> However, I find 'old plane state' somewhat confusing in this context,
> because it's actually the current plane state. Would it make sense to use
> drm_atomic_get_existing_plane_state() instead?

drm_atomic_get_existing_plane_state is deprecated nowadays, in favour of either
drm_atomic_get_old_plane_state or drm_atomic_get_new_plane_state

Maxime

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

[-- Attachment #2: Type: text/plain, Size: 176 bytes --]

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

WARNING: multiple messages have this Message-ID (diff)
From: Maxime Ripard <maxime@cerno.tech>
To: Thomas Zimmermann <tzimmermann@suse.de>
Cc: David Airlie <airlied@linux.ie>,
	dri-devel@lists.freedesktop.org, linux-mips@vger.kernel.org,
	Paul Cercueil <paul@crapouillou.net>,
	Daniel Vetter <daniel.vetter@intel.com>,
	NXP Linux Team <linux-imx@nxp.com>,
	linux-arm-msm@vger.kernel.org,
	Sascha Hauer <s.hauer@pengutronix.de>,
	Shawn Guo <shawnguo@kernel.org>, Sean Paul <sean@poorly.run>,
	Pengutronix Kernel Team <kernel@pengutronix.de>,
	linux-arm-kernel@lists.infradead.org,
	Tomi Valkeinen <tomba@kernel.org>, Jyri Sarha <jyri.sarha@iki.fi>,
	linux-kernel@vger.kernel.org, freedreno@lists.freedesktop.org
Subject: Re: [PATCH v3 06/11] drm: Use state helper instead of plane state pointer in atomic_check
Date: Tue, 23 Feb 2021 15:41:17 +0100	[thread overview]
Message-ID: <20210223144117.6lhuizr2zrutbkzi@gilmour> (raw)
In-Reply-To: <e6e8191d-08d9-7144-bb1a-ddaa6c21eccb@suse.de>


[-- Attachment #1.1: Type: text/plain, Size: 2677 bytes --]

Hi Thomas,

On Mon, Feb 22, 2021 at 10:12:49AM +0100, Thomas Zimmermann wrote:
> Am 19.02.21 um 13:00 schrieb Maxime Ripard:
> > Many drivers reference the plane->state pointer in order to get the
> > current plane state in their atomic_check hook, which would be the old
> > plane state in the global atomic state since _swap_state hasn't happened
> > when atomic_check is run.
> > 
> > Use the drm_atomic_get_old_plane_state helper to get that state to make
> > it more obvious.
> > 
> > This was made using the coccinelle script below:
> > 
> > @ plane_atomic_func @
> > identifier helpers;
> > identifier func;
> > @@
> > 
> > static struct drm_plane_helper_funcs helpers = {
> > 	...,
> > 	.atomic_check = func,
> > 	...,
> > };
> > 
> > @ replaces_old_state @
> > identifier plane_atomic_func.func;
> > identifier plane, state, plane_state;
> > @@
> > 
> >   func(struct drm_plane *plane, struct drm_atomic_state *state) {
> >   	...
> > -	struct drm_plane_state *plane_state = plane->state;
> > +	struct drm_plane_state *plane_state = drm_atomic_get_old_plane_state(state, plane);
> >   	...
> >   }
> > 
> > @@
> > identifier plane_atomic_func.func;
> > identifier plane, state, plane_state;
> > @@
> > 
> >   func(struct drm_plane *plane, struct drm_atomic_state *state) {
> >   	struct drm_plane_state *plane_state = drm_atomic_get_old_plane_state(state, plane);
> >   	<...
> > -	plane->state
> > +	plane_state
> >   	...>
> >   }
> > 
> > @ adds_old_state @
> > identifier plane_atomic_func.func;
> > identifier plane, state;
> > @@
> > 
> >   func(struct drm_plane *plane, struct drm_atomic_state *state) {
> > +	struct drm_plane_state *old_plane_state = drm_atomic_get_old_plane_state(state, plane);
> >   	<...
> > -	plane->state
> > +	old_plane_state
> >   	...>
> >   }
> > 
> > @ include depends on adds_old_state || replaces_old_state @
> > @@
> > 
> >   #include <drm/drm_atomic.h>
> > 
> > @ no_include depends on !include && (adds_old_state || replaces_old_state) @
> > @@
> > 
> > + #include <drm/drm_atomic.h>
> >    #include <drm/...>
> > 
> > Reviewed-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
> > Signed-off-by: Maxime Ripard <maxime@cerno.tech>
> 
> Acked-by: Thomas Zimmermann <tzimmermann@suse.de>
> 
> However, I find 'old plane state' somewhat confusing in this context,
> because it's actually the current plane state. Would it make sense to use
> drm_atomic_get_existing_plane_state() instead?

drm_atomic_get_existing_plane_state is deprecated nowadays, in favour of either
drm_atomic_get_old_plane_state or drm_atomic_get_new_plane_state

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

  reply	other threads:[~2021-02-23 14:42 UTC|newest]

Thread overview: 112+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-02-19 12:00 [PATCH v3 01/11] drm/atomic: Pass the full state to planes async atomic check and update Maxime Ripard
2021-02-19 12:00 ` Maxime Ripard
2021-02-19 12:00 ` Maxime Ripard
2021-02-19 12:00 ` Maxime Ripard
2021-02-19 12:00 ` Maxime Ripard
2021-02-19 12:00 ` Maxime Ripard
2021-02-19 12:00 ` [PATCH v3 02/11] drm: Rename plane atomic_check state names Maxime Ripard
2021-02-19 12:00   ` Maxime Ripard
2021-02-19 12:00   ` Maxime Ripard
2021-02-19 12:00   ` Maxime Ripard
2021-02-19 12:00   ` Maxime Ripard
2021-02-19 12:00   ` [Nouveau] " Maxime Ripard
2021-02-19 14:49   ` Thomas Zimmermann
2021-02-19 14:49     ` Thomas Zimmermann
2021-02-19 14:49     ` Thomas Zimmermann
2021-02-19 14:49     ` Thomas Zimmermann
2021-02-19 14:49     ` Thomas Zimmermann
2021-02-19 14:49     ` Thomas Zimmermann
2021-02-19 14:49     ` [Nouveau] " Thomas Zimmermann
2021-02-19 15:12     ` Maxime Ripard
2021-02-19 15:12       ` Maxime Ripard
2021-02-19 15:12       ` Maxime Ripard
2021-02-19 15:12       ` Maxime Ripard
2021-02-19 15:12       ` Maxime Ripard
2021-02-19 15:12       ` [Nouveau] " Maxime Ripard
2021-02-22  9:01       ` Thomas Zimmermann
2021-02-22  9:01         ` Thomas Zimmermann
2021-02-22  9:01         ` Thomas Zimmermann
2021-02-22  9:01         ` Thomas Zimmermann
2021-02-22  9:01         ` Thomas Zimmermann
2021-02-22  9:01         ` Thomas Zimmermann
2021-02-22  9:01         ` [Nouveau] " Thomas Zimmermann
2021-02-19 12:00 ` [PATCH v3 03/11] drm/atmel-hlcdc: Rename custom plane state variable Maxime Ripard
2021-02-19 12:00   ` Maxime Ripard
2021-02-19 12:00   ` Maxime Ripard
2021-02-19 12:00 ` [PATCH v3 04/11] drm/atomic: Pass the full state to planes atomic_check Maxime Ripard
2021-02-19 12:00   ` Maxime Ripard
2021-02-19 12:00   ` Maxime Ripard
2021-02-19 12:00   ` Maxime Ripard
2021-02-19 12:00   ` Maxime Ripard
2021-02-19 12:00   ` [Nouveau] " Maxime Ripard
2021-02-22  9:00   ` Thomas Zimmermann
2021-02-22  9:00     ` Thomas Zimmermann
2021-02-22  9:00     ` Thomas Zimmermann
2021-02-22  9:00     ` Thomas Zimmermann
2021-02-22  9:00     ` Thomas Zimmermann
2021-02-22  9:00     ` Thomas Zimmermann
2021-02-22  9:00     ` [Nouveau] " Thomas Zimmermann
2021-02-19 12:00 ` [PATCH v3 05/11] drm: Use the state pointer directly in " Maxime Ripard
2021-02-19 12:00   ` Maxime Ripard
2021-02-19 12:00   ` Maxime Ripard
2021-02-19 12:00   ` Maxime Ripard
2021-02-19 12:00   ` Maxime Ripard
2021-02-22  9:05   ` Thomas Zimmermann
2021-02-22  9:05     ` Thomas Zimmermann
2021-02-22  9:05     ` Thomas Zimmermann
2021-02-22  9:05     ` Thomas Zimmermann
2021-02-22  9:05     ` Thomas Zimmermann
2021-02-22  9:05     ` Thomas Zimmermann
2021-02-22  9:05     ` Thomas Zimmermann
2021-02-19 12:00 ` [PATCH v3 06/11] drm: Use state helper instead of plane state pointer in atomic_check Maxime Ripard
2021-02-19 12:00   ` Maxime Ripard
2021-02-19 12:00   ` Maxime Ripard
2021-02-22  9:12   ` Thomas Zimmermann
2021-02-22  9:12     ` Thomas Zimmermann
2021-02-22  9:12     ` Thomas Zimmermann
2021-02-23 14:41     ` Maxime Ripard [this message]
2021-02-23 14:41       ` Maxime Ripard
2021-02-23 14:41       ` Maxime Ripard
2021-02-19 12:00 ` [PATCH v3 07/11] drm: Store new plane state in a variable for atomic_update and disable Maxime Ripard
2021-02-19 12:00   ` Maxime Ripard
2021-02-19 12:00   ` Maxime Ripard
2021-02-19 12:00   ` Maxime Ripard
2021-02-19 12:00 ` [PATCH v3 08/11] drm: Rename plane->state variables in atomic update " Maxime Ripard
2021-02-19 12:00   ` Maxime Ripard
2021-02-19 12:00   ` Maxime Ripard
2021-02-19 12:00   ` Maxime Ripard
2021-02-19 12:00   ` Maxime Ripard
2021-02-19 12:00 ` [PATCH v3 09/11] drm/atomic: Pass the full state to planes atomic disable and update Maxime Ripard
2021-02-19 12:00   ` Maxime Ripard
2021-02-19 12:00   ` Maxime Ripard
2021-02-19 12:00   ` Maxime Ripard
2021-02-19 12:00 ` [PATCH v3 10/11] drm: Use state helper instead of the plane state pointer Maxime Ripard
2021-02-19 12:00   ` Maxime Ripard
2021-02-19 12:00   ` Maxime Ripard
2021-02-19 12:00   ` Maxime Ripard
2021-03-30  1:52   ` Stephen Boyd
2021-03-30  1:52     ` Stephen Boyd
2021-03-30 15:35     ` Maxime Ripard
2021-03-30 15:35       ` Maxime Ripard
2021-03-30 18:56       ` Stephen Boyd
2021-03-30 18:56         ` Stephen Boyd
2021-04-08 13:20         ` Maxime Ripard
2021-04-08 13:20           ` Maxime Ripard
2021-04-30 16:44           ` Rob Clark
2021-04-30 16:44             ` Rob Clark
2021-05-04  7:40             ` Daniel Vetter
2021-05-04  7:40               ` Daniel Vetter
2021-02-19 12:00 ` [PATCH v3 11/11] drm/todo: Remove the drm_atomic_state todo item Maxime Ripard
2021-02-19 12:00   ` Maxime Ripard
2021-02-24 11:33 ` [PATCH v3 01/11] drm/atomic: Pass the full state to planes async atomic check and update Thomas Zimmermann
2021-02-24 11:33   ` Thomas Zimmermann
2021-02-24 11:33   ` Thomas Zimmermann
2021-02-24 11:33   ` Thomas Zimmermann
2021-02-24 11:33   ` Thomas Zimmermann
2021-02-24 11:33   ` Thomas Zimmermann
2021-02-25  7:08   ` Maxime Ripard
2021-02-25  7:08     ` Maxime Ripard
2021-02-25  7:08     ` Maxime Ripard
2021-02-25  7:08     ` Maxime Ripard
2021-02-25  7:08     ` Maxime Ripard
2021-02-25  7:08     ` 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=20210223144117.6lhuizr2zrutbkzi@gilmour \
    --to=maxime@cerno.tech \
    --cc=airlied@linux.ie \
    --cc=daniel.vetter@intel.com \
    --cc=daniel@ffwll.ch \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=festevam@gmail.com \
    --cc=freedreno@lists.freedesktop.org \
    --cc=jyri.sarha@iki.fi \
    --cc=kernel@pengutronix.de \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-arm-msm@vger.kernel.org \
    --cc=linux-imx@nxp.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mips@vger.kernel.org \
    --cc=maarten.lankhorst@linux.intel.com \
    --cc=p.zabel@pengutronix.de \
    --cc=paul@crapouillou.net \
    --cc=robdclark@gmail.com \
    --cc=s.hauer@pengutronix.de \
    --cc=sean@poorly.run \
    --cc=shawnguo@kernel.org \
    --cc=tomba@kernel.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 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.