From patchwork Mon Aug 25 16:27:10 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 128 Return-Path: X-Original-To: u-boot-concept@u-boot.org Delivered-To: u-boot-concept@u-boot.org DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1756139271; bh=UNhcAxLKMo2qMzqHJbaHKsP3iQioXvxpcTrFAGkj+Gs=; h=From:To:Date:In-Reply-To:References:CC:Subject:List-Id: List-Archive:List-Help:List-Owner:List-Post:List-Subscribe: List-Unsubscribe:From; b=ZB1Lxejd9uqz8lSZtAcuc7G24hh3fQflQRbuDHMOVlwKeWs1Vn8PRf18HR77qVvBF cxXcziV5D07X0EO6/1i0wZFfydanKfCvtpjxKiovPJlPxwfqWD0kiOg95c2GqdRJjY TZm7sUKKBm53RhiFVP44XfONgO3lwxUGjBpfH/JlpWFIg3kZKO81EPXCPq5JGpl/MD 42gj9zB3/9LNBGufirPxTtGN76jXHYDhdBVI5TRGmCPS/8gaNwOJCAiyTSVyucpHAV ecapZee+BXpx83Hy81Bc1Yk+rxYrxnKKuJjq0usA0uiUCUDdTu6mnOejWFSMT3LqFF pHfBEmT7m0ddw== Received: from localhost (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id B3601677A9 for ; Mon, 25 Aug 2025 10:27:51 -0600 (MDT) X-Virus-Scanned: Debian amavis at Received: from mail.u-boot.org ([127.0.0.1]) by localhost (mail.u-boot.org [127.0.0.1]) (amavis, port 10024) with ESMTP id cAeVnjNTjhvs for ; Mon, 25 Aug 2025 10:27:51 -0600 (MDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1756139270; bh=UNhcAxLKMo2qMzqHJbaHKsP3iQioXvxpcTrFAGkj+Gs=; h=From:To:Date:In-Reply-To:References:CC:Subject:List-Id: List-Archive:List-Help:List-Owner:List-Post:List-Subscribe: List-Unsubscribe:From; b=MZrcP+X0VIeCvvPOtwPWWYG+DxzEpMYxwPuJ5LfhULGn9mYxDahV75nt0srwtTe3k hMavBCyxD7l30TCbiCcXwhGeqkxzroal+XdWhN7KrCKsbGT9QJMEvAc18+12uV2ako +Cc04AEIyCLeObsd9grpMDnmzS+JaBxPp5+6tyNIuoPwIdaFIaXf1eSOQEHiegns5T 1XUTguAXMXYQsYrkZbFHj957eHOeZVfZu6Otp8UdGNYxhLnILDTUawHAlnAXuowkH4 g7tFREjOOFum5ofBC8dext0ioAHKhwed2spA44gVUy0ClqSHpzOFYDAc6IsaPH+7Ut Tovd721tUYiPA== Received: from mail.u-boot.org (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id B36336778A for ; Mon, 25 Aug 2025 10:27:50 -0600 (MDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1756139268; bh=AsX9Q/w/p+9p3n//r1xNoMS6dbyYqAiyomGpC7KY1hQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=NJghK8fKdzaY6LmT2BvzHYLowhoqI7/EB9Pub4ozIG87sttVXpR1Goz7wvi2e2ff4 Con7ZUO5sP3ZKnvC9bCoLpL+6x2cITP/ac8ELor7o66mAWXX/7oisBrbQtYOZokcjS nbi48UjlZy1G7881KADL+BO4LX0N/W6s/ZzdA0hxfLZ5S7KdSod8LQ9zZcO6indmu1 tbZLwvsic88RY8x4CDekW3gZnYsImX5RjsnkywJi30cetusqED/JcvCwKClYNApvv9 SJUwdqq1kYU/uu4svEgooWLoWaq1jpBRTdydOal4lfL8UjVmuXYtJLo4t4nCZdDmVc HOACsu7BLR7xA== Received: from localhost (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id CC3AA67792; Mon, 25 Aug 2025 10:27:48 -0600 (MDT) X-Virus-Scanned: Debian amavis at Received: from mail.u-boot.org ([127.0.0.1]) by localhost (mail.u-boot.org [127.0.0.1]) (amavis, port 10026) with ESMTP id MN8BNGcBXh2f; Mon, 25 Aug 2025 10:27:48 -0600 (MDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1756139264; bh=ESAlCsU5WiGG2Eqk5Z/EgVC7VvWzUHzyo+h4AJMl9aM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=CtlgrSuLzTD6JiWCoU1i37Y192zxxEsSXZMf7argPqRiXjcqbyuoQOTgb83AbsHhs M2mo0zQo36fCjySEHUM/ZzWbGjZtgb+aMBdIOjNHc79ZrTD/EZO8jP2JqrgQnaQXz6 bFgDhdRPutT2EOebt4QBH/v1f92fE4sGgbdfD5mPgcIPmxOGJVxklWujN05goP5Flq c1NKUzKYgNCg2LQLk68ZJiJxnly/PAf8fw23HFjlrj+Ronc6tFONpThLUboNakIZr/ li1mGqSndhpl7JqUY6JzPuDgvJim1kJcFcGsqib14cQnSj66xmeou2yPo9k24ZPZyE CZtWjz7I1rzmQ== Received: from u-boot.org (unknown [73.34.74.121]) by mail.u-boot.org (Postfix) with ESMTPSA id D427A6778A; Mon, 25 Aug 2025 10:27:43 -0600 (MDT) From: Simon Glass To: U-Boot Concept Date: Mon, 25 Aug 2025 10:27:10 -0600 Message-ID: <20250825162727.3185381-8-sjg@u-boot.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20250825162727.3185381-1-sjg@u-boot.org> References: <20250825162727.3185381-1-sjg@u-boot.org> MIME-Version: 1.0 Message-ID-Hash: TLPTLKJHF2E63QIV3I46HL4HVEH5OLES X-Message-ID-Hash: TLPTLKJHF2E63QIV3I46HL4HVEH5OLES X-MailFrom: sjg@u-boot.org X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; loop; banned-address; emergency; member-moderation; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; digests; suspicious-header CC: Heinrich Schuchardt , Simon Glass X-Mailman-Version: 3.3.10 Precedence: list Subject: [Concept] [PATCH v2 07/16] sandbox: Provide a way to tell if the video is visible List-Id: Discussion and patches related to U-Boot Concept Archived-At: List-Archive: List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: From: Simon Glass Sandbox is often run with the display disabled, so even though it has a video device, it is not being shown. Provide a way to detect this. For all other platforms, we assume the display is shown, when there is a video device. Signed-off-by: Simon Glass --- Changes in v2: - Add new patch to provide a way to tell if the video is visible arch/sandbox/cpu/state.c | 7 +++++++ arch/sandbox/include/asm/state.h | 7 +++++++ include/video.h | 21 +++++++++++++++++++++ 3 files changed, 35 insertions(+) diff --git a/arch/sandbox/cpu/state.c b/arch/sandbox/cpu/state.c index d883cf2132a..e492855755b 100644 --- a/arch/sandbox/cpu/state.c +++ b/arch/sandbox/cpu/state.c @@ -483,6 +483,13 @@ bool sandbox_serial_is_tty(void) return state->serial_is_tty; } +bool sandbox_video_is_visible(void) +{ + struct sandbox_state *state = state_get_current(); + + return state->show_lcd; +} + int state_init(void) { state = &main_state; diff --git a/arch/sandbox/include/asm/state.h b/arch/sandbox/include/asm/state.h index 5350ee6b8fa..a9c4c889bd9 100644 --- a/arch/sandbox/include/asm/state.h +++ b/arch/sandbox/include/asm/state.h @@ -385,6 +385,13 @@ int state_load_other_fdt(const char **bufp, int *sizep); */ bool sandbox_serial_is_tty(void); +/* + * sandbox_video_is_visible() - check if video display is showing + * + * Return: true if display is active, false if just using the serial console + */ +bool sandbox_video_is_visible(void); + /** * Initialize the test system state */ diff --git a/include/video.h b/include/video.h index 5b539eafb89..b2eaecf5866 100644 --- a/include/video.h +++ b/include/video.h @@ -8,6 +8,9 @@ #define _VIDEO_H_ #include +#ifdef CONFIG_SANDBOX +#include +#endif struct udevice; @@ -460,4 +463,22 @@ int video_reserve_from_bloblist(struct video_handoff *ho); */ ulong video_get_fb(void); +/** + * video_is_visible() - check if the video display is being used + * + * This does not indicate that there is actually a display, only that if there + * is one, we can assume it is present + * + * Return: true if any display is likely visible, false if not + */ +static inline bool video_is_visible(void) +{ +#ifdef CONFIG_SANDBOX + return sandbox_video_is_visible(); +#else + /* assume that it is! */ + return true; +#endif +} + #endif