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=-8.6 required=3.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, 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 93BECC56202 for ; Sat, 21 Nov 2020 11:34: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 9DACC20B1F for ; Sat, 21 Nov 2020 11:34:42 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 9DACC20B1F Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=cerno.tech 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 95C6C6E998; Sat, 21 Nov 2020 11:34:31 +0000 (UTC) Received: from new1-smtp.messagingengine.com (new1-smtp.messagingengine.com [66.111.4.221]) by gabe.freedesktop.org (Postfix) with ESMTPS id 76ABF6E8AB for ; Fri, 20 Nov 2020 11:26:03 +0000 (UTC) Received: from compute6.internal (compute6.nyi.internal [10.202.2.46]) by mailnew.nyi.internal (Postfix) with ESMTP id 13F8F5802F5; Fri, 20 Nov 2020 06:26:00 -0500 (EST) Received: from mailfrontend2 ([10.202.2.163]) by compute6.internal (MEProxy); Fri, 20 Nov 2020 06:26:00 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cerno.tech; h= date:from:to:cc:subject:message-id:references:mime-version :content-type:in-reply-to; s=fm1; bh=7lOeFFSMJheQMwXtv8HoYXCVp6X 2rvWNJeiUTK1VOAI=; b=W2emX9339hpFZNESq0ZQcb/wwEVfOQgWr2eRIVtlBEn f9TDBVP/qB/tS20qlwR28pbQfC4z0aG0JalJo0casW9c0DrwvlDdBGxxRQSJ383L 1Zh3uHud2YoNpvKdRx+RhrTMQselLd/gSJPHHEkShYlXRMsIxU5eqS+dzGsoikVN m6jRayb9yNAwiMbF8zIwOtpXiwm9XNFSmpjxgrdx4tgV928zKBrWdwGxWsysYT0N /mys2gNm73FdqOE9G8JYXDCUssmdZ+sHA510bxmmOlE5q16vMlmYMK/v3gppQHUI zmgwk7zzHWy9OHatGVy2qcajCd2QT6dC+UkQpBOGPXw== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to:x-me-proxy :x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s=fm1; bh=7lOeFF SMJheQMwXtv8HoYXCVp6X2rvWNJeiUTK1VOAI=; b=NQFgGEPFLNYu6ZEN28ZWM5 Ksls6A+rhr80x2eOJiNw1ltGvw4fBB4zKZWhA0jYG4+zap2SJgP8mecNz8v12nHS xilzAIEMRO53kVOXPz+6w8mjp6rScMYtSp96rL31mTEZvC1TsMTLR94C+IuK2WO6 WNfegWH3LlwaLTruRwhoUZek1+qRqZePEUDAi7vMVIkpadkflOP2yLCR2MLiaxSl LKuDlSFT/HeMFQBbmthiLX6Rnzf+uyAjZjpvihco6dOt5o4u1zON40OZWJXADTiG YVe4/XSuuCAUBAN8AHlkgvNJKrBCJqInoAQ5aSKJuLzEp4jaAkg5NuUDzCCyVbnQ == X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedujedrudegtddgvdeiucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmne cujfgurhepfffhvffukfhfgggtuggjsehgtderredttddunecuhfhrohhmpeforgigihhm vgcutfhiphgrrhguuceomhgrgihimhgvsegtvghrnhhordhtvggthheqnecuggftrfgrth htvghrnhepuddvudfhkeekhefgffetffelgffftdehffduffegveetffehueeivddvjedv gfevnecukfhppeeltddrkeelrdeikedrjeeinecuvehluhhsthgvrhfuihiivgeptdenuc frrghrrghmpehmrghilhhfrhhomhepmhgrgihimhgvsegtvghrnhhordhtvggthh X-ME-Proxy: Received: from localhost (lfbn-tou-1-1502-76.w90-89.abo.wanadoo.fr [90.89.68.76]) by mail.messagingengine.com (Postfix) with ESMTPA id B6A083064AB2; Fri, 20 Nov 2020 06:25:58 -0500 (EST) Date: Fri, 20 Nov 2020 12:25:57 +0100 From: Maxime Ripard To: Ville =?utf-8?B?U3lyasOkbMOk?= Subject: Re: [PATCH v2] drm: Pass the full state to connectors atomic functions Message-ID: <20201120112557.wxtjzrh4msnphjlx@gilmour> References: <20201118094758.506730-1-maxime@cerno.tech> <20201119152148.GI6112@intel.com> MIME-Version: 1.0 In-Reply-To: <20201119152148.GI6112@intel.com> X-Mailman-Approved-At: Sat, 21 Nov 2020 11:34:30 +0000 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 , Rodrigo Siqueira , David Airlie , dri-devel@lists.freedesktop.org, Melissa Wen , Leo Li , Ben Skeggs , Thomas Zimmermann , Rodrigo Vivi , Alex Deucher , Daniel Vetter , Christian =?utf-8?B?S8O2bmln?= Content-Type: multipart/mixed; boundary="===============0492222307==" Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" --===============0492222307== Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="tlpbcmjqa4olzcmg" Content-Disposition: inline --tlpbcmjqa4olzcmg Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable Hi, On Thu, Nov 19, 2020 at 05:21:48PM +0200, Ville Syrj=E4l=E4 wrote: > On Wed, Nov 18, 2020 at 10:47:58AM +0100, Maxime Ripard wrote: > > The current atomic helpers have either their object state being passed = as > > an argument or the full atomic state. > >=20 > > The former is the pattern that was done at first, before switching to t= he > > latter for new hooks or when it was needed. > >=20 > > Now that the CRTCs have been converted, let's move forward with the > > connectors to provide a consistent interface. > >=20 > > The conversion was done using the coccinelle script below, and built te= sted > > on all the drivers. > >=20 > > @@ > > identifier connector, connector_state; > > @@ > >=20 > > struct drm_connector_helper_funcs { > > ... > > struct drm_encoder* (*atomic_best_encoder)(struct drm_connector *conne= ctor, > > - struct drm_connector_state *connector_state); > > + struct drm_atomic_state *state); > > ... > > } > >=20 > > @@ > > identifier connector, connector_state; > > @@ > >=20 > > struct drm_connector_helper_funcs { > > ... > > void (*atomic_commit)(struct drm_connector *connector, > > - struct drm_connector_state *connector_state); > > + struct drm_atomic_state *state); > > ... > > } > >=20 > > @@ > > struct drm_connector_helper_funcs *FUNCS; > > identifier state; > > identifier connector, connector_state; > > identifier f; > > @@ > >=20 > > f(..., struct drm_atomic_state *state, ...) > > { > > <+... > > - FUNCS->atomic_commit(connector, connector_state); > > + FUNCS->atomic_commit(connector, state); > > ...+> > > } > >=20 > > @@ > > struct drm_connector_helper_funcs *FUNCS; > > identifier state; > > identifier connector, connector_state; > > identifier var, f; > > @@ > >=20 > > f(struct drm_atomic_state *state, ...) >=20 > I think there was some way to deal with these variants using a single > rule, but maybe that required the use of the parameter list stuff > which IIRC was a bit ugly. Probably not worth the hassle here. Do you have any recollection of some patch that used it? I couldn't find a cleaner way to deal with it, but I'd really like to use it if available. > > { > > <+... > > - var =3D FUNCS->atomic_best_encoder(connector, connector_state); > > + var =3D FUNCS->atomic_best_encoder(connector, state); > > ...+> > > } > >=20 > > @ connector_atomic_func @ > > identifier helpers; > > identifier func; > > @@ > >=20 > > ( > > static struct drm_connector_helper_funcs helpers =3D { > > ..., > > .atomic_best_encoder =3D func, > > ..., > > }; > > | > > static struct drm_connector_helper_funcs helpers =3D { > > ..., > > .atomic_commit =3D func, > > ..., > > }; > > ) > >=20 > > @@ > > identifier connector_atomic_func.func; > > identifier connector; > > symbol state; > > @@ > >=20 > > func(struct drm_connector *connector, > > - struct drm_connector_state *state > > + struct drm_connector_state *connector_state > > ) > > { > > ... > > - state > > + connector_state > > ... > > } > >=20 > > @ ignores_state @ > > identifier connector_atomic_func.func; > > identifier connector, connector_state; > > @@ > >=20 > > func(struct drm_connector *connector, > > struct drm_connector_state *connector_state) > > { > > ... when !=3D connector_state > > } > >=20 > > @ adds_state depends on connector_atomic_func && !ignores_state @ > > identifier connector_atomic_func.func; > > identifier connector, connector_state; > > @@ > >=20 > > func(struct drm_connector *connector, struct drm_connector_state *conn= ector_state) > > { > > + struct drm_connector_state *connector_state =3D drm_atomic_get_new_co= nnector_state(state, connector); > > ... > > } > >=20 > > @ depends on connector_atomic_func @ > > identifier connector_atomic_func.func; > > identifier connector_state; > > identifier connector; > > @@ > >=20 > > func(struct drm_connector *connector, > > - struct drm_connector_state *connector_state > > + struct drm_atomic_state *state > > ) > > { ... } > >=20 > > @ include depends on adds_state @ > > @@ > >=20 > > #include > >=20 > > @ no_include depends on !include && adds_state @ > > @@ > >=20 > > + #include > > #include >=20 > Nicely done with the depends. Also never used that stuff myself > so thanks for the tutorial :) You're welcome :) > Reviewed-by: Ville Syrj=E4l=E4 Thanks! I've applied it Maxime --tlpbcmjqa4olzcmg Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iHUEABYIAB0WIQRcEzekXsqa64kGDp7j7w1vZxhRxQUCX7enxQAKCRDj7w1vZxhR xZcpAQD21Htg6xtbdsuuLG4jglT42HbaHs4iOzfiRlcuj8xfZwEA6E+4NtFwHZ/6 rFoOMdI0GiEVhi5DbcwvXq1Kw/JWjwA= =gOJz -----END PGP SIGNATURE----- --tlpbcmjqa4olzcmg-- --===============0492222307== Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline _______________________________________________ dri-devel mailing list dri-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/dri-devel --===============0492222307==--