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 27CE7C433DB for ; Fri, 15 Jan 2021 20:58:02 +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 8D6A023A5E for ; Fri, 15 Jan 2021 20:58:01 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 8D6A023A5E 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 A6C506E499; Fri, 15 Jan 2021 20:58:00 +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 C6B576E47A; Fri, 15 Jan 2021 20:57:58 +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 F32CB58B; Fri, 15 Jan 2021 21:57:56 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1610744277; bh=VjE+h+vZVJvv9Us4y8H19WCA00VSbF5Mv39d7q0MA9U=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=BV3hEMjlk7/sEuKZRq6pt0i2HuaqsH60PVECUzrsL2O1TD7ANDlEjKgpfLxpsno0J V+GDPEX+RT1JaaqsMkgbVNMHG6qTeG7N7mWXbGklvGmCYKw1yxb3d/evRKRLjIbvkr 5xrKIgguJLiN4CHn4qNUfx/2EFxHOtUVq3DDfbUg= Date: Fri, 15 Jan 2021 22:57:40 +0200 From: Laurent Pinchart To: Maxime Ripard Subject: Re: [PATCH 07/10] drm: Store new plane state in a variable for atomic_update and disable Message-ID: References: <20210115125703.1315064-1-maxime@cerno.tech> <20210115125703.1315064-7-maxime@cerno.tech> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20210115125703.1315064-7-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: Haneen Mohammed , Alexandre Belloni , David Airlie , Liviu Dudau , dri-devel@lists.freedesktop.org, Michal Simek , Melissa Wen , linux-tegra@vger.kernel.org, Thierry Reding , Gerd Hoffmann , Anitha Chrisanthus , Daniel Vetter , Sam Ravnborg , Alexey Brodkin , Chen-Yu Tsai , Jonathan Hunter , Roland Scheidegger , Ludovic Desroches , VMware Graphics , Dave Airlie , Hyun Kwon , Chun-Kuang Hu , Edmund Dea , Hans de Goede , linux-mediatek@lists.infradead.org, spice-devel@lists.freedesktop.org, Matthias Brugger , virtualization@lists.linux-foundation.org, linux-arm-kernel@lists.infradead.org, Jernej Skrabec , Rodrigo Siqueira , Tomi Valkeinen , Boris Brezillon , Thomas Zimmermann , Nicolas Ferre , linux-kernel@vger.kernel.org, linux-renesas-soc@vger.kernel.org, Kieran Bingham , Shawn Guo 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:56:59PM +0100, Maxime Ripard wrote: > In order to store the new plane state in a subsequent helper, let's move > the plane->state dereferences into a variable. > > This was done using the following coccinelle script, plus some hand > changes for vmwgfx: > > @ 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, > ..., > }; > ) > > @ has_new_state_old_state @ > identifier plane_atomic_func.func; > identifier plane; > identifier new_state; > symbol old_state; > @@ > > func(struct drm_plane *plane, struct drm_plane_state *old_state) > { > ... > struct drm_plane_state *new_state = plane->state; > ... > } > > @ depends on !has_new_state_old_state @ > identifier plane_atomic_func.func; > identifier plane; > symbol old_state; > @@ > > func(struct drm_plane *plane, struct drm_plane_state *old_state) > { > + struct drm_plane_state *new_state = plane->state; > <+... > - plane->state > + new_state > ...+> > } > > @ has_new_state_state @ > identifier plane_atomic_func.func; > identifier plane; > identifier new_state; > symbol state; > @@ > > func(struct drm_plane *plane, struct drm_plane_state *state) > { > ... > struct drm_plane_state *new_state = plane->state; > ... > } > > @ depends on !has_new_state_state @ > identifier plane_atomic_func.func; > identifier plane; > symbol state; > @@ > > func(struct drm_plane *plane, struct drm_plane_state *state) > { > + struct drm_plane_state *new_plane_state = plane->state; > <+... > - plane->state > + new_plane_state > ...+> > } > > @ has_new_state_old_s @ > identifier plane_atomic_func.func; > identifier plane; > identifier new_state; > symbol old_s; > @@ > > func(struct drm_plane *plane, struct drm_plane_state *old_s) > { > ... > struct drm_plane_state *new_state = plane->state; > ... > } > > @ depends on !has_new_state_old_s @ > identifier plane_atomic_func.func; > identifier plane; > symbol old_s; > @@ > > func(struct drm_plane *plane, struct drm_plane_state *old_s) > { > + struct drm_plane_state *new_s = plane->state; > <+... > - plane->state > + new_s > ...+> > } I may have taken this as an opportunity to align naming conventions for variables across drivers, but that may just be me. > > Signed-off-by: Maxime Ripard > --- [snip] > drivers/gpu/drm/omapdrm/omap_plane.c | 5 ++- > drivers/gpu/drm/rcar-du/rcar_du_plane.c | 5 ++- > drivers/gpu/drm/rcar-du/rcar_du_vsp.c | 3 +- > drivers/gpu/drm/xlnx/zynqmp_disp.c | 7 ++-- For these, with the small issue below addressed, Reviewed-by: Laurent Pinchart [snip] > diff --git a/drivers/gpu/drm/omapdrm/omap_plane.c b/drivers/gpu/drm/omapdrm/omap_plane.c > index 1042e1147e74..de5ad69af4cb 100644 > --- a/drivers/gpu/drm/omapdrm/omap_plane.c > +++ b/drivers/gpu/drm/omapdrm/omap_plane.c > @@ -88,11 +88,12 @@ static void omap_plane_atomic_update(struct drm_plane *plane, > static void omap_plane_atomic_disable(struct drm_plane *plane, > struct drm_plane_state *old_state) > { > + struct drm_plane_state *new_state = plane->state; > struct omap_drm_private *priv = plane->dev->dev_private; > struct omap_plane *omap_plane = to_omap_plane(plane); > > - plane->state->rotation = DRM_MODE_ROTATE_0; > - plane->state->zpos = plane->type == DRM_PLANE_TYPE_PRIMARY > + new_state->rotation = DRM_MODE_ROTATE_0; > + new_state->zpos = plane->type == DRM_PLANE_TYPE_PRIMARY > ? 0 : omap_plane->id; Can you fix the indentation ? > dispc_ovl_enable(priv->dispc, omap_plane->id, false); [snip] -- Regards, Laurent Pinchart _______________________________________________ dri-devel mailing list dri-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/dri-devel