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=-13.6 required=3.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,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 29E3AC433E6 for ; Fri, 15 Jan 2021 21:20:45 +0000 (UTC) Received: from silver.osuosl.org (smtp3.osuosl.org [140.211.166.136]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id ABFBA23603 for ; Fri, 15 Jan 2021 21:20:44 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org ABFBA23603 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=ideasonboard.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=virtualization-bounces@lists.linux-foundation.org Received: from localhost (localhost [127.0.0.1]) by silver.osuosl.org (Postfix) with ESMTP id 3CBF320365; Fri, 15 Jan 2021 21:20:44 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from silver.osuosl.org ([127.0.0.1]) by localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id iYGJWVh88W0P; Fri, 15 Jan 2021 21:20:43 +0000 (UTC) Received: from lists.linuxfoundation.org (lf-lists.osuosl.org [140.211.9.56]) by silver.osuosl.org (Postfix) with ESMTP id 6680920344; Fri, 15 Jan 2021 21:20:43 +0000 (UTC) Received: from lf-lists.osuosl.org (localhost [127.0.0.1]) by lists.linuxfoundation.org (Postfix) with ESMTP id 31E9FC088B; Fri, 15 Jan 2021 21:20:43 +0000 (UTC) Received: from hemlock.osuosl.org (smtp2.osuosl.org [140.211.166.133]) by lists.linuxfoundation.org (Postfix) with ESMTP id 91F55C013A for ; Fri, 15 Jan 2021 21:20:41 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by hemlock.osuosl.org (Postfix) with ESMTP id 76D6A874C6 for ; Fri, 15 Jan 2021 21:20:41 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from hemlock.osuosl.org ([127.0.0.1]) by localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id dYEpCfijxpgp for ; Fri, 15 Jan 2021 21:20:40 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.6 Received: from perceval.ideasonboard.com (perceval.ideasonboard.com [213.167.242.64]) by hemlock.osuosl.org (Postfix) with ESMTPS id ADB7F874C5 for ; Fri, 15 Jan 2021 21:20:40 +0000 (UTC) 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 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-Disposition: inline In-Reply-To: <20210115125703.1315064-10-maxime@cerno.tech> Cc: Heiko =?utf-8?Q?St=C3=BCbner?= , Xinliang Liu , dri-devel@lists.freedesktop.org, Anitha Chrisanthus , linux-stm32@st-md-mailman.stormreply.com, Jerome Brunet , linux-samsung-soc@vger.kernel.org, Vincent Abriou , Michal Simek , Ludovic Desroches , NXP Linux Team , spice-devel@lists.freedesktop.org, Sascha Hauer , Roland Scheidegger , Inki Dae , Sean Paul , Hyun Kwon , Seung-Woo Kim , linux-kernel@vger.kernel.org, Pengutronix Kernel Team , freedreno@lists.freedesktop.org, Alexandre Belloni , David Airlie , Edmund Dea , virtualization@lists.linux-foundation.org, Thierry Reding , Daniel Vetter , Fabio Estevam , Alexey Brodkin , Jonathan Hunter , linux-rockchip@lists.infradead.org, VMware Graphics , Dave Airlie , Alexandre Torgue , Martin Blumenstingl , linux-arm-msm@vger.kernel.org, Maxime Ripard , John Stultz , linux-amlogic@lists.infradead.org, linux-arm-kernel@lists.infradead.org, Rodrigo Siqueira , Boris Brezillon , Sandy Huang , Yannick Fertre , Kyungmin Park , Maxime Coquelin , Kevin Hilman , Brian Starkey , Haneen Mohammed , Neil Armstrong , Stefan Agner , Melissa Wen , Matthias Brugger , Benjamin Gaignard , Sam Ravnborg , Xinwei Kong , Krzysztof Kozlowski , Chen-Yu Tsai , Chun-Kuang Hu , Chen Feng , Alison Wang , Daniel Vetter , Tomi Valkeinen , Philippe Cornu , Kieran Bingham , Tian Tao , Shawn Guo , Liviu Dudau , Paul Cercueil , Marek Vasut , linux-renesas-soc@vger.kernel.org, Joonyoung Shim , Russell King , Thomas Zimmermann , Maarten Lankhorst , Hans de Goede , linux-mediatek@lists.infradead.org, Laurentiu Palcu , linux-tegra@vger.kernel.org, Jernej Skrabec , Nicolas Ferre , Rob Clark , Philipp Zabel , Jyri Sarha , Lucas Stach X-BeenThere: virtualization@lists.linux-foundation.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: Linux virtualization List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: virtualization-bounces@lists.linux-foundation.org Sender: "Virtualization" 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 _______________________________________________ Virtualization mailing list Virtualization@lists.linux-foundation.org https://lists.linuxfoundation.org/mailman/listinfo/virtualization