From patchwork Tue Jan 3 21:50:03 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alexander Graf X-Patchwork-Id: 1721182 X-Patchwork-Delegate: agust@denx.de Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.denx.de (client-ip=85.214.62.61; helo=phobos.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=) Received: from phobos.denx.de (phobos.denx.de [85.214.62.61]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-384) server-digest SHA384) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4Nmmf84KVNz23f3 for ; Wed, 4 Jan 2023 08:51:44 +1100 (AEDT) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id C475585551; Tue, 3 Jan 2023 22:50:42 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=none (p=none dis=none) header.from=csgraf.de Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Received: by phobos.denx.de (Postfix, from userid 109) id 2035B8554C; Tue, 3 Jan 2023 22:50:27 +0100 (CET) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,SPF_HELO_NONE, SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.2 Received: from zulu616.server4you.de (mail.csgraf.de [85.25.223.15]) by phobos.denx.de (Postfix) with ESMTP id 19EC685557 for ; Tue, 3 Jan 2023 22:50:12 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=none (p=none dis=none) header.from=csgraf.de Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=agraf@csgraf.de Received: from localhost.localdomain (dynamic-092-225-244-121.92.225.pool.telefonica.de [92.225.244.121]) by csgraf.de (Postfix) with ESMTPSA id 65F476080912; Tue, 3 Jan 2023 22:50:11 +0100 (CET) From: Alexander Graf To: u-boot@lists.denx.de Cc: Matthias Brugger , Heinrich Schuchardt , Anatolij Gustschin , Simon Glass , Da Xue , Ilias Apalodimas , Jagan Teki , Andre Przywara , Neil Armstrong , Philipp Tomsich , Kever Yang , Patrick Delaunay , Patrice Chotard , uboot-stm32@st-md-mailman.stormreply.com, u-boot-amlogic@groups.io Subject: [PATCH v4 8/9] video: Always compile cache flushing code Date: Tue, 3 Jan 2023 22:50:03 +0100 Message-Id: <20230103215004.22646-9-agraf@csgraf.de> X-Mailer: git-send-email 2.37.1 (Apple Git-137.1) In-Reply-To: <20230103215004.22646-1-agraf@csgraf.de> References: <20230103215004.22646-1-agraf@csgraf.de> MIME-Version: 1.0 X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.39 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" X-Virus-Scanned: clamav-milter 0.103.6 at phobos.denx.de X-Virus-Status: Clean The dcache flushing code path was conditional on ARM && !DCACHE config options. However, dcaches exist on other platforms as well and may need clearing if their driver requires it. Simplify the compile logic and always enable the dcache flush logic in the video core. That way, drivers can always rely on it to call the arch specific callbacks. This will increase code size for non-ARM platforms with CONFIG_VIDEO=y slightly. Reported-by: Heinrich Schuchardt Signed-off-by: Alexander Graf Reviewed-by: Simon Glass --- drivers/video/video-uclass.c | 14 +++++--------- 1 file changed, 5 insertions(+), 9 deletions(-) diff --git a/drivers/video/video-uclass.c b/drivers/video/video-uclass.c index 956863f98a..bad5eedc96 100644 --- a/drivers/video/video-uclass.c +++ b/drivers/video/video-uclass.c @@ -285,11 +285,13 @@ int video_damage(struct udevice *vid, int x, int y, int width, int height) return 0; } -#if defined(CONFIG_ARM) && !CONFIG_IS_ENABLED(SYS_DCACHE_OFF) static void video_flush_dcache(struct udevice *vid) { struct video_priv *priv = dev_get_uclass_priv(vid); + if (CONFIG_IS_ENABLED(SYS_DCACHE_OFF)) + return; + if (!priv->flush_dcache) return; @@ -318,7 +320,6 @@ static void video_flush_dcache(struct udevice *vid) } } } -#endif static void video_flush_copy(struct udevice *vid) { @@ -357,14 +358,9 @@ int video_sync(struct udevice *vid, bool force) return ret; } - /* - * flush_dcache_range() is declared in common.h but it seems that some - * architectures do not actually implement it. Is there a way to find - * out whether it exists? For now, ARM is safe. - */ -#if defined(CONFIG_ARM) && !CONFIG_IS_ENABLED(SYS_DCACHE_OFF) video_flush_dcache(vid); -#elif defined(CONFIG_VIDEO_SANDBOX_SDL) + +#if defined(CONFIG_VIDEO_SANDBOX_SDL) static ulong last_sync; if (force || get_timer(last_sync) > 100) {