Received: by 2002:a05:6a10:8c0a:0:0:0:0 with SMTP id go10csp296322pxb; Fri, 15 Jan 2021 13:22:31 -0800 (PST) X-Google-Smtp-Source: ABdhPJxmY0f/HE2ZLtZ1SrInjwaPAU0Qin8AnOjQe14QuHZSxkwTtm2Kw4BXfenYl/7lwqc7q9PM X-Received: by 2002:aa7:d407:: with SMTP id z7mr11931260edq.234.1610745751715; Fri, 15 Jan 2021 13:22:31 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1610745751; cv=none; d=google.com; s=arc-20160816; b=qQk0xRARFrhDfkVc3ASVQvgYV25VaJHblKukBxmpVlWVzRxzfpm9+769oROI/rNH3g Ly+sSGQFiR4p6XvpxNM4YgkpjgPUZcSypwy0vouIicDLEZDR86oTLC5pMWW085KbFwvn Hna/8eqhhxlHBMSlO5E02FPvx9aJC2GdDEgi//QpEWUWRHsLkde8f6UgVyUqf+gapVkt 97M0aUPo6AtZGAq/eFxA1SkuwQv5sG5aePs0GZp5LhK8Cg2GveFoqAbqW/D0eMVg7X1Q ck2uRvNQsYIDKZf1WkdBibk7eT+HtlPYCRpBtbUXZs0bmCfORXyrwp43nZ3SU7dGim6y K8Ug== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=emReHXZ01xca3/b6wKOdBqsTSwtYgPRvbbuniz2G/U0=; b=q8E1X7s0wP8+Tvch9PXQ7o+e/o2p+t0CFoKATYmuHP6/gI9vIGIHN0XmJPorX3A5wT Df8p4PG+JT+KKHz+vpz8qtab9UE7X3l24hC3V4z1+7W6/7byNpHSY4emTKuNiUHfBvXu BQIl1YT8LAj9+LZD+LLno14FvieroB6/uXUfpQiQA26G8ffAG4ip+DhZLPWDHL4ldD6r w+9k5TdO5rqCougmVVTo3Q3Sw1BP1oGn52qN1hJuXfmHT65aJ8wBphOJsB39A7Q6h2Wq +YvKU1Oc3Our/WMkhEztNSkTHIEPG5rbOouKKwaDVkQZZe7OeTYAgwPXKzOZnW3U2HqL pIrw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass (test mode) header.i=@ideasonboard.com header.s=mail header.b=DpGlh+3z; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id r10si15198ejy.116.2021.01.15.13.22.07; Fri, 15 Jan 2021 13:22:31 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass (test mode) header.i=@ideasonboard.com header.s=mail header.b=DpGlh+3z; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726498AbhAOVVZ (ORCPT + 99 others); Fri, 15 Jan 2021 16:21:25 -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-kernel@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