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,URIBL_BLOCKED autolearn=ham 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 1ACAFC433E0 for ; Fri, 15 Jan 2021 21:20:43 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (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 CDFA623603 for ; Fri, 15 Jan 2021 21:20:42 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org CDFA623603 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=ideasonboard.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=dri-devel-bounces@lists.freedesktop.org Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 18C766E4A5; Fri, 15 Jan 2021 21:20:42 +0000 (UTC) Received: from perceval.ideasonboard.com (perceval.ideasonboard.com [IPv6:2001:4b98:dc2:55:216:3eff:fef7:d647]) by gabe.freedesktop.org (Postfix) with ESMTPS id BA79C6E49B; 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> X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: 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 , 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 , Alexey Brodkin , Jonathan Hunter , linux-rockchip@lists.infradead.org, VMware Graphics , Dave Airlie , Alexandre Torgue , Martin Blumenstingl , linux-arm-msm@vger.kernel.org, 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 , Haneen Mohammed , Neil Armstrong , Melissa Wen , Matthias Brugger , Gerd Hoffmann , Sam Ravnborg , Xinwei Kong , Krzysztof Kozlowski , Chen-Yu Tsai , Chun-Kuang Hu , Chen Feng , Alison Wang , 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 , Hans de Goede , linux-mediatek@lists.infradead.org, Laurentiu Palcu , linux-tegra@vger.kernel.org, Jernej Skrabec , Nicolas Ferre , Jyri Sarha Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" 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 _______________________________________________ dri-devel mailing list dri-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/dri-devel