From patchwork Mon Oct 6 20:58:43 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 526 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=1759784385; bh=CTR2AuJvy5yw1LNo7rXQalM9c4mUrbMInpreHgIWKQU=; 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=iLEeM5QoDK7Ro7A5rgooJEiU7+TPrhpp2nDrhceGA4mxi4iIpel6D7DvcHF963POe xEv83TaZwft5umOn1TEce08gkVhf5rAPHFUlFEttBnSnli1I5rpcY4tg55U3sp7Na2 f0gO8V7Oqk7wEdwTfpiZDm3w8Z+qxF3Ng5EcyyfEDaV52acuhGbhaU+PQ/7vHu9Bwr Hvuu5Hlv2JP/4fKaz/oTUxHv5uvsW1DEmuYsSJpXuONpNnKUN6whO585MJg4hcEBUX 3qQrDlX3ONIeBNQy3Z1H/xpko1lxuTI2zj9AGXHFTXbyrP+YxtqTfW941frGM6nLVa QTFvfTRMfv9xw== Received: from localhost (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id CC82C67FCC for ; Mon, 6 Oct 2025 14:59:45 -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 iy73YBPYdv93 for ; Mon, 6 Oct 2025 14:59:45 -0600 (MDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1759784384; bh=CTR2AuJvy5yw1LNo7rXQalM9c4mUrbMInpreHgIWKQU=; 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=Z/6hofTzUo4MO/EjxNCwjDAEhFcynv+uIEaTgAjEF1LC2Bs2hqKRkhJ7IWSfdIjlK YCq26Vnbs5YQTNnqHaqbAr+HHAU08d4gZTLzf2yZR85slxtdP12ihhalL96La67jBH W/s5UU7Qkph1dUpKyIlXwDPcS4+Xpr+xltgnAtt1bcqpqQk6QDcJn+os+DvKGb7ddD kHLueri0FTqwY8k0fIjj7JacUcEct0/75/Rh/6s8FNG9yTm6nJuZO2WBds7PEGirhK dIEog+Q8ET0w4X0dXpEh+JyUPY81MLIU4zW6dPt/8+1PKpJpJ9Y673Q6cQvrNm5tZc OlVYvFKOsytwA== Received: from mail.u-boot.org (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id 53D4167FD0 for ; Mon, 6 Oct 2025 14:59:44 -0600 (MDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1759784381; bh=CcWnZtJ1a7j4f9h5C7k+srjTc9xYgH9i3cVCa+508Y4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Fb40wBpQal0dA8bpDuioqKwPu3o1w5BKGQEpmHbu4hUaBPwLfuz0CTItShdZDOh1V xcG4uqzJvWKYpd0sfiY6EvwtcH2QJmdWiuZQTMHysOZ0yhXOdLUErkb+kfthglFFZh K6udcZcl3tQbOvrU70MMewaWA+qLDzjAEY/N51nuTaG4WJpANZOxtLSHItlAvZbIlq OMkE9Mv3z/IM9ySG48ZYtqZ+Uy8I2XYxHv7CnrPo0MsYVKJkXEzwwAl16UZUajuWYI WpAkUZ8G8t7DmACpFnM4PLurtjn3g0yBDoxHPHPj4v3bFP2yG8iC7ItbBv1inRD6TP tFrzxhgzV9fJw== Received: from localhost (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id 5E6B767EE4; Mon, 6 Oct 2025 14:59:41 -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 YSOtkC9QayTd; Mon, 6 Oct 2025 14:59:41 -0600 (MDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1759784378; bh=bAEPAzquAdSH9LhjQurgddEUTqnJrTLzeVuaacbtm5k=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=filMEL6D3w2Mu1cUr8Z3HalGZPMsUzIChabralQRJLEvozOcwMR0hqKBxfZ0H5SNY zQxQMfvAdyczBtPsYDCNjSIbQcZ1wszS+G2Ga/9wP694yMeox+fJt3q6B7zVfRrlj1 93y4q9Te1/pbha3lruxA16hlBMGuKMGdO4IHARshO2P4J55aW+7iOCnthYR/4y4+dj A64MC3eD44STLYdM26C0OhTmYjiZ/yD9Z6Ij3UIwcpW0QETcUUR2X6lm4z7NZEl3aa qE6mTQe9/4WkhHlZzp4jtJU4naXqjmi+5bpmZgrvsqtYiSHgUOFKytOkVVIONpq5F4 OpomuRUQbmFPA== Received: from u-boot.org (unknown [73.34.74.121]) by mail.u-boot.org (Postfix) with ESMTPSA id E7EE567F59; Mon, 6 Oct 2025 14:59:37 -0600 (MDT) From: Simon Glass To: U-Boot Concept Date: Mon, 6 Oct 2025 14:58:43 -0600 Message-ID: <20251006205856.2009292-10-sjg@u-boot.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20251006205856.2009292-1-sjg@u-boot.org> References: <20251006205856.2009292-1-sjg@u-boot.org> MIME-Version: 1.0 Message-ID-Hash: W2O66EP6H2IJQRTCFGPZMQQ5HHAVWAGM X-Message-ID-Hash: W2O66EP6H2IJQRTCFGPZMQQ5HHAVWAGM 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 , Claude X-Mailman-Version: 3.3.10 Precedence: list Subject: [Concept] [PATCH 09/14] expo: Introduce a test mode 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 Add a test mode for expo which will display useful debugging information. Put this feature behind a CONFIG_EXPO_TEST option to avoid code-size growth. Create a separate C file and a header. Use static inlines to avoid lots of CONFIG checking in expo.c Enable this feature for sandbox and the EFI app for now. Co-developed-by: Claude Signed-off-by: Simon Glass --- boot/Kconfig | 10 +++++++++ boot/Makefile | 1 + boot/expo.c | 11 ++++++++++ boot/expo_test.c | 25 +++++++++++++++++++++ include/expo_test.h | 53 +++++++++++++++++++++++++++++++++++++++++++++ 5 files changed, 100 insertions(+) create mode 100644 boot/expo_test.c create mode 100644 include/expo_test.h diff --git a/boot/Kconfig b/boot/Kconfig index 933832b4dbf..fb34a10106b 100644 --- a/boot/Kconfig +++ b/boot/Kconfig @@ -982,6 +982,16 @@ config EXPO The expo can be presented in graphics form using a vidconsole, or in text form on a serial console. +config EXPO_TEST + bool "Enable test mode for expo" + depends on EXPO + default y if SANDBOX || EFI_APP + help + Enable test mode for expo. When enabled, expo displays a frame count + in the top-right corner of the display when the 'expotest' environment + variable is set to 1. This is useful for debugging and performance + analysis. + config BOOTMETH_SANDBOX def_bool y depends on SANDBOX diff --git a/boot/Makefile b/boot/Makefile index 3ab1fbb11c0..bb1888f1656 100644 --- a/boot/Makefile +++ b/boot/Makefile @@ -58,6 +58,7 @@ obj-$(CONFIG_$(PHASE_)LOAD_FIT) += common_fit.o obj-$(CONFIG_$(PHASE_)EXPO) += expo.o scene.o expo_build.o obj-$(CONFIG_$(PHASE_)EXPO) += scene_menu.o scene_textline.o scene_textedit.o +obj-$(CONFIG_$(PHASE_)EXPO_TEST) += expo_test.o ifdef CONFIG_COREBOOT_SYSINFO obj-$(CONFIG_$(SPL_TPL_)EXPO) += expo_build_cb.o endif diff --git a/boot/expo.c b/boot/expo.c index afb09aaf5b5..e7c4ab8d7db 100644 --- a/boot/expo.c +++ b/boot/expo.c @@ -10,6 +10,7 @@ #include #include +#include #include #include #include @@ -23,6 +24,7 @@ int expo_new(const char *name, void *priv, struct expo **expp) { struct expo *exp; + int ret; exp = calloc(1, sizeof(struct expo)); if (!exp) @@ -32,6 +34,12 @@ int expo_new(const char *name, void *priv, struct expo **expp) free(exp); return log_msg_ret("name", -ENOMEM); } + ret = expo_test_init(exp); + if (ret) { + free(exp->name); + free(exp); + return log_msg_ret("tst", ret); + } exp->priv = priv; INIT_LIST_HEAD(&exp->scene_head); INIT_LIST_HEAD(&exp->str_head); @@ -53,6 +61,7 @@ void expo_destroy(struct expo *exp) struct scene *scn, *next; struct expo_string *estr, *enext; + expo_test_uninit(exp); list_for_each_entry_safe(scn, next, &exp->scene_head, sibling) scene_destroy(scn); @@ -314,6 +323,8 @@ static int expo_render_(struct expo *exp, bool dirty_only) u32 colour; int ret; + expo_test_update(exp); + back = vid_priv->white_on_black ? VID_BLACK : VID_WHITE; colour = video_index_to_colour(vid_priv, back); ret = video_fill(dev, colour); diff --git a/boot/expo_test.c b/boot/expo_test.c new file mode 100644 index 00000000000..ecef8decc6e --- /dev/null +++ b/boot/expo_test.c @@ -0,0 +1,25 @@ +// SPDX-License-Identifier: GPL-2.0+ +/* + * Expo test mode + * + * Copyright 2025 Canonical Ltd + * Written by Simon Glass + */ + +#define LOG_CATEGORY LOGC_EXPO + +#include +#include + +int expo_test_init(struct expo *exp) +{ + return 0; +} + +void expo_test_uninit(struct expo *exp) +{ +} + +void expo_test_update(struct expo *exp) +{ +} diff --git a/include/expo_test.h b/include/expo_test.h new file mode 100644 index 00000000000..e1918ddeff2 --- /dev/null +++ b/include/expo_test.h @@ -0,0 +1,53 @@ +/* SPDX-License-Identifier: GPL-2.0+ */ +/* + * Copyright Canonical Ltd + * Written by Simon Glass + */ + +#ifndef __EXPO_TEST_H +#define __EXPO_TEST_H + +struct expo; + +#if CONFIG_IS_ENABLED(EXPO_TEST) + +/** + * expo_test_init() - Initialize test mode for an expo + * + * @exp: Expo to initialize test mode for + * Return: 0 if OK, -ve on error + */ +int expo_test_init(struct expo *exp); + +/** + * expo_test_uninit() - Uninitialize test mode for an expo + * + * @exp: Expo to uninitialize test mode for + */ +void expo_test_uninit(struct expo *exp); + +/** + * expo_test_update() - Update test mode counters + * + * @exp: Expo to update test mode for + */ +void expo_test_update(struct expo *exp); + +#else + +static inline int expo_test_init(struct expo *exp) +{ + return 0; +} + +static inline void expo_test_uninit(struct expo *exp) +{ +} + +static inline void expo_test_update(struct expo *exp) +{ +} + +#endif /* EXPO_TEST */ + +#endif /* __EXPO_TEST_H */