From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-15.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 4660FC43381 for ; Fri, 15 Jan 2021 21:21:38 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 1BA2123603 for ; Fri, 15 Jan 2021 21:21:38 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1725536AbhAOVVY (ORCPT ); Fri, 15 Jan 2021 16:21:24 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40386 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726382AbhAOVVV (ORCPT ); Fri, 15 Jan 2021 16:21:21 -0500 Received: from perceval.ideasonboard.com (perceval.ideasonboard.com [IPv6:2001:4b98:dc2:55:216:3eff:fef7:d647]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E76B3C061757; Fri, 15 Jan 2021 13:20:40 -0800 (PST) Received: from pendragon.ideasonboard.com (62-78-145-57.bb.dnainternet.fi [62.78.145.57]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id 6241F58B; Fri, 15 Jan 2021 22:20:38 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1610745638; bh=gBrtw5MNkdCbuPvi2cTqhl5za5Pqp/q6zVdWl/a94uc=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=DpGlh+3zv26rFKiVKPMFcYE9SIJo78wTzt+f/qWBARm/BpkTmg6EAErEFPBPbbPhX fh5IdmlIWmtQSiBr7ktLcqDESDp5TwoTZAovDL33H8Kodwu6i7gIW5IBgS4KdC5rwv RKLhIq/ekLRDmOepJkHy4FhmHBsfknCCplWClCys= Date: Fri, 15 Jan 2021 23:20:21 +0200 From: Laurent Pinchart To: Maxime Ripard Cc: Maarten Lankhorst , Thomas Zimmermann , Daniel Vetter , David Airlie , dri-devel@lists.freedesktop.org, Alexey Brodkin , Daniel Vetter , Liviu Dudau , Brian Starkey , Russell King , Dave Airlie , Sam Ravnborg , Boris Brezillon , Nicolas Ferre , Alexandre Belloni , Ludovic Desroches , Inki Dae , Joonyoung Shim , Seung-Woo Kim , Kyungmin Park , Krzysztof Kozlowski , Stefan Agner , Alison Wang , Xinliang Liu , Tian Tao , John Stultz , Xinwei Kong , Chen Feng , Laurentiu Palcu , Lucas Stach , Philipp Zabel , Shawn Guo , Sascha Hauer , Pengutronix Kernel Team , Fabio Estevam , NXP Linux Team , Paul Cercueil , Anitha Chrisanthus , Edmund Dea , Chun-Kuang Hu , Matthias Brugger , Neil Armstrong , Kevin Hilman , Jerome Brunet , Martin Blumenstingl , Rob Clark , Sean Paul , Marek Vasut , Tomi Valkeinen , Gerd Hoffmann , Kieran Bingham , Sandy Huang , Heiko =?utf-8?Q?St=C3=BCbner?= , Benjamin Gaignard , Vincent Abriou , Yannick Fertre , Philippe Cornu , Maxime Coquelin , Alexandre Torgue , Maxime Ripard , Chen-Yu Tsai , Jernej Skrabec , Thierry Reding , Jonathan Hunter , Jyri Sarha , Hans de Goede , Rodrigo Siqueira , Melissa Wen , Haneen Mohammed , VMware Graphics , Roland Scheidegger , Hyun Kwon , Michal Simek , linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-samsung-soc@vger.kernel.org, linux-mediatek@lists.infradead.org, linux-amlogic@lists.infradead.org, linux-arm-msm@vger.kernel.org, freedreno@lists.freedesktop.org, virtualization@lists.linux-foundation.org, spice-devel@lists.freedesktop.org, linux-renesas-soc@vger.kernel.org, linux-rockchip@lists.infradead.org, linux-stm32@st-md-mailman.stormreply.com, linux-tegra@vger.kernel.org Subject: Re: [PATCH 10/10] drm: Use state helper instead of the plane state pointer Message-ID: References: <20210115125703.1315064-1-maxime@cerno.tech> <20210115125703.1315064-10-maxime@cerno.tech> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <20210115125703.1315064-10-maxime@cerno.tech> Precedence: bulk List-ID: X-Mailing-List: linux-renesas-soc@vger.kernel.org Hi Maxime, Thank you for the patch. On Fri, Jan 15, 2021 at 01:57:02PM +0100, Maxime Ripard wrote: > Many drivers reference the plane->state pointer in order to get the > current plane state in their atomic_update or atomic_disable hooks, Please don't use the word "current", it's ambiguous. Do you mean old state or new state ? > which would be the new plane state in the global atomic state since > _swap_state happened when those hooks are run. Is this relevant ? drm_atomic_helper_swap_state() doesn't change the old_state and new_state pointers in drm_atomic_state as far as I can tell. > Use the drm_atomic_get_new_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 const struct drm_plane_helper_funcs helpers = { > ..., > .atomic_disable = func, > ..., > }; > | > static const struct drm_plane_helper_funcs helpers = { > ..., > .atomic_update = func, > ..., > }; > ) > > @ adds_new_state @ > identifier plane_atomic_func.func; > identifier plane, state; > identifier new_state; > @@ > > func(struct drm_plane *plane, struct drm_atomic_state *state) > { > ... > - struct drm_plane_state *new_state = plane->state; > + struct drm_plane_state *new_state = drm_atomic_get_new_plane_state(state, plane); > ... > } > > @ include depends on adds_new_state @ > @@ > > #include > > @ no_include depends on !include && adds_new_state @ > @@ > > + #include > #include > > Signed-off-by: Maxime Ripard > --- [snip] > drivers/gpu/drm/omapdrm/omap_plane.c | 6 ++++-- > drivers/gpu/drm/rcar-du/rcar_du_plane.c | 3 ++- > drivers/gpu/drm/rcar-du/rcar_du_vsp.c | 3 ++- > drivers/gpu/drm/xlnx/zynqmp_disp.c | 3 ++- [snip] > diff --git a/drivers/gpu/drm/omapdrm/omap_plane.c b/drivers/gpu/drm/omapdrm/omap_plane.c > index cd8cf7c786b5..021a94de84a1 100644 > --- a/drivers/gpu/drm/omapdrm/omap_plane.c > +++ b/drivers/gpu/drm/omapdrm/omap_plane.c > @@ -44,7 +44,8 @@ static void omap_plane_atomic_update(struct drm_plane *plane, > { > struct omap_drm_private *priv = plane->dev->dev_private; > struct omap_plane *omap_plane = to_omap_plane(plane); > - struct drm_plane_state *new_state = plane->state; This seems to imply that you're interested in the new state. > + struct drm_plane_state *new_state = drm_atomic_get_new_plane_state(state, > + plane); Does this really make things more obvious ? > struct omap_overlay_info info; > int ret; > > @@ -89,7 +90,8 @@ static void omap_plane_atomic_update(struct drm_plane *plane, > static void omap_plane_atomic_disable(struct drm_plane *plane, > struct drm_atomic_state *state) > { > - struct drm_plane_state *new_state = plane->state; > + struct drm_plane_state *new_state = drm_atomic_get_new_plane_state(state, > + plane); > struct omap_drm_private *priv = plane->dev->dev_private; > struct omap_plane *omap_plane = to_omap_plane(plane); > [snip] -- Regards, Laurent Pinchart