From patchwork Thu Dec 1 15:11:44 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Maxime Ripard X-Patchwork-Id: 13061431 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org 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 smtp.lore.kernel.org (Postfix) with ESMTPS id 0B70FC43217 for ; Thu, 1 Dec 2022 15:15:30 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 7BE9A10E5FF; Thu, 1 Dec 2022 15:15:20 +0000 (UTC) Received: from new4-smtp.messagingengine.com (new4-smtp.messagingengine.com [66.111.4.230]) by gabe.freedesktop.org (Postfix) with ESMTPS id 3FDAD10E604 for ; Thu, 1 Dec 2022 15:15:12 +0000 (UTC) Received: from compute5.internal (compute5.nyi.internal [10.202.2.45]) by mailnew.nyi.internal (Postfix) with ESMTP id 942DD580393; Thu, 1 Dec 2022 10:15:11 -0500 (EST) Received: from mailfrontend1 ([10.202.2.162]) by compute5.internal (MEProxy); Thu, 01 Dec 2022 10:15:11 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cerno.tech; h=cc :cc:content-transfer-encoding:content-type:date:date:from:from :in-reply-to:in-reply-to:message-id:mime-version:references :reply-to:sender:subject:subject:to:to; s=fm2; t=1669907711; x= 1669914911; bh=OdgoG4N5gu0zfihZXh28QKTMeemISz3VOG7TcMtDnEw=; b=i 48U7oSkHcApmfKvmsRtF3+pKGOv+GDbNbFlPnnk8OuF3+PKfsK3/xG0CphWKQY8D JB+D8/5/ng1lghgHQkzrRUKUy8JttJgF2nF2yYJvetrGjELeQqLUP2/MAWAAAev5 JudquaSadAaj9PehORf8ns9AYjn6SlLstk91or/J3fa1urDTgnRvDk9aXc+nbjWj NyZerxhm3l4+xKSwrrIVtFh3231U9MIXunnANay2uo3IAv+En9tBSw18/w9zv1GU 8aR5t2O7LPDCtzFMHlm0Hg2gYDJpDbAiy9y6vgcEJ0qlWU2idG5xPhjIHXrn7dOM e0lyaU/ZPCsG6L57aFCyg== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-transfer-encoding :content-type:date:date:feedback-id:feedback-id:from:from :in-reply-to:in-reply-to:message-id:mime-version:references :reply-to:sender:subject:subject:to:to:x-me-proxy:x-me-proxy :x-me-sender:x-me-sender:x-sasl-enc; s=fm1; t=1669907711; x= 1669914911; bh=OdgoG4N5gu0zfihZXh28QKTMeemISz3VOG7TcMtDnEw=; b=w AnxWaECLk3vrcCAtgW0eIpZDGP/6eTQIbVXbuWMKHik2t3NSSbPykDvWFyj9mdNL V2ZvOP7eRbhLEyDyQlELWxH8y9DJq1gO3p1HooESQ591qj78Xs6EE6PClMnKAqC7 gVzV7Yz7eb+pdoOEvOOQFXnDFpx8gR2+kMKHtsTSIu95V0F9RW2BOXhaMZC8Z3nA nkx1nvurP2ULsd+nSs990HlOH69snOyo6exskc2o+Rf0V9wxZdu07XxrJUgyf2Dw OUviPvxESyOXkERF2Hli0gQtcqBAJ+k+Q9IiRxXgu1KX2J7Wb6/IdID1G+2VEklp aZH0ywjhrgTSSpJmyTZbg== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvhedrtdehgdejgecutefuodetggdotefrodftvf curfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfghnecu uegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmdenuc fjughrpefhfffuggfgtgfkfhgjvfevofesthekredtredtjeenucfhrhhomhepofgrgihi mhgvucftihhprghrugcuoehmrgigihhmvgestggvrhhnohdrthgvtghhqeenucggtffrrg htthgvrhhnpedvgfevjefhtdetveevhfelieeuueetgfdvgeevkeegudejffegfffgtedt leelhfenucevlhhushhtvghrufhiiigvpedvnecurfgrrhgrmhepmhgrihhlfhhrohhmpe hmrgigihhmvgestggvrhhnohdrthgvtghh X-ME-Proxy: Feedback-ID: i8771445c:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Thu, 1 Dec 2022 10:15:10 -0500 (EST) From: Maxime Ripard Date: Thu, 01 Dec 2022 16:11:44 +0100 Subject: [PATCH v3 13/20] drm/vc4: Move HVS state to main header MIME-Version: 1.0 Message-Id: <20221123-rpi-kunit-tests-v3-13-4615a663a84a@cerno.tech> References: <20221123-rpi-kunit-tests-v3-0-4615a663a84a@cerno.tech> In-Reply-To: <20221123-rpi-kunit-tests-v3-0-4615a663a84a@cerno.tech> To: Maxime Ripard , Maarten Lankhorst , Daniel Vetter , Thomas Zimmermann , David Airlie X-Mailer: b4 0.10.1 X-Developer-Signature: v=1; a=openpgp-sha256; l=3564; i=maxime@cerno.tech; h=from:subject:message-id; bh=2AYcDp+EnzY9rhv9f3Uik8fq8QACKSwbsm6PRjFyHGM=; b=owGbwMvMwCX2+D1vfrpE4FHG02pJDMkdRzQCdzuZ7r4XWCtzXPjy9M8V0a1Xwr/7+u2+anG89K9/ 4wvljlIWBjEuBlkxRZYYYfMlcadmve5k45sHM4eVCWQIAxenAEzkERcjwxwGJ8X6a5+0e88rO0w9+f au7yMRzb2v3TfOXWwi/+K6y35Ght05LkFrvu9O195/YZbpW+emH+dMnmjkh+84sSck81JGBQcA X-Developer-Key: i=maxime@cerno.tech; a=openpgp; fpr=BE5675C37E818C8B5764241C254BCFC56BF6CE8D 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: =?unknown-8bit?q?David_Gow_=3Cdavidgow=40google=2Ecom=3E=2C_Dave_Stevens?= =?unknown-8bit?q?on_=3Cdave=2Estevenson=40raspberrypi=2Ecom=3E=2C_Greg_Kroa?= =?unknown-8bit?q?h-Hartman_=3Cgregkh=40linuxfoundation=2Eorg=3E=2C_Ma=C3=AD?= =?unknown-8bit?q?ra_Canal_=3Cmcanal=40igalia=2Ecom=3E=2C_Javier_Martinez_Ca?= =?unknown-8bit?q?nillas_=3Cjavierm=40redhat=2Ecom=3E=2C_dri-devel=40lists?= =?unknown-8bit?q?=2Efreedesktop=2Eorg=2C_linux-kernel=40vger=2Ekernel=2Eorg?= =?unknown-8bit?q?=2C_linaro-mm-sig=40lists=2Elinaro=2Eorg=2C_Brendan_Higgin?= =?unknown-8bit?q?s_=3Cbrendan=2Ehiggins=40linux=2Edev=3E=2C_Maxime_Ripard_?= =?unknown-8bit?q?=3Cmaxime=40cerno=2Etech=3E=2C_linux-kselftest=40vger=2Eke?= =?unknown-8bit?q?rnel=2Eorg=2C_kunit-dev=40googlegroups=2Ecom=2C_Ma=C3=ADra?= =?unknown-8bit?q?_Canal_=3Cmairacanal=40riseup=2Enet=3E=2C_linux-media=40vg?= =?unknown-8bit?q?er=2Ekernel=2Eorg?= Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" In order to introduce unit tests for the HVS state computation, we'll need access to the vc4_hvs_state struct definition and its associated helpers. Let's move them in our driver header. Reviewed-by: Javier Martinez Canillas Reviewed-by: MaĆ­ra Canal Signed-off-by: Maxime Ripard --- drivers/gpu/drm/vc4/vc4_drv.h | 23 +++++++++++++++++++++++ drivers/gpu/drm/vc4/vc4_kms.c | 25 +++---------------------- 2 files changed, 26 insertions(+), 22 deletions(-) diff --git a/drivers/gpu/drm/vc4/vc4_drv.h b/drivers/gpu/drm/vc4/vc4_drv.h index 6af615c2eb65..051c2e3b6d43 100644 --- a/drivers/gpu/drm/vc4/vc4_drv.h +++ b/drivers/gpu/drm/vc4/vc4_drv.h @@ -355,6 +355,29 @@ struct vc4_hvs { bool vc5_hdmi_enable_4096by2160; }; +#define HVS_NUM_CHANNELS 3 + +struct vc4_hvs_state { + struct drm_private_state base; + unsigned long core_clock_rate; + + struct { + unsigned in_use: 1; + unsigned long fifo_load; + struct drm_crtc_commit *pending_commit; + } fifo_state[HVS_NUM_CHANNELS]; +}; + +static inline struct vc4_hvs_state * +to_vc4_hvs_state(const struct drm_private_state *priv) +{ + return container_of(priv, struct vc4_hvs_state, base); +} + +struct vc4_hvs_state *vc4_hvs_get_global_state(struct drm_atomic_state *state); +struct vc4_hvs_state *vc4_hvs_get_old_global_state(const struct drm_atomic_state *state); +struct vc4_hvs_state *vc4_hvs_get_new_global_state(const struct drm_atomic_state *state); + struct vc4_plane { struct drm_plane base; }; diff --git a/drivers/gpu/drm/vc4/vc4_kms.c b/drivers/gpu/drm/vc4/vc4_kms.c index 7282545c54a1..53d9f30460cf 100644 --- a/drivers/gpu/drm/vc4/vc4_kms.c +++ b/drivers/gpu/drm/vc4/vc4_kms.c @@ -25,8 +25,6 @@ #include "vc4_drv.h" #include "vc4_regs.h" -#define HVS_NUM_CHANNELS 3 - struct vc4_ctm_state { struct drm_private_state base; struct drm_color_ctm *ctm; @@ -39,23 +37,6 @@ to_vc4_ctm_state(const struct drm_private_state *priv) return container_of(priv, struct vc4_ctm_state, base); } -struct vc4_hvs_state { - struct drm_private_state base; - unsigned long core_clock_rate; - - struct { - unsigned in_use: 1; - unsigned long fifo_load; - struct drm_crtc_commit *pending_commit; - } fifo_state[HVS_NUM_CHANNELS]; -}; - -static struct vc4_hvs_state * -to_vc4_hvs_state(const struct drm_private_state *priv) -{ - return container_of(priv, struct vc4_hvs_state, base); -} - struct vc4_load_tracker_state { struct drm_private_state base; u64 hvs_load; @@ -191,7 +172,7 @@ vc4_ctm_commit(struct vc4_dev *vc4, struct drm_atomic_state *state) VC4_SET_FIELD(ctm_state->fifo, SCALER_OLEDOFFS_DISPFIFO)); } -static struct vc4_hvs_state * +struct vc4_hvs_state * vc4_hvs_get_new_global_state(const struct drm_atomic_state *state) { struct vc4_dev *vc4 = to_vc4_dev(state->dev); @@ -204,7 +185,7 @@ vc4_hvs_get_new_global_state(const struct drm_atomic_state *state) return to_vc4_hvs_state(priv_state); } -static struct vc4_hvs_state * +struct vc4_hvs_state * vc4_hvs_get_old_global_state(const struct drm_atomic_state *state) { struct vc4_dev *vc4 = to_vc4_dev(state->dev); @@ -217,7 +198,7 @@ vc4_hvs_get_old_global_state(const struct drm_atomic_state *state) return to_vc4_hvs_state(priv_state); } -static struct vc4_hvs_state * +struct vc4_hvs_state * vc4_hvs_get_global_state(struct drm_atomic_state *state) { struct vc4_dev *vc4 = to_vc4_dev(state->dev);