From patchwork Mon Oct 6 20:58:35 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 518 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=1759784360; bh=TfPH7pfbajKuqOU4UqRTEB89NiwMaRL9lnEN0PU2SvQ=; 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=K/5BIlk4aRLjD+KEqdkBL+f77VnwyJoImMq0aMb9Pjaf9O1mZsCWrZr1xVSGW9Q7n mjiEtV+rIBmzPeMu1h7f32aVgYyRUA1Cr3KF0t+vYwNsAFliPeClBqGpyTHouf8wWc xHs8AazJ/B+UkGca3716DCl67ay1aCSR3a/kC6XLSVSGbGM1JLKGADsVLHSPmT6IMz jnFMWapFNIUz16XBvLbG7SToAyVl5pxZySRLCsFRAT+cXhEe2/keXsaqEVFpy97TfH 2RNr6BegpktiqwMb47YZzspOMRcye2qrH1mpYjF3QFZHl/pLqBsOBgWakaAhhQntei LpKDrwbtI9HFA== Received: from localhost (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id E02CB67EE4 for ; Mon, 6 Oct 2025 14:59:20 -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 vlOrWIaEoAh9 for ; Mon, 6 Oct 2025 14:59:20 -0600 (MDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1759784359; bh=TfPH7pfbajKuqOU4UqRTEB89NiwMaRL9lnEN0PU2SvQ=; 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=pTrE8DlBE7EoFvFKaSXGhbX8oP728vPigO36LZLCR2TvbYlcRGPGq/11fUNWO6n3c Otf0ZtRWaSl73Tt+LhTq4T5sj/FQ8kzfPdJWxkuskMh9o5r+5bU7H2WCJCqaDnEbBK 8ofGCcSklifDegzt1zXWOvWhpT7zvLrFsZ0RJQKCyf6L1TECHCqDOniClBzn5DkJqI Y2xLaqN35Qcx3eTTAtduVXYA/tnCRidEQlInH1po4QA47L8JsSOFPicwradIAZjifZ k+gRUgibH2nramf6IxkbqlRbUQPi4nZtIc7LLQLWKArE+APnbe1JQIxLP/y//OJQEL DwBRNkTdFxCsA== Received: from mail.u-boot.org (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id C5EEB67F03 for ; Mon, 6 Oct 2025 14:59:19 -0600 (MDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1759784358; bh=YuyPZ+V7W2M1TxaCLekT5nvEKLtO9AyWcrEvjK23dgA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=FKSFy9sSDia9E6zDdPpq/WxIP4Yk2PBQBN6K1GXTSfaLypGnoMlsoXpnXcaXtseJo W7h7WVbENdnLX6TkE+VZKssQfyXNR4dhvahq1HgWhaQinYuhaGHaEGj/bSU8Jey6lm f0PcacqvsUeyyqdPShMRa2omuJweX0H8vh/zzB0HeQv/P/9IfsIIwQw2+7uxu5bD9h 8Wh397ExyVz9jpm43OLMnJSkqTwYivO9CI2hLQN225BT+HVqFvEUPYzncucP6HXko3 y9ND+0XgsbSaZwYGsK00GygE5awIBa1wSIgiXS/1GZVNsvrxwUXNZnjJAhMbkxHuxR 0YbEFg4d327iQ== Received: from localhost (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id 0FF5567EE4; Mon, 6 Oct 2025 14:59:18 -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 DOBN8p-0r2a0; Mon, 6 Oct 2025 14:59:17 -0600 (MDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1759784357; bh=Kj8jdphRew8k99O9s6pFTaUIhfIVnUmkje8zgBPbE0k=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=vLRPTnuH3IPUOra2E5Ty3MeG5vC7GaGG7sD6LjsW3tmAasPFuOvN0tX/elOKtB/Nb UFUpp45w2lgu9ZgHe+BFDS/rqVsMsq92KxEQIfmgV0BOWLsfUkG7bdVxEELtZakoRI sv2z+sh50ap3uFr8RbSMmvWO4GIei3Y1q5zZpoR5if4v48WSS9xF+ZxdahevcMX8jB QYdmlGaW6yqOsvHAa1ZF2Onff0jmHeb2DOnwHVOc/5718TGwsiSOdqRSYiXQcT8JDj zRpurYIznyVZY/KhFwofLxfK5IpCp1q7gRY/Fusz5lZidcI78bWdbsFMyLjW7wu59B RndF7n99KLq1g== Received: from u-boot.org (unknown [73.34.74.121]) by mail.u-boot.org (Postfix) with ESMTPSA id F3F0067F03; Mon, 6 Oct 2025 14:59:16 -0600 (MDT) From: Simon Glass To: U-Boot Concept Date: Mon, 6 Oct 2025 14:58:35 -0600 Message-ID: <20251006205856.2009292-2-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: K4JPTMAVBICLDCRCEI5NZP5IF36NBXOY X-Message-ID-Hash: K4JPTMAVBICLDCRCEI5NZP5IF36NBXOY 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 01/14] video: Do the sync timing within video_sync() 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 The timer is used in a different function from that where it is set up. Move setup into video_sync() so that the code is all together. Signed-off-by: Simon Glass --- drivers/video/video-uclass.c | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/drivers/video/video-uclass.c b/drivers/video/video-uclass.c index 500a04a0442..37171f6b2da 100644 --- a/drivers/video/video-uclass.c +++ b/drivers/video/video-uclass.c @@ -519,11 +519,6 @@ int video_manual_sync(struct udevice *vid, uint flags) video_flush_dcache(vid, false); - if (IS_ENABLED(CONFIG_VIDEO_COPY) && (flags & VIDSYNC_COPY)) - video_flush_dcache(vid, true); - - priv->last_sync = get_timer(0); - if (IS_ENABLED(CONFIG_VIDEO_DAMAGE)) { struct vid_bbox *damage = &priv->damage; @@ -542,6 +537,7 @@ int video_sync(struct udevice *vid, bool force) struct video_priv *priv = dev_get_uclass_priv(vid); struct video_uc_priv *uc_priv = uclass_get_priv(vid->uclass); uint flags = 0; + int ret; /* Skip sync if manual-sync mode is active */ if (uc_priv->manual_sync) @@ -558,7 +554,13 @@ int video_sync(struct udevice *vid, bool force) if (IS_ENABLED(CONFIG_VIDEO_COPY)) flags |= VIDSYNC_COPY; - return video_manual_sync(vid, flags); + ret = video_manual_sync(vid, flags); + if (ret) + return ret; + + priv->last_sync = get_timer(0); + + return 0; } void video_sync_all(void) From patchwork Mon Oct 6 20:58:36 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 519 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=1759784368; bh=0iu+2fEfVIDletf7vW2nB3xw1Tk6FLd812u+m1YTiMw=; 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=lRS8fHTtK46tMEU5Bw51/jGePIp0RcljVJtF3++D+GGaAY4YV2ZczEKUYqAwEl4ra AKYxyaxP7ODfPYjnTdJDs/OTEENBW9C6ElasuEfHvYrF3VTG3hodyWvpdHbLh/7y75 hVHoWg0jVamEwJgVQ6PNmS1zkFeOFFp425dMKaXrwoBGyVuHDOfDqY5ArW8I+Too5E 11dzfrbMhX6n1lh+RV8jeXuMXA17De0TY/TlR61bO7DaNhCeSLspVjWHuQWqi+2AEY eWcQ41jNa4y1+CErKTEVweN5XswYjHjZb2iLo6da8pLyUY8I6MDPfdXIxAk+FBVTFc +X+LeCB8+OEgg== Received: from localhost (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id 679D967F8D for ; Mon, 6 Oct 2025 14:59:28 -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 cYfQfwCxSbXs for ; Mon, 6 Oct 2025 14:59:28 -0600 (MDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1759784368; bh=0iu+2fEfVIDletf7vW2nB3xw1Tk6FLd812u+m1YTiMw=; 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=lRS8fHTtK46tMEU5Bw51/jGePIp0RcljVJtF3++D+GGaAY4YV2ZczEKUYqAwEl4ra AKYxyaxP7ODfPYjnTdJDs/OTEENBW9C6ElasuEfHvYrF3VTG3hodyWvpdHbLh/7y75 hVHoWg0jVamEwJgVQ6PNmS1zkFeOFFp425dMKaXrwoBGyVuHDOfDqY5ArW8I+Too5E 11dzfrbMhX6n1lh+RV8jeXuMXA17De0TY/TlR61bO7DaNhCeSLspVjWHuQWqi+2AEY eWcQ41jNa4y1+CErKTEVweN5XswYjHjZb2iLo6da8pLyUY8I6MDPfdXIxAk+FBVTFc +X+LeCB8+OEgg== Received: from mail.u-boot.org (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id 5470667F59 for ; Mon, 6 Oct 2025 14:59:28 -0600 (MDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1759784365; bh=4rQxxWyexHUxpno+Loat7WtT5N+4bmtSc2JbWn6bapQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=MAzCThqnYhPYYQDzbNCZvojST7R/YbXT7YNRiwtT0WQ/TeMsEKiT3tRz3ELfkDyiN 7EylXD34FDTdaykyVdr5bPnma6P9s7c2F5b9YlJhuf4cf32KJ9ZA5wVLmHGWHuczSd ePLo26OOqmE2XcEpfql4P1b3sEFAd169OTq8NE4e0mf/i6ZXs125kh42s0iOqtDYHK CDPsom8rtq0N7YPWlDGwkI9DOt/hhX+5iBbtd2H+l3OkdpIxjCs4v38Wbick8pDMN3 VUHdFWcl3MqcCLQcfNlnoPJ1/j7tKl72wk51DpVRJcBwdVR/V6LRGU8l9jj2mKc5mP dscB0fUEsjoJA== Received: from localhost (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id 7682167F10; Mon, 6 Oct 2025 14:59:25 -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 AopvGFMoLNJd; Mon, 6 Oct 2025 14:59:25 -0600 (MDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1759784358; bh=p/7er+8J/WFm1QpUuBLLwEhseaom6fJisD4zIk/NPyU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=CeXDsHPT1hW/NgtzJVf4bGSjmb9NyWIXjtSFA3g8dN1hTXo5dMX96YWg4BVhkWxO3 7cu3a5Eain2UVUUrLWLWrHP/cy/KL5+WI2eQ1b9jeqH4slH+VWTSUVNzVGP3eZwhWI TZwBGWZ98dcLt4QDZTx8bokYLIoyHqVYxsThGGPOlZoA1Eek69k1oFFLok7ztpD/oN 9hJH94cTS2dIsS/CLj3Zgl03clTVtd5CM4zZaBMmxe45x1cfom16oXD+/1Xl2ghAs/ K5yavrX4+/lxNnA49oxymXdcP/78Xacwiqu7kiwEBvqz1ecutLmnn6Xb0qzasxVLG2 HxYjlOUq3HHlg== Received: from u-boot.org (unknown [73.34.74.121]) by mail.u-boot.org (Postfix) with ESMTPSA id 5544367F8E; Mon, 6 Oct 2025 14:59:18 -0600 (MDT) From: Simon Glass To: U-Boot Concept Date: Mon, 6 Oct 2025 14:58:36 -0600 Message-ID: <20251006205856.2009292-3-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: INQJLF4MZBA47NTBZ5PLUDJ7ZHIS4B5Z X-Message-ID-Hash: INQJLF4MZBA47NTBZ5PLUDJ7ZHIS4B5Z 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 02/14] video: Add a little more documentation to the uclass 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 The copy buffer is a bit confusing, so add some more documentation for it. Signed-off-by: Simon Glass --- drivers/video/video-uclass.c | 30 ++++++++++++++++++++++++++---- 1 file changed, 26 insertions(+), 4 deletions(-) diff --git a/drivers/video/video-uclass.c b/drivers/video/video-uclass.c index 37171f6b2da..f50452cc956 100644 --- a/drivers/video/video-uclass.c +++ b/drivers/video/video-uclass.c @@ -47,10 +47,32 @@ * @size and @align information and this time video_post_bind() checks that * the drivers does not overflow the allocated memory. * - * The frame buffer address is actually set (to plat->base) in - * video_post_probe(). This function also clears the frame buffer and - * allocates a suitable text console device. This can then be used to write - * text to the video device. + * The driver's probe() function is called, which should set up the hardware + * and fill in any required fields in struct video_uc_plat and + * struct video_priv. + * + * After the driver's probe() completes, video_post_probe() is called. This + * converts the framebuffer addresses (plat->base and plat->copy_base) to + * pointers (priv->fb and priv->copy_fb), clears the frame buffer, and + * allocates a suitable text-console device. The console can then be used to + * write text to the video device. + * + * Copy framebuffer (CONFIG_VIDEO_COPY): + * + * To avoid flicker, some drivers need to draw to an off-screen buffer and + * then copy to the visible framebuffer. Drivers can enable this in two ways: + * + * 1) If the framebuffer is in fixed memory (common on x86 hardware), in + * bind() leave plat->size as 0 but set up plat->copy_size. This will allocate a + * copy buffer. The driver must then set copy_base to the fixed-memory address + * and base to the allocated copy_base. See for example vesa_setup_video_priv(). + * + * 2) Otherwise, since plat->size to the required value. The off-screen + * framebuffer will be allocated. The driver must then set up copy_base in the + * probe() method. + * + * In both cases, U-Boot draws to priv->fb and video_sync() copies the + * damaged regions from priv->fb to priv->copy_fb to make them visible. */ DECLARE_GLOBAL_DATA_PTR; From patchwork Mon Oct 6 20:58:37 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 520 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=1759784369; bh=fH41LbotBVScFnvECyK9JS4PWiLhax6sJPO/CooHrlk=; 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=XIYDhZJV7CQwWPM8L8VmygGMTy3hXPnShuePodx+jTQBGHP047LWb41cNRORM+QbX mj2q3EJXe/Q3ylHEwoFOshuxugSjRqTZe6Jpne7nK2xZXjawyYtJaaSlelbsc87kfm C1XhcU5hZf7NCy62iNaeYMewWDiPqlcp993VDOHXbYU+y9Ts6+1ePPhR/wyFl5Hjtn 9N9OfQiRrtUjEi3R2zd+zsuv6BmhtUnWlDGkh30J+lbDQ9UqrNZL8pv/Xdo7UYCNwe hxT/Rvktw0cIi/nAIpQzZ/kQzGYIunpgoRq0W/j06ap7mjXBaZcCly9lW8FFc/mXyc dDviNCrT24apA== Received: from localhost (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id 2EE2767F8D for ; Mon, 6 Oct 2025 14:59:29 -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 DRPdaNActDNY for ; Mon, 6 Oct 2025 14:59:29 -0600 (MDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1759784369; bh=fH41LbotBVScFnvECyK9JS4PWiLhax6sJPO/CooHrlk=; 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=XIYDhZJV7CQwWPM8L8VmygGMTy3hXPnShuePodx+jTQBGHP047LWb41cNRORM+QbX mj2q3EJXe/Q3ylHEwoFOshuxugSjRqTZe6Jpne7nK2xZXjawyYtJaaSlelbsc87kfm C1XhcU5hZf7NCy62iNaeYMewWDiPqlcp993VDOHXbYU+y9Ts6+1ePPhR/wyFl5Hjtn 9N9OfQiRrtUjEi3R2zd+zsuv6BmhtUnWlDGkh30J+lbDQ9UqrNZL8pv/Xdo7UYCNwe hxT/Rvktw0cIi/nAIpQzZ/kQzGYIunpgoRq0W/j06ap7mjXBaZcCly9lW8FFc/mXyc dDviNCrT24apA== Received: from mail.u-boot.org (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id 17EC667F52 for ; Mon, 6 Oct 2025 14:59:29 -0600 (MDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1759784367; bh=ENIplAD0Dw7+qzECrb4Q9LFqskpffsewB+Bu7e9TujU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=sVoMt9Kv+AJo5Yi3Lf3PtICh+xFRzSBZG5xvgQqVE+XCyRDmdBLHCaVjcMOaLKa+0 xCaCRzeyHdNPIf0ZxAPF7EzL3zc3ZZEL0ovz80y76nAtL625oD8vrfMlWD+HADrY4h WnWngTFrBAzft2xBbOWvRk/ruKthDErFQJaMerEhDKTEofvaFOHQDD5NSyMbHcUfZL k7IOUI7rz72kBNqPVxFiJ4Yr8QDsVK7GEEDhikMvU/J88yZConM07Wh0m0fxZtyT9U KEr0sLUSo9mAheGnFCr/CmlFtiqsMO7daky3QJ1rZ4I9bDwXTcZK1BUxC9LxuJZAkI 7tpYbCKBhkFmQ== Received: from localhost (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id 4737F67F03; Mon, 6 Oct 2025 14:59:27 -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 A4GIcrxs-yFj; Mon, 6 Oct 2025 14:59:27 -0600 (MDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1759784363; bh=CBhZua/OKcuLh/Hxsyj4AKrosR4eJtcN7o7aNPsdUqk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=LjAyU18a8ep7YwZ5uqxDGQpg4LFPxEjH08RdMo5zcBcN+lc8fw/MJvzg5Kq0cHjV7 pfot/2OIcJK0fMd8XUqahATM1Dqb+UhepV9yZYJjN90Knsqf3qbJdqw01cJ2uTZKff ucCFi/klwmtAXQsTx8pSp7mdzVkdvL5I2HbBJZTDmS7q5gzaboEICaLE8c2D3hb7bX gZnGnOVsdNBuS8LsPglO0HhrZPjkKndss7/JBURoOKZKiy6Wp/1OQJnR3Jo1HWRUwk wT4gTRh6H7bo6XYxlYNa2rcdALRHOVysmsEMF5YGObFL5rGNpGqP7BjZr6TqT+kDNx QBu7B9dNTG9NA== Received: from u-boot.org (unknown [73.34.74.121]) by mail.u-boot.org (Postfix) with ESMTPSA id E3DFB67EE4; Mon, 6 Oct 2025 14:59:22 -0600 (MDT) From: Simon Glass To: U-Boot Concept Date: Mon, 6 Oct 2025 14:58:37 -0600 Message-ID: <20251006205856.2009292-4-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: XDWUAL3CT2C7NWWNWVR4OR6J2UOJ7NDP X-Message-ID-Hash: XDWUAL3CT2C7NWWNWVR4OR6J2UOJ7NDP 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 03/14] mouse: Add comment for mouse_get_event() 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 Document the mouse_get_event() function to explain what it does and its return values. Co-developed-by: Claude Signed-off-by: Simon Glass --- include/mouse.h | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/include/mouse.h b/include/mouse.h index 7fe263b289f..8212a1e89d4 100644 --- a/include/mouse.h +++ b/include/mouse.h @@ -86,11 +86,35 @@ struct mouse_event { }; struct mouse_ops { + /** + * mouse_get_event() - Get a mouse event + * + * Gets the next available mouse event from the device. This can be a + * motion event (mouse movement) or a button event (button press or + * release). + * + * @dev: Mouse device + * @event: Returns the mouse event + * Returns: 0 if OK, -EAGAIN if no event available, -ENOSYS if not + * supported + */ int (*get_event)(struct udevice *dev, struct mouse_event *event); }; #define mouse_get_ops(dev) ((struct mouse_ops *)(dev)->driver->ops) +/** + * mouse_get_event() - Get a mouse event + * + * Gets the next available mouse event from the device. This can be a + * motion event (mouse movement) or a button event (button press or + * release). + * + * @dev: Mouse device + * @event: Returns the mouse event + * Returns: 0 if OK, -EAGAIN if no event available, -ENOSYS if not + * supported + */ int mouse_get_event(struct udevice *dev, struct mouse_event *event); /** From patchwork Mon Oct 6 20:58:38 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 521 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=1759784375; bh=1FJqG7Y3UZtIVXIAhMlnQHau4CQqVN4ajBr/2W4U2D0=; 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=c12eBKJQaBNW4HvEtdeMoQas2yocLNSRcLhnjb0a4RKTWVlF2vpeoFZIzDrE7fkee dixxcH9wMOXZ5+ECh0snavwEQKjOsjXH5HZLIoMuAPpz82lCTvJzCADm/hZUr60oeq ADZ+KROaLWAIox6H1Ta0nqopbsEE3OG7oTMtXRj3y56aGXbOygMttbWURe3t8KoAdv Ja+5m0/U+/UQ7B0PapLA8NE0C8vH6MZuvXfKlSVrILBAkQ3mA2Y4nx/c7PAZc//0ps +RzzFV9xiBllHJ4zo5hwuxPbQWHtaYjSRnds/XHEKVHqzAkIGCvpn29jRZIUc3mb5v fWxgtIAHoPw8w== Received: from localhost (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id BCE3067F8D for ; Mon, 6 Oct 2025 14:59:35 -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 GlWuyBFzWUhP for ; Mon, 6 Oct 2025 14:59:35 -0600 (MDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1759784375; bh=1FJqG7Y3UZtIVXIAhMlnQHau4CQqVN4ajBr/2W4U2D0=; 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=c12eBKJQaBNW4HvEtdeMoQas2yocLNSRcLhnjb0a4RKTWVlF2vpeoFZIzDrE7fkee dixxcH9wMOXZ5+ECh0snavwEQKjOsjXH5HZLIoMuAPpz82lCTvJzCADm/hZUr60oeq ADZ+KROaLWAIox6H1Ta0nqopbsEE3OG7oTMtXRj3y56aGXbOygMttbWURe3t8KoAdv Ja+5m0/U+/UQ7B0PapLA8NE0C8vH6MZuvXfKlSVrILBAkQ3mA2Y4nx/c7PAZc//0ps +RzzFV9xiBllHJ4zo5hwuxPbQWHtaYjSRnds/XHEKVHqzAkIGCvpn29jRZIUc3mb5v fWxgtIAHoPw8w== Received: from mail.u-boot.org (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id A878A67F59 for ; Mon, 6 Oct 2025 14:59:35 -0600 (MDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1759784373; bh=jguAawF30R+ybW25XnVCNlZs3KlFuE95WbX09rqyJjY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=vLtuOEJ9LEhU9txqtsER5zUbfNvYjxgRuRCrbCsXeqUFmsv0ZsCvgTBKvz0OSP5qD PDoY5wF/OF4YfcQaZRwf483gG81PG/Yc4mQd4DF0N7nGr25toAmvQ8SEOOUG4ieIGT 8KgmM8IcfrABV1Gyun54wxwnJZiUg1n5/neS7opVrLjKs2uJCUK8uC+98ZNIxXNqAc RGPQYLcnN4ke4pLF4gYp008qph3MKh0h3OMSgVnX+lM7KKU8e2WijHGpc9H7pvLX3s hNLv783Nn661y6Fh+s00yk+3Sz8m1PXa/eqBmB65gE2URyU58t3BOq0lHz+7dujFfM 5lHTudUDX8b3g== Received: from localhost (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id 4A90067F03; Mon, 6 Oct 2025 14:59:33 -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 h8fyYXBAPKBv; Mon, 6 Oct 2025 14:59:33 -0600 (MDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1759784367; bh=cxNzUbGNaReE37ArBv8x+nrBCTu7Zh5m/6ukaROMljI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=lNs/RfUP1HIFAsRifrMxrO5deXfCUrQddLB6ZJ9uYXPzirUWZY7XgrhYV0FehDW6Y D4m16xYPs+F71yS1oMdf/VtUkVUsjDlbYIH9GYefJsQBawQlK+0obnPYc6wrKJyIVH xcrtg/Tl7bR97affmUNkqRSKUjKQnZIYSyvnLon5mK0qxonJ11PheT0R8zDwcuEAL5 hlDh0W2zrRqtHEy1s9of71rNlPUWSSjke+TnsArQViVQfI6Lk7uci4CRdCxH3i5ZLt lb2FYXrVoFnk7IJ4Y5++E+Os+LurwUZcWq4fL3gnTI0ZE9+hX/V6m3S679PE6MOSpD WBrxC+3KXAUgQ== Received: from u-boot.org (unknown [73.34.74.121]) by mail.u-boot.org (Postfix) with ESMTPSA id 8B29F67EE4; Mon, 6 Oct 2025 14:59:27 -0600 (MDT) From: Simon Glass To: U-Boot Concept Date: Mon, 6 Oct 2025 14:58:38 -0600 Message-ID: <20251006205856.2009292-5-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: NBNNT33C6VDIUJSLV4G5YYEAVB5JWNGW X-Message-ID-Hash: NBNNT33C6VDIUJSLV4G5YYEAVB5JWNGW 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 04/14] mouse: Add method to show/hide the system pointer 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 new set_ptr_visible() method to the mouse uclass to allow hiding and showing the system mouse pointer. This is useful with sandbox when rendering a custom mouse pointer, such as in expo mode. The method is optional and returns -ENOSYS if not supported by the driver. Co-developed-by: Claude Signed-off-by: Simon Glass --- drivers/input/mouse-uclass.c | 10 ++++++++++ include/mouse.h | 24 ++++++++++++++++++++++++ 2 files changed, 34 insertions(+) diff --git a/drivers/input/mouse-uclass.c b/drivers/input/mouse-uclass.c index ee983397ef3..efb52d3377b 100644 --- a/drivers/input/mouse-uclass.c +++ b/drivers/input/mouse-uclass.c @@ -83,6 +83,16 @@ int mouse_get_pos(struct udevice *dev, struct vid_pos *pos) return 0; } +int mouse_set_ptr_visible(struct udevice *dev, bool visible) +{ + struct mouse_ops *ops = mouse_get_ops(dev); + + if (!ops->set_ptr_visible) + return -ENOSYS; + + return ops->set_ptr_visible(dev, visible); +} + UCLASS_DRIVER(mouse) = { .id = UCLASS_MOUSE, .name = "mouse", diff --git a/include/mouse.h b/include/mouse.h index 8212a1e89d4..98f54f73d88 100644 --- a/include/mouse.h +++ b/include/mouse.h @@ -99,6 +99,18 @@ struct mouse_ops { * supported */ int (*get_event)(struct udevice *dev, struct mouse_event *event); + + /** + * set_ptr_visible() - Show or hide the system mouse pointer + * + * This is used to hide the system pointer when expo is rendering its + * own custom mouse pointer. + * + * @dev: Mouse device + * @visible: true to show the pointer, false to hide it + * Returns: 0 if OK, -ENOSYS if not supported + */ + int (*set_ptr_visible)(struct udevice *dev, bool visible); }; #define mouse_get_ops(dev) ((struct mouse_ops *)(dev)->driver->ops) @@ -135,4 +147,16 @@ int mouse_get_click(struct udevice *dev, struct vid_pos *pos); */ int mouse_get_pos(struct udevice *dev, struct vid_pos *pos); +/** + * mouse_set_ptr_visible() - Show or hide the system mouse pointer + * + * This is used to hide the system pointer when rendering a custom mouse + * pointer (e.g., in expo mode). + * + * @dev: Mouse device + * @visible: true to show the pointer, false to hide it + * Returns: 0 if OK, -ENOSYS if not supported + */ +int mouse_set_ptr_visible(struct udevice *dev, bool visible); + #endif From patchwork Mon Oct 6 20:58:39 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 522 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=1759784378; bh=jcwmBGn30nq38qtA/mKxCw5EJPDbOb8G6apAuvNMBog=; 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=Gtc9Rq1v923mXQZKDAQpqhXZI+dYNXxnjf/ePs8nPcE4aMgvsfl8t6bzHlv6x93CN vpm6BNviABKpOLrksZTzKPnLzei1gBdx0H5Nn0TWZ0vIQzHdtNAo42aIHX44A7Bm5D k4YW3wEXoKZ/O7buv14vLNg03gv1K8b/eNHtbx0YQxwyJu4oubwsmGm1qCqSDbcU9P nObNx3Vt02oLbIUipXYHezGJ7wPeOsOIMVKPLZeFpRW2tXINkli0wYcAeHoOx+y+jS pgW56/vD+RWHnZ93jVGbv35U8NkWMfG4i/+4G/cvYE/lAEvgV80HMK8Igqerna426N /Q8yZWSSLedXA== Received: from localhost (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id 43BCF67F55 for ; Mon, 6 Oct 2025 14:59:38 -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 7d-TVo8U2VER for ; Mon, 6 Oct 2025 14:59:38 -0600 (MDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1759784376; bh=jcwmBGn30nq38qtA/mKxCw5EJPDbOb8G6apAuvNMBog=; 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=QqIdICi/HLWT2chz8M3reIpLy8/8aS8pwv2mncTfI59BHaagaX/sjeMBsxA6MaRY/ kEj9UXhMKIHRAzYbNZG7lCrymiDgBjpNAKW0RF8XSnBXr6EWC0IPa5OAHR9JybFXYK P5MwXyhrqN7S67kKekA/pKTHfSlTvi5R5nbVqYIUVo3sHof/K0BJpqsjVaA+GdpJUj KVUpKbbXCO5a+OxrwXBlGfSxjanKoyPka29/c4XebngWzgmDnMM/Rpp6j+WWwMNqfN CODoaa+BkfcjP1ba7tV6Szq4yo7Hj3F4/mATKY4cTlLZG9MKS4ROiiSuebN3Gl2T9P aV2bUwTaEfXbg== Received: from mail.u-boot.org (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id 3AE9067F03 for ; Mon, 6 Oct 2025 14:59:36 -0600 (MDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1759784373; bh=pIz0izu0ZAqYCtradf2djE0SAEMVei1i28N4YqVGve0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=skLFwUPsyTnVyNxIBHmyxjCrkqXwFAa3SNNOm6/MKhjycb4ZtSeti9YTcPqj/JK22 qZW1xSLLBiavu/UPdViTiHi1g9jgh566IXx++EJHfu/fNkBqUx+cA4b1iI3NH4eoHn tNagp/jVi3MMKV7jigzogGNNH49ztfpRRdhmmmUK7mi0mWHOrq9XoWkHKgjce0aghK MjLxrBeWDQcnoYg9sxzDiANOPDXaQNsYTkm6GjbQMJC+J1Wufmv0d31a+pMEKOad2Q mVHuluwD966Q/kLmhryV19ESimjblFg1r5S+wt349CSaNUhnAs1306Tgmi7gO2Mp2r 8B43Wo1cAY0Dg== Received: from localhost (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id 5534E67EE4; Mon, 6 Oct 2025 14:59:33 -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 ZR1OU7yyIF5u; Mon, 6 Oct 2025 14:59:33 -0600 (MDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1759784369; bh=KvF7jLQZcj1xEnlMzDXPOVTCJMJ1H+Mos02U7rBL3ZU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=M/LeSh8eFRyi0/ncyDJvwtu21odWRROJwjbDc85ajPUmWMVKbTwOQwxFtyGcrD/JE X4mdtj2A2yVTgkx1etOUxIj2O4+ozy812IkX5KS81e4I+5qHdCL0k2MGfgaVGDmJR5 leWSte6U64ytyjEAR+Y91++xrGkbuIkFojGfsKS9xjkAfL9wPYEzoJhLqHkszApepQ u9oY81TB2HhvapY7hWp7HKU7vDVLyJzHCuLf++omDahdrPm61X5FW9BpGzfXjoDUyA F8GSNed9GMy5JhUHe0N3Z1oDj8vfGFay7UbeGoKCoN3VCeLr4gofwTmSudDQr2evZm bgh89mxPnvXDw== Received: from u-boot.org (unknown [73.34.74.121]) by mail.u-boot.org (Postfix) with ESMTPSA id 95F1767FCB; Mon, 6 Oct 2025 14:59:29 -0600 (MDT) From: Simon Glass To: U-Boot Concept Date: Mon, 6 Oct 2025 14:58:39 -0600 Message-ID: <20251006205856.2009292-6-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: LK4SOPA6VTJ73W6CMWSLSLGVR266KABA X-Message-ID-Hash: LK4SOPA6VTJ73W6CMWSLSLGVR266KABA 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 05/14] mouse: Add support for scaling of video-device coordinates 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 mouse_set_video() function to set up the video device associated with the mouse. This allows mouse drivers to scale coordinates to match the display resolution. The video device information is stored in mouse_uc_priv rather than being driver-specific, providing a common place for all mouse drivers to access display dimensions for coordinate scaling. Update expo_set_mouse_enable() to call mouse_set_video() to configure the mouse with the display device. Co-developed-by: Claude Signed-off-by: Simon Glass --- boot/expo.c | 5 +++++ drivers/input/mouse-uclass.c | 17 +++++++++++++++++ include/mouse.h | 18 ++++++++++++++++++ 3 files changed, 40 insertions(+) diff --git a/boot/expo.c b/boot/expo.c index 8ec301d4dcf..99b9ad4d52b 100644 --- a/boot/expo.c +++ b/boot/expo.c @@ -178,6 +178,11 @@ int expo_set_mouse_enable(struct expo *exp, bool enable) if (ret) return log_msg_ret("sme", ret); + /* Tell the mouse driver about the video device for coordinate scaling */ + ret = mouse_set_video(exp->mouse, exp->display); + if (ret) + return log_msg_ret("msv", ret); + /* Get mouse pointer image and dimensions */ exp->mouse_ptr = video_image_getptr(riscos_arrow); if (exp->mouse_ptr) { diff --git a/drivers/input/mouse-uclass.c b/drivers/input/mouse-uclass.c index efb52d3377b..4ade394d68a 100644 --- a/drivers/input/mouse-uclass.c +++ b/drivers/input/mouse-uclass.c @@ -7,6 +7,7 @@ #include #include #include +#include int mouse_get_event(struct udevice *dev, struct mouse_event *evt) { @@ -93,6 +94,22 @@ int mouse_set_ptr_visible(struct udevice *dev, bool visible) return ops->set_ptr_visible(dev, visible); } +int mouse_set_video(struct udevice *dev, struct udevice *video_dev) +{ + struct mouse_uc_priv *uc_priv = dev_get_uclass_priv(dev); + + uc_priv->video_dev = video_dev; + if (video_dev) { + uc_priv->video_width = video_get_xsize(video_dev); + uc_priv->video_height = video_get_ysize(video_dev); + } else { + uc_priv->video_width = 0; + uc_priv->video_height = 0; + } + + return 0; +} + UCLASS_DRIVER(mouse) = { .id = UCLASS_MOUSE, .name = "mouse", diff --git a/include/mouse.h b/include/mouse.h index 98f54f73d88..560c7d14587 100644 --- a/include/mouse.h +++ b/include/mouse.h @@ -38,11 +38,17 @@ enum mouse_press_state_t { * @left_button_state: Current state of left button (BUTTON_PRESSED/BUTTON_RELEASED) * @click_pos: Position where the click occurred * @last_pos: Last position received from mouse + * @video_dev: Video device for coordinate scaling + * @video_width: Width of video display + * @video_height: Height of video display */ struct mouse_uc_priv { enum mouse_press_state_t left_button_state; struct vid_pos click_pos; struct vid_pos last_pos; + struct udevice *video_dev; + int video_width; + int video_height; }; /** @@ -159,4 +165,16 @@ int mouse_get_pos(struct udevice *dev, struct vid_pos *pos); */ int mouse_set_ptr_visible(struct udevice *dev, bool visible); +/** + * mouse_set_video() - Set the video device for coordinate scaling + * + * Sets up the video device in the mouse uclass private data so mouse drivers + * can scale coordinates to match the display resolution. + * + * @dev: Mouse device + * @video_dev: Video device + * Returns: 0 if OK, -ve on error + */ +int mouse_set_video(struct udevice *dev, struct udevice *video_dev); + #endif From patchwork Mon Oct 6 20:58:40 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 523 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=1759784378; bh=cAnVQTKUYdU8D+CFC2lHM7xleZgxd8D8nAO8vpwAbJo=; 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=Bj7YC7VcWYIOUida1gngynXYsuq5A1QfPgfS3gU+l5IH/7rdmmbisgW0y3KIYk6ma 8H+rSCY81C1G35c6BQnZslPgUr9FZhzw7Y0N49MvwFHyLdvbTTWPxB8vZXdmCGT7vY Og5pSu9OA5GB1HvCouYJ2DUoZPwltj2Rst7FO9wuPHxxyuFCGJ378pdulw1tmIlCQx VpsMKa0QoP4xL6XPWf1CG0y/qOCCdy89AyPeGgdq/Xq5UYpadr5B1Fswp6OKXncoHU 3vaRkV3v9Ys2AVAKxHoNFIKqW4QJoJAGP2qAYfY1/2B+mSPY/C9/OhiuTiIs7ktK+d JbhwbhBUe0mVQ== Received: from localhost (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id AE06A67FA7 for ; Mon, 6 Oct 2025 14:59:38 -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 zh4camk0bhP4 for ; Mon, 6 Oct 2025 14:59:38 -0600 (MDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1759784376; bh=cAnVQTKUYdU8D+CFC2lHM7xleZgxd8D8nAO8vpwAbJo=; 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=J6tXUKi+C7Gx4V7al+ntWkMX1tXshBXdVZ2/s1Ph5j56NWp8O2xJ1K3WsLYKTvp/e bRkvCW8QBQ2D+H1BeQMqHxL9l36UJPyROVFvZHJ3CkkVVCd2rBx8CkgKosI/KxFVdd cAczWS9JEJFh/Fn2axVpGGURc38NhllnvENK6484yS709CxmA5D6Dod4EcvUjDgd45 ll8NcD2vTGPqs9CkK729CYuf0SAcqeQD9HA3a7m+eIjghgF90yDeaIBt1DAl8CTOSK f3QXvH3txX3RXbRGmcytRqRcrS0xrwNg6OM3QM5+dzB7jcbp7TfdFCNe6wTJZqT7jU 0gHvcqmXPFAzw== Received: from mail.u-boot.org (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id E877B67FCD for ; Mon, 6 Oct 2025 14:59:36 -0600 (MDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1759784374; bh=B4P9NfIJzzbmR27Mi+gKVKemCMHgoj59s0C08xsB1f0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=VYY+PpT7sTCvbP/fQpc4YTq0psIIW6KCZk2zMtsrqwL57q8c4ENljIEqW3eOPn12Z eDpW/tLXzLGalb7rxTg8p1BTCclyKZFPy6KWgGdoZIaP4N5i3miaGD7OqSk+l0cB8i rgRELdwVCvjvqojZ2fSvOAzhxCoQ5nIOm7gPKjGoa1oxfSYLhMc5YkYvRTVgSrhkv3 h/i92TSOYn3C3spl1hiU3q9RhTJJf4VV4e0/foBiWBHLYJQNI2ZKuaZGs6l16h9RhV tlCXmCb/ZkEg+hnSb6IiAY9EMPypRZ3F/jp/o/4uqQNRLopZ+xo7asVoJzR4OCzEOs 5xBSwu0esSlkQ== Received: from localhost (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id C66A767F52; Mon, 6 Oct 2025 14:59:34 -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 PsJhG438bKS2; Mon, 6 Oct 2025 14:59:34 -0600 (MDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1759784370; bh=a+7/+eYb+Kf3VCjW0/XllD6/ZpfgEFsfxftaB/GtGog=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=SiU8WQGKP+Jtngt20/6TBiTmouc7h1ZBZ81yV8/CgjTKIKyumPW74EzWx7u6fJgLP dRs3njB76Wptc7OExxDcSgV2K4ft3CzH9yjfxvKjrLVvcVi5LhUxqCSTWLFWMLzHXZ QEGg2qsvZXk2QoXErcj+LNOwyUCkNe1RPlQtbgVgXAowKlSpkG0y4xu268HT6fuTci ejhyPAZ47MBbct6cT09U7NwIAu4nFG0J95RlT79B99beGRtgWX/RCS/j4cr3K4YvYr VsTT6LHsPZrYLYDlcLM8P+vhMZFbQ99ILWDTHIdw52OWgMcsaln3L1YdPUESJXL/0u 5iw0Mf9VN/hkg== Received: from u-boot.org (unknown [73.34.74.121]) by mail.u-boot.org (Postfix) with ESMTPSA id 7D67767F84; Mon, 6 Oct 2025 14:59:30 -0600 (MDT) From: Simon Glass To: U-Boot Concept Date: Mon, 6 Oct 2025 14:58:40 -0600 Message-ID: <20251006205856.2009292-7-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: OBZQSAT6DE44A5ACRQ524P3N4HJE6TGT X-Message-ID-Hash: OBZQSAT6DE44A5ACRQ524P3N4HJE6TGT 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 06/14] sandbox: mouse: Implement set_ptr_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 Implement this new method using the SDL layer. Signed-off-by: Simon Glass --- arch/sandbox/cpu/sdl.c | 5 +++++ arch/sandbox/include/asm/sdl.h | 11 +++++++++++ drivers/input/sandbox_mouse.c | 8 ++++++++ 3 files changed, 24 insertions(+) diff --git a/arch/sandbox/cpu/sdl.c b/arch/sandbox/cpu/sdl.c index 65d55b0085d..c3745fa660e 100644 --- a/arch/sandbox/cpu/sdl.c +++ b/arch/sandbox/cpu/sdl.c @@ -646,3 +646,8 @@ int sandbox_sdl_sound_stop(void) return 0; } + +void sandbox_sdl_set_cursor_visible(bool visible) +{ + SDL_ShowCursor(visible ? SDL_ENABLE : SDL_DISABLE); +} diff --git a/arch/sandbox/include/asm/sdl.h b/arch/sandbox/include/asm/sdl.h index b97773c8a4f..a80db51ad19 100644 --- a/arch/sandbox/include/asm/sdl.h +++ b/arch/sandbox/include/asm/sdl.h @@ -119,6 +119,13 @@ int sandbox_sdl_set_bpp(struct udevice *dev, enum video_log2_bpp l2bpp); */ int sandbox_sdl_get_mouse_event(struct mouse_event *evt); +/** + * sandbox_sdl_set_cursor_visible() - Show or hide the SDL cursor + * + * @visible: true to show the cursor, false to hide it + */ +void sandbox_sdl_set_cursor_visible(bool visible); + #else static inline int sandbox_sdl_init_display(int width, int height, int log2_bpp, bool double_size) @@ -178,6 +185,10 @@ static inline int sandbox_sdl_get_mouse_event(struct mouse_event *evt) return -ENODEV; } +static inline void sandbox_sdl_set_cursor_visible(bool visible) +{ +} + #endif #endif diff --git a/drivers/input/sandbox_mouse.c b/drivers/input/sandbox_mouse.c index ba271242b1a..add7401c4ec 100644 --- a/drivers/input/sandbox_mouse.c +++ b/drivers/input/sandbox_mouse.c @@ -36,8 +36,16 @@ static int mouse_sandbox_get_event(struct udevice *dev, return ret; } +static int mouse_sandbox_set_ptr_visible(struct udevice *dev, bool visible) +{ + sandbox_sdl_set_cursor_visible(visible); + + return 0; +} + const struct mouse_ops mouse_sandbox_ops = { .get_event = mouse_sandbox_get_event, + .set_ptr_visible = mouse_sandbox_set_ptr_visible, }; static const struct udevice_id mouse_sandbox_ids[] = { From patchwork Mon Oct 6 20:58:41 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 524 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=1759784382; bh=mCFblMxlSahL0hQDls2sHf5PToXGif06GZ2POA2ic8A=; 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=MuVlL12rQxXir+/7LW5xacp21oTlpfJ7RO+JqQBmUOoyfDPrD5hArxJ/01uYDKmND 8oZwgo2ioq8bErGhw2cpIgDX6tKcJP3JeiVShHZOqRPnVdqRAoGL0Q4Q71aLPqZbrg zSWxB85hL+HN+j1hdShBpUzBZe4ZLVoVBZGK1+Vlfq6FWeXjxnfTXCpsf8cp0ki7EA EIo1ovJz6gSJq9TGZffeQpuSivQhNnB9mLnTGo11z/MdO8BqvuBTMejtklSvqANRd/ 08YcLigtwtxvGSkJmWtw/GpLGxbXUETnjDq5F6NaJ8eVRg9Kia/cA0oKRgP+GkGVdc Jpdw0/LrchwrQ== Received: from localhost (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id 9C12B67FA7 for ; Mon, 6 Oct 2025 14:59:42 -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 Yy9j1WOultSf for ; Mon, 6 Oct 2025 14:59:42 -0600 (MDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1759784382; bh=mCFblMxlSahL0hQDls2sHf5PToXGif06GZ2POA2ic8A=; 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=MuVlL12rQxXir+/7LW5xacp21oTlpfJ7RO+JqQBmUOoyfDPrD5hArxJ/01uYDKmND 8oZwgo2ioq8bErGhw2cpIgDX6tKcJP3JeiVShHZOqRPnVdqRAoGL0Q4Q71aLPqZbrg zSWxB85hL+HN+j1hdShBpUzBZe4ZLVoVBZGK1+Vlfq6FWeXjxnfTXCpsf8cp0ki7EA EIo1ovJz6gSJq9TGZffeQpuSivQhNnB9mLnTGo11z/MdO8BqvuBTMejtklSvqANRd/ 08YcLigtwtxvGSkJmWtw/GpLGxbXUETnjDq5F6NaJ8eVRg9Kia/cA0oKRgP+GkGVdc Jpdw0/LrchwrQ== Received: from mail.u-boot.org (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id 8365167F8D for ; Mon, 6 Oct 2025 14:59:42 -0600 (MDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1759784381; bh=Z6SByUSFF+XksMzRhBYG/PsyiyYByPcSyKVfJj81oXI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=g0LVGVNsDBt+I7yEMbuSOF56Fg5RK/VjDg15O4Sdt7kwdIC7wPdD1HSnSfRHBLq8C F1upwfh0Y2XYRitBfghW742snRvz8b6lH2VSVY80qOU4Th7lAV1C19fTyMxtKtImuf nZP5WQggY2CItX2FSAAH5CY3GLOTzcoE/l1aR3PRsqL84A1b2QrWfhUGKj33rqCEiV 2O7zXJ0E9A3re4svdxCy/F4tzSMDhJJVtygmAqOvFK2ac11jyMrpiUeUUY+Vlb5E21 yE9CU6HheaaMoHD3xxSf3lCIUBckcTfFPopn7rVWq8+YGdMZoP0HCwkmuGKz3J9mhT zgtfJTZMn0PEg== Received: from localhost (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id 46E0167F03; 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 ROp8JD1y760N; 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=1759784375; bh=fPeaWo9JQ8FBTESOGfgivSBw2kW2CzniNm2788Z3vWw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=k1FgXnK3sgK3GIO8Lp+/dCRDMe8pW4G26311c+cOUU0Y6GyV0rOJcFIW3MBJIDks5 hqi9klFU5V1wkXOLiYD7iNRIdjKDuixTcupXQ176cS4dCVTAJjntCsJ/40f30XsEHk JQOduvQ+MwO/+2JDh9bLBrPuVYpFzESlhLlld0NsoDtRnkOSO6Su1TuqA/OKXIQ9g5 e6GR2c6Mi51GbTNhybGw0lZN6wRsIh7+Opby0BkzZqAd21JAweRlKH+BP0K6GnEZfV XfymwJhbSGSJ54XrTdQJP57S/1J+VUjfwzL7gvjGOqbMmU2yPLu/n7UgkbrXaUAarz CqU6acRb61JLw== Received: from u-boot.org (unknown [73.34.74.121]) by mail.u-boot.org (Postfix) with ESMTPSA id 18D9167EE4; Mon, 6 Oct 2025 14:59:35 -0600 (MDT) From: Simon Glass To: U-Boot Concept Date: Mon, 6 Oct 2025 14:58:41 -0600 Message-ID: <20251006205856.2009292-8-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: ZO3I4DEQ675T7FSUNQQJFPXNSMDENLAV X-Message-ID-Hash: ZO3I4DEQ675T7FSUNQQJFPXNSMDENLAV 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 07/14] sandbox: mouse: Add test for pointer visibility 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 for the mouse set_ptr_visible() method. This uses a back-door function to read the visibility state from the sandbox mouse driver. Also add documentation for struct sandbox_mouse_priv. Co-developed-by: Claude Signed-off-by: Simon Glass --- arch/sandbox/include/asm/test.h | 8 ++++++++ drivers/input/sandbox_mouse.c | 25 +++++++++++++++++++++++++ test/dm/mouse.c | 22 ++++++++++++++++++++++ 3 files changed, 55 insertions(+) diff --git a/arch/sandbox/include/asm/test.h b/arch/sandbox/include/asm/test.h index 499db42804c..ba8f269d86f 100644 --- a/arch/sandbox/include/asm/test.h +++ b/arch/sandbox/include/asm/test.h @@ -378,4 +378,12 @@ void sandbox_mouse_set_test_mode(struct udevice *dev, bool test_mode); */ void sandbox_mouse_inject(struct udevice *dev, struct mouse_event *event); +/** + * sandbox_mouse_get_ptr_visible() - Get pointer visibility state + * + * @dev: Mouse device + * Return: true if pointer is visible, false if hidden + */ +bool sandbox_mouse_get_ptr_visible(struct udevice *dev); + #endif diff --git a/drivers/input/sandbox_mouse.c b/drivers/input/sandbox_mouse.c index add7401c4ec..faebb09ba3c 100644 --- a/drivers/input/sandbox_mouse.c +++ b/drivers/input/sandbox_mouse.c @@ -8,10 +8,19 @@ #include #include +/** + * struct sandbox_mouse_priv - Private data for sandbox mouse driver + * + * @test_mode: true to use test mode (inject events), false to use SDL + * @test_event: Event to return when in test mode + * @test_event_pending: true if test_event is pending + * @ptr_visible: Current visibility state of mouse pointer + */ struct sandbox_mouse_priv { bool test_mode; struct mouse_event test_event; bool test_event_pending; + bool ptr_visible; }; static int mouse_sandbox_get_event(struct udevice *dev, @@ -38,6 +47,9 @@ static int mouse_sandbox_get_event(struct udevice *dev, static int mouse_sandbox_set_ptr_visible(struct udevice *dev, bool visible) { + struct sandbox_mouse_priv *priv = dev_get_priv(dev); + + priv->ptr_visible = visible; sandbox_sdl_set_cursor_visible(visible); return 0; @@ -83,6 +95,19 @@ void sandbox_mouse_inject(struct udevice *dev, struct mouse_event *event) } } +/** + * sandbox_mouse_get_ptr_visible() - Get pointer visibility state + * + * @dev: Mouse device + * Return: true if pointer is visible, false if hidden + */ +bool sandbox_mouse_get_ptr_visible(struct udevice *dev) +{ + struct sandbox_mouse_priv *priv = dev_get_priv(dev); + + return priv->ptr_visible; +} + U_BOOT_DRIVER(mouse_sandbox) = { .name = "mouse_sandbox", .id = UCLASS_MOUSE, diff --git a/test/dm/mouse.c b/test/dm/mouse.c index 3efff4a0d7d..c22cd026cb2 100644 --- a/test/dm/mouse.c +++ b/test/dm/mouse.c @@ -214,3 +214,25 @@ static int dm_test_mouse_right_button(struct unit_test_state *uts) return 0; } DM_TEST(dm_test_mouse_right_button, UTF_SCAN_PDATA | UTF_SCAN_FDT); + +static int dm_test_mouse_ptr_visible(struct unit_test_state *uts) +{ + struct udevice *dev; + + ut_assertok(uclass_first_device_err(UCLASS_MOUSE, &dev)); + + /* test hiding the pointer */ + ut_assertok(mouse_set_ptr_visible(dev, false)); + ut_asserteq(false, sandbox_mouse_get_ptr_visible(dev)); + + /* test showing the pointer */ + ut_assertok(mouse_set_ptr_visible(dev, true)); + ut_asserteq(true, sandbox_mouse_get_ptr_visible(dev)); + + /* test hiding again */ + ut_assertok(mouse_set_ptr_visible(dev, false)); + ut_asserteq(false, sandbox_mouse_get_ptr_visible(dev)); + + return 0; +} +DM_TEST(dm_test_mouse_ptr_visible, UTF_SCAN_PDATA | UTF_SCAN_FDT); From patchwork Mon Oct 6 20:58:42 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 525 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=8RIObcmfU7nRJo5ipfOao9h7rTHIC8+utzvdGuAN0eY=; 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=dRsyCPNKxPtpg2d5RW0CrZ45wvymT0QrSBiPQS082faWQAkMsIe+rN/s6Pzc7Hzby p1J/zMmhWtW18p/iM0HW4ps4jSGmXbatmnRNcmIsh+KzaV0n2Iebs3Vpk0PzrK/49E hDiMvBkNY2pWx0MbXckv9iKzoOXqsQEQnJNSL7XGQX205XTAbrTrVE6tB589WxdI8R BqctJZ4vNc/5ZnUbrnruzDUvdem8+Crk5wCG32O3jSpTx6yXCB3fZaakqoOIXsRZ/i 4R3Bt9P4b9h0+0z7qWHfMjoi8ux1qlXcVmV1URMhc+3xr+Z8GUUGBHTh3EdgOMChsx T6J3LhZCifzAw== Received: from localhost (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id 7E3EC67FA7 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 ZnqqQpiplSlg 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=1759784383; bh=8RIObcmfU7nRJo5ipfOao9h7rTHIC8+utzvdGuAN0eY=; 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=YtTOK1MXNVsKHoX25hG//xwLGcrftJwbtSWv8aMi6DVi/3fK4Y1ecQ2mMhjHKetrf QJZt/CPz5jW6D/UDcueuG1V7PcrGh4zq2EKnSlQM1oaX5nNXeMBG7lsRMyBS0bKT9t l4lKFNbRnRkycsAHE4ax72aM8h83LPYKZBUYjjr+BUWsUgypBQrQ4ttEnT5eOnlv/A 7j8A/NjzePOJg7/swDFQaP9WtcRNzp3vY5Tn2oTk1XHuTCtU52ZNjRI62zc4nmiKhN MuWRmp0fVTiiFnVwKfZwzOKNhv+LwrAeuqboJ261bjgzU8kEQic2AMKYlQI05IJmMt jfJYQVO+NFE2w== Received: from mail.u-boot.org (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id C8C0767EE4 for ; Mon, 6 Oct 2025 14:59:43 -0600 (MDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1759784381; bh=gNg3wzy+MB5xvapWsKBwXOyFzcKgFbU5t76LW2Tisv8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=WTBWXfyOih4lagEpQRpWERf6U2aGh6zznlqesRuSG1pJ5bHDmQFo5M3vNWfToBAYi //g+kqVWBytl5mKo54hhP79t30ThgPZfgB3HebTsDHGLP9pAIAbkAmBFXEt2KDd/rY F5c2spge3J0hXzQmHeCBi+k8G2HDjlRW5TBUCmWC7qFJvmUJ90UN57GWEYlODgQdXw QEEIwjjsgM6nInrqkwgxM8GXzeCCNDRF3+LKuZPP4b/dDsk6GXgbu3PCyOihLt6qMd Dn+Ff7CgVkoiFMcMJSlD0SECvygJeAVSJfAwFjy01QCZpYusT/LVqT7Pt9oqqm9mCj hpoIIFNi2j+QQ== Received: from localhost (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id 46E3267F10; 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 0X5Il0vO83ug; 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=1759784377; bh=Yj+Px4RJ5F14FQmokYGzyS++/ViPUPz1zzDVaHcDeaI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=AanYKHA4OiVV2wpkw10UMr/9hqVd9V32oTFjesEYWuBUHqpP99OYTPabFX7ndCNw8 Fs2U6QoKwjUyqcVQ6bD1djESADetqFjrNcWCR7JX+hIzuIYQMAEfnJCQNx8qqVoLbe AzqqJIFErBkPMyviIj/Swf+TBxqQNtBddmwZqku571Oy1VW1dZxSsfb0PKs4N1X/Jh +xU5PCadxkNt+5dApQCKw/tbDJIeKORXI/FU2BbptvScTsixYhon7Wuta5tbdfAABd Xq1L5oscBTqNMbY4eDUzdm6fGM18Qi5wTsGDN5+Bxs5X9NzCuBZg5dY1Ij/+xYdUeT ORfj6wXzqU5cA== Received: from u-boot.org (unknown [73.34.74.121]) by mail.u-boot.org (Postfix) with ESMTPSA id 1D3C267FD0; Mon, 6 Oct 2025 14:59:37 -0600 (MDT) From: Simon Glass To: U-Boot Concept Date: Mon, 6 Oct 2025 14:58:42 -0600 Message-ID: <20251006205856.2009292-9-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: NJ4BFEBDU663RISGXYTJ7XLHGDCJHEZK X-Message-ID-Hash: NJ4BFEBDU663RISGXYTJ7XLHGDCJHEZK 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 08/14] expo: Hide system pointer when entering expo 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 When entering expo mode, hide the system mouse pointer so that only the custom expo pointer is visible. Restore it when exiting expo mode. This uses the new set_ptr_visible() method if a mouse is enabled. Co-developed-by: Claude Signed-off-by: Simon Glass --- boot/expo.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/boot/expo.c b/boot/expo.c index 99b9ad4d52b..afb09aaf5b5 100644 --- a/boot/expo.c +++ b/boot/expo.c @@ -545,11 +545,15 @@ void expo_req_size(struct expo *exp, int width, int height) void expo_enter_mode(struct expo *exp) { video_manual_sync(exp->display, true); + if (IS_ENABLED(CONFIG_MOUSE) && exp->mouse_enabled) + mouse_set_ptr_visible(exp->mouse, false); } void expo_exit_mode(struct expo *exp) { video_manual_sync(exp->display, false); + if (IS_ENABLED(CONFIG_MOUSE) && exp->mouse_enabled) + mouse_set_ptr_visible(exp->mouse, true); } void expo_damage_reset(struct expo *exp) 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 */ From patchwork Mon Oct 6 20:58:44 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 527 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=1759784388; bh=2YU5d8+c+7ClNa//uaYBBx7O6UkScx7S5kNrCapakMA=; 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=AxNtfOjqSF+GpSCGA3iX6K0rKNjHMxm8nLWDiuYEKslGHIqAwOacaDVrlO+wiNODP sgEC59LaoKqmwB3e1myzDl+FFCgPQFSMShqgVpZcjAKPAk6qb3NLhbhXTfdCVKQPGZ g7Y0z59BE5FJp/0WvZ6AiRc6gTGSse+xpZ4pNfStLlmsSEnaPxyICrU+1nrvTexKQr RF8xpX0F+iJtZC/0W8UaPh4tbmHzSEDTfKmBKuih12h1c5iBtGNESMd8YJ5xO1meLF MwLPgwFhf3M6wD/wxduote5RQs29Yf7eQdVH5OBb84BefkxmThvSB6/55cTNNjts26 pSBsHLtuLT6Sg== Received: from localhost (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id 3270E67FCB for ; Mon, 6 Oct 2025 14:59: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 10024) with ESMTP id GeJZNSHeVpue for ; Mon, 6 Oct 2025 14:59:48 -0600 (MDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1759784387; bh=2YU5d8+c+7ClNa//uaYBBx7O6UkScx7S5kNrCapakMA=; 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=DHXfmbLoyP8iobGm5lUYsY1echSE/OaPDbyIuyDuZY8i2iHvayAMRc9bE8dlqL09s A1sjJiAfvvLiTM+EMA4Z38tQgMdvTMxVRqG6ojzc3cMxyreJ3wFKD8yAxeh3KN6UWq +3OHxOXuTSP2iUowCZD5u7OE1BINgWeuOpx0JDKAbQ3oSM0iG9+tKBGddeIzBd84Y6 IDfXm04iYY9ETcGLSaDzcr6HiAYCn7phabPxCcDUpj9oQrPjBj1nAPcQZUOR2eBVKI E+dOsOsdaVrMPbx6Uw5W8uatMMm3Um66ICLJ1lwFeWXAIpQe2M2KyoCoeKaPlcz+8m +5lkFLuBd1taw== Received: from mail.u-boot.org (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id 1B6E867F03 for ; Mon, 6 Oct 2025 14:59:47 -0600 (MDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1759784385; bh=PPoWqyxPGl0z2JtMTKMsIYJThmIlb+NpkbFckDo39T0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=snKjcBX2W9bXGJuN0oVY4/ZcUTpdU5sC8gpTmfZ2uSyiGWqdrUtuNdOGi50K7d9Wf q5ze4nzYm9ogZ3g4NqSl+GCQjPJy/Bm6FYchdwG4+TWmfvUmj3gA/X80bNG9UzrFUq /EmQq425UIXnl6gS7e5etOCRMxeuzK3UVGjce0gNTAxDG79NZB9FFgcW6/bzlE/F30 k5RaMQW5I2X5sLEXLIhWp1aFSqb2uk4zRWUh8Gnej5Pu3oVFkBbZDYTYMsAqRfyXaY tRyxukeV+DXBtvFKZMQlBNuF9PXdT9cx207vtS2eoiHDK1i6iixCCmZ+bXIz+uJk2T sn54z/Xyqx4CQ== Received: from localhost (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id 6CF0F67F8D; 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 10026) with ESMTP id N-KqOQNzwxqK; 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=1759784379; bh=b+AoF9BoIQTr8r50lOYzKva7L88JVCkV6DnbQsDHhao=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ifya17VAYcvUXoX0Pom2b5NM+JKpu8UCqL02A6RB5gN7izKBjQmwZ8sMKC/lU2F3I 41H4BYqIUOYxHRDphRtCo3VUmLtT0lJLZfIe8ooHYZH+5nYyBect7lsMAsugLRZvtn 9ZGdvDVJJQoVLcVa4zR8EEYIFed0K8aZnRTr5V5HUL4liEpOQ5dPbYqWDoVN9qcMxv EznRAAgVW4LrlT+vaCU0J5S93p25ijpzgHaOdhRZR5E8/SN6OQG3YSOlSCWX/Y892P 5axv78Snrom4z7MxXkEKIazAs9BtlO5RmfiZ3uTu19Is6px60VttRSqjjEsbbmf7wz NntyDYROS5RmQ== Received: from u-boot.org (unknown [73.34.74.121]) by mail.u-boot.org (Postfix) with ESMTPSA id EC2DF67F55; Mon, 6 Oct 2025 14:59:38 -0600 (MDT) From: Simon Glass To: U-Boot Concept Date: Mon, 6 Oct 2025 14:58:44 -0600 Message-ID: <20251006205856.2009292-11-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: JW3RBQAHOHN7JKXEPPB5462PFKP3BSVH X-Message-ID-Hash: JW3RBQAHOHN7JKXEPPB5462PFKP3BSVH 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 10/14] expo: Track the number of render calls 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 Keep track of the frame count, i.e. the number of times that expo_render() has been called since expo_enter_mode() was invoked. Allow test mode to be enabled (if compiled in) by setting the 'expotest' environment variable to 1. Co-developed-by: Claude Signed-off-by: Simon Glass --- boot/expo_test.c | 21 +++++++++++++++++++++ include/expo.h | 4 ++++ include/expo_test.h | 11 +++++++++++ 3 files changed, 36 insertions(+) diff --git a/boot/expo_test.c b/boot/expo_test.c index ecef8decc6e..269052a61cb 100644 --- a/boot/expo_test.c +++ b/boot/expo_test.c @@ -8,18 +8,39 @@ #define LOG_CATEGORY LOGC_EXPO +#include +#include #include #include +#include +#include int expo_test_init(struct expo *exp) { + struct expo_test_mode *test; + + test = calloc(1, sizeof(struct expo_test_mode)); + if (!test) + return log_msg_ret("test", -ENOMEM); + + test->enabled = env_get_yesno("expotest") == 1; + exp->test = test; + return 0; } void expo_test_uninit(struct expo *exp) { + free(exp->test); + exp->test = NULL; } void expo_test_update(struct expo *exp) { + struct expo_test_mode *test = exp->test; + + if (!test) + return; + + test->render_count++; } diff --git a/include/expo.h b/include/expo.h index 8ad7415b5a4..e9e71f4fe36 100644 --- a/include/expo.h +++ b/include/expo.h @@ -90,6 +90,8 @@ struct expo_action { }; }; +struct expo_test_mode; + /** * struct expo_theme - theme for the expo * @@ -139,6 +141,7 @@ struct expo_theme { * @priv: Private data for the controller * @done: Indicates that a cedit session is complete and the user has quit * @save: Indicates that cedit data should be saved, rather than discarded + * @test: Pointer to test mode information, NULL if not allocated * @theme: Information about fonts styles, etc. * @scene_head: List of scenes * @str_head: list of strings @@ -165,6 +168,7 @@ struct expo { void *priv; bool done; bool save; + struct expo_test_mode *test; struct expo_theme theme; struct list_head scene_head; struct list_head str_head; diff --git a/include/expo_test.h b/include/expo_test.h index e1918ddeff2..ee4ae4611f7 100644 --- a/include/expo_test.h +++ b/include/expo_test.h @@ -9,6 +9,17 @@ struct expo; +/** + * struct expo_test_mode - Test mode information for expo + * + * @enabled: true if test mode is enabled + * @render_count: Number of calls to expo_render() since expo_enter_mode() + */ +struct expo_test_mode { + bool enabled; + int render_count; +}; + #if CONFIG_IS_ENABLED(EXPO_TEST) /** From patchwork Mon Oct 6 20:58:45 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 528 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=1759784391; bh=di74Rw6lUSfTx3VWkiNG4UreHHfMPyjf7p+o2KQ+gio=; 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=ZOcFeNLCYy3gEXBO/yRo/w7pX9H7FPfBUWvbAOCIKsaZwIUfCuUeZnaX/0rTd1rZF kuj7+nIoYXrM/tm6TShRGFWZX4hM/pEvx1ZidLYN1N+VAWHoMpFBwwoR8fYpLGuftR WdLJQQSpV5FWrE0/OHZ0M9RwBIdR+a9emKI3YEVfoyGlLV7CwMLXeIT69dLd8eL0gK 2aihr7UALW9QTv9XpbV5Jc2gnyO2eH0KO5IzUR8SCRNHBZS0fsIwA+iCgBzFjZeERK xhpNXoorACaQ//e2YNA34SJKvPxEziV6/yb/xOHq/loB/l/iJtJgUd3mo9+c/G/C2E mJOjyc8y5bxyQ== Received: from localhost (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id A9D5267F57 for ; Mon, 6 Oct 2025 14:59: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 BQ1IUIfR3C52 for ; Mon, 6 Oct 2025 14:59:51 -0600 (MDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1759784391; bh=di74Rw6lUSfTx3VWkiNG4UreHHfMPyjf7p+o2KQ+gio=; 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=ZOcFeNLCYy3gEXBO/yRo/w7pX9H7FPfBUWvbAOCIKsaZwIUfCuUeZnaX/0rTd1rZF kuj7+nIoYXrM/tm6TShRGFWZX4hM/pEvx1ZidLYN1N+VAWHoMpFBwwoR8fYpLGuftR WdLJQQSpV5FWrE0/OHZ0M9RwBIdR+a9emKI3YEVfoyGlLV7CwMLXeIT69dLd8eL0gK 2aihr7UALW9QTv9XpbV5Jc2gnyO2eH0KO5IzUR8SCRNHBZS0fsIwA+iCgBzFjZeERK xhpNXoorACaQ//e2YNA34SJKvPxEziV6/yb/xOHq/loB/l/iJtJgUd3mo9+c/G/C2E mJOjyc8y5bxyQ== Received: from mail.u-boot.org (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id 99BED67F8E for ; Mon, 6 Oct 2025 14:59:51 -0600 (MDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1759784390; bh=PcHjshObj4y4cr60IJi/ucL+CUPpxhnENxTQTlxNvW8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=O2o0ky0EUHKjvVWu/FTV/oZv7RqGnNuVm1tgvDUttqRRHIozo5qfuueameUxxuXIq SWQowCZLYMdlOCDTqkf5lyzmG7qY7b4wdz4+gwLN5asdQf4bTHO5LSyhc02+7+0C+1 U7lDYHDsqilcf0N/RrRwc1R5rymU0uuW6ae6LlVJsS82/LrhOSs/j3+jlgg/qSqSg6 VrA0fVirBcuMUYgkzDeCG6xftVeV5levH33gd+wPDCU9qTlXBKlcS6qRx7IB0lWxDV kpwhF1pXINP4mAjttGMZbN/p7g/UWzmKkeO/leRzw2+ExIMUizZ3+HS+31fncjLRIV JdzJgpA2w++sQ== Received: from localhost (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id 91A3067EE4; Mon, 6 Oct 2025 14:59:50 -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 P-bNgeSKfCIG; Mon, 6 Oct 2025 14:59:50 -0600 (MDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1759784384; bh=K3O/+H0JsVwp5VZYK6i2Rezh8q0RMZgc4KToFIJb6+k=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=KvxY8dD3PiFEs5Zgc/XR/g+L17tSktJyQ6qvDbzbXMJEV3uM+//qTOChrZs21E6dp 2ZvFLcNU2aDBQ96kZc3KVHhNS9BLUJZYvP/QcA/DFEjXECJY7RJ6smV1ZFiqUand00 NIylPoO8bEimOpX+5Tes4omKpL77t9/CVSkAxJyzWbcQCNtis8O8SwiyE5lDzrAkJU X0bLCtgvxJRLuAtD2CTwT2y3bfx8rdi6+74CLgp7H+jWeQ4mkfzwMMnuiJoOAymEmm OrLaTRFd0HluOJfcY2FoG+0egHPMPE8qKxtwT8d9cohchFCoLZTzpEt3gO37rq0sSC 1fDIrv/oEcN/A== Received: from u-boot.org (unknown [73.34.74.121]) by mail.u-boot.org (Postfix) with ESMTPSA id 9FB3667F8E; Mon, 6 Oct 2025 14:59:43 -0600 (MDT) From: Simon Glass To: U-Boot Concept Date: Mon, 6 Oct 2025 14:58:45 -0600 Message-ID: <20251006205856.2009292-12-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: UQAQPDJP6TTOMYIACIT7MLDGLVAVS4IC X-Message-ID-Hash: UQAQPDJP6TTOMYIACIT7MLDGLVAVS4IC 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 11/14] expo: Add test mode to display frame count 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 When expo-test is enabled, show the frame count in the top right of the display. This allows an easy visual check that expo is working correctly, and provides an indication of performance. Add a test for this also. Co-developed-by: Claude Signed-off-by: Simon Glass --- boot/expo.c | 7 +++++ boot/expo_test.c | 47 +++++++++++++++++++++++++++++--- include/expo_test.h | 27 +++++++++++++++++++ test/boot/expo.c | 66 +++++++++++++++++++++++++++++++++++++++++++++ 4 files changed, 143 insertions(+), 4 deletions(-) diff --git a/boot/expo.c b/boot/expo.c index e7c4ab8d7db..2a75eed2c39 100644 --- a/boot/expo.c +++ b/boot/expo.c @@ -346,6 +346,11 @@ static int expo_render_(struct expo *exp, bool dirty_only) if (ret) return log_msg_ret("mou", ret); + /* Render test-mode info if enabled */ + ret = expo_test_render(exp); + if (ret) + return log_msg_ret("tst", ret); + video_sync(dev, true); return scn ? 0 : -ECHILD; @@ -558,6 +563,8 @@ void expo_enter_mode(struct expo *exp) video_manual_sync(exp->display, true); if (IS_ENABLED(CONFIG_MOUSE) && exp->mouse_enabled) mouse_set_ptr_visible(exp->mouse, false); + + expo_test_checkenv(exp); } void expo_exit_mode(struct expo *exp) diff --git a/boot/expo_test.c b/boot/expo_test.c index 269052a61cb..0ac2d0551a1 100644 --- a/boot/expo_test.c +++ b/boot/expo_test.c @@ -8,12 +8,15 @@ #define LOG_CATEGORY LOGC_EXPO +#include #include #include #include #include #include #include +#include +#include int expo_test_init(struct expo *exp) { @@ -23,8 +26,8 @@ int expo_test_init(struct expo *exp) if (!test) return log_msg_ret("test", -ENOMEM); - test->enabled = env_get_yesno("expotest") == 1; exp->test = test; + expo_test_checkenv(exp); return 0; } @@ -35,12 +38,48 @@ void expo_test_uninit(struct expo *exp) exp->test = NULL; } -void expo_test_update(struct expo *exp) +void expo_test_checkenv(struct expo *exp) { struct expo_test_mode *test = exp->test; - if (!test) - return; + test->enabled = env_get_yesno("expotest") == 1; + test->render_count = 0; +} + +void expo_test_update(struct expo *exp) +{ + struct expo_test_mode *test = exp->test; test->render_count++; } + +int expo_test_render(struct expo *exp) +{ + struct expo_test_mode *test = exp->test; + struct vidconsole_priv *cons_priv; + struct udevice *dev = exp->display; + struct video_priv *vid_priv; + char buf[30]; + int x, y; + int ret; + + if (!test->enabled) + return 0; + + /* Select 8x16 font for test display */ + ret = vidconsole_select_font(exp->cons, "8x16", 0); + if (ret && ret != -ENOSYS) + return log_msg_ret("font", ret); + + vid_priv = dev_get_uclass_priv(dev); + cons_priv = dev_get_uclass_priv(exp->cons); + + /* Display frame count */ + snprintf(buf, sizeof(buf), "frame %6d", test->render_count); + x = vid_priv->xsize - 18 * cons_priv->x_charsize; + y = 10; + vidconsole_set_cursor_pos(exp->cons, x, y); + vidconsole_put_string(exp->cons, buf); + + return 0; +} diff --git a/include/expo_test.h b/include/expo_test.h index ee4ae4611f7..88cec4a2a96 100644 --- a/include/expo_test.h +++ b/include/expo_test.h @@ -37,6 +37,16 @@ int expo_test_init(struct expo *exp); */ void expo_test_uninit(struct expo *exp); +/** + * expo_test_checkenv() - Check environment and reset test mode + * + * @exp: Expo to update test mode for + * + * Checks the expotest environment variable and updates the enabled flag + * accordingly. Also resets the render count to 0. + */ +void expo_test_checkenv(struct expo *exp); + /** * expo_test_update() - Update test mode counters * @@ -44,6 +54,14 @@ void expo_test_uninit(struct expo *exp); */ void expo_test_update(struct expo *exp); +/** + * expo_test_render() - Render test mode information + * + * @exp: Expo to render test info for + * Return: 0 if OK, -ve on error + */ +int expo_test_render(struct expo *exp); + #else static inline int expo_test_init(struct expo *exp) @@ -55,10 +73,19 @@ static inline void expo_test_uninit(struct expo *exp) { } +static inline void expo_test_checkenv(struct expo *exp) +{ +} + static inline void expo_test_update(struct expo *exp) { } +static inline int expo_test_render(struct expo *exp) +{ + return 0; +} + #endif /* EXPO_TEST */ #endif /* __EXPO_TEST_H */ diff --git a/test/boot/expo.c b/test/boot/expo.c index 7723a301c9f..a1aa543ab71 100644 --- a/test/boot/expo.c +++ b/test/boot/expo.c @@ -7,6 +7,7 @@ #include #include #include +#include #include #include #include @@ -1097,3 +1098,68 @@ static int expo_mouse_click(struct unit_test_state *uts) return 0; } BOOTSTD_TEST(expo_mouse_click, UTF_DM | UTF_SCAN_FDT); + +static int expo_test_mode(struct unit_test_state *uts) +{ + struct scene_obj_menu *menu; + struct abuf buf, logo_copy; + struct udevice *dev; + struct scene *scn; + struct expo *exp; + + ut_assertok(create_test_expo(uts, &exp, &scn, &menu, &buf, &logo_copy)); + dev = exp->display; + + /* Check test mode is initially off */ + ut_asserteq(false, exp->test->enabled); + + /* Entering expo mode without expotest env var keeps it off */ + expo_enter_mode(exp); + ut_asserteq(false, exp->test->enabled); + expo_exit_mode(exp); + + /* Enable test mode */ + ut_assertok(env_set("expotest", "1")); + expo_enter_mode(exp); + ut_asserteq(true, exp->test->enabled); + + /* Check initial render count */ + ut_asserteq(0, exp->test->render_count); + + /* Render and check count increments */ + ut_assertok(expo_set_scene_id(exp, scn->id)); + ut_assertok(scene_arrange(scn)); + ut_assertok(expo_render(exp)); + ut_asserteq(1, exp->test->render_count); + + ut_assertok(expo_render(exp)); + ut_asserteq(2, exp->test->render_count); + + /* Test that expo_enter_mode() resets the counter */ + expo_exit_mode(exp); + expo_enter_mode(exp); + ut_asserteq(0, exp->test->render_count); + ut_assertok(expo_render(exp)); + ut_asserteq(1, exp->test->render_count); + expo_exit_mode(exp); + + /* Disable test mode */ + ut_assertok(env_set("expotest", "0")); + expo_enter_mode(exp); + ut_asserteq(false, exp->test->enabled); + expo_exit_mode(exp); + + /* Check test mode is off when env var is unset */ + ut_assertok(env_set("expotest", NULL)); + expo_enter_mode(exp); + ut_asserteq(false, exp->test->enabled); + expo_exit_mode(exp); + + ut_assertok(env_set("expotest", NULL)); + abuf_uninit(&buf); + abuf_uninit(&logo_copy); + expo_destroy(exp); + + return 0; +} +BOOTSTD_TEST(expo_test_mode, UTF_DM | UTF_SCAN_FDT | UTF_CONSOLE); From patchwork Mon Oct 6 20:58:46 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 529 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=1759784394; bh=C78LpB8ppEzsrzMKJB5GGIdypLm1u97BkmlTrPyMaoA=; 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=rvHiDTha7QAJza1xrNN1z5weFWZvflHh8iNkmvHOji30oKoYbAbA3CUuh42X/hyjA jV1MWtZWIz3KuyfC3/biX9DRpqqqf7VlCGIS4Ao5X6I9FEd5IWlww5fOxeY/98ZX+r kt3YG+ppIPxPMsZUPTa6C5NsQ9ptCEdlHOfZfwsk7L1YeaOrV7SZWJFzlxttt+zbDb c6VytJZGCRMoGTA/cjxeoJcop++jjgrN69ptximNXfQStguYrM4fEpvcM+decJk7LF 4+Aq0X6msbwPtIVDgJJIVCYyZlsE9fzze5myXl6wXk5Pj7WZ68rFEttvDbX+6NDSBU srlesgOq9hasg== Received: from localhost (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id 43D5B67F52 for ; Mon, 6 Oct 2025 14:59:54 -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 numccRqUfw6f for ; Mon, 6 Oct 2025 14:59:54 -0600 (MDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1759784393; bh=C78LpB8ppEzsrzMKJB5GGIdypLm1u97BkmlTrPyMaoA=; 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=MwNhNnX9qApilBCb36qbd+Xkh+4bJYgOyGutZBJB5dPzG9qf/qTSBiBhZ5W60qWxN 4YHDijw/uDwDP1p+6UlooRFkIDl1ifM6iQ87GnYpG1nWIiDgXdFEbU4d577wLHp1eD mJ2KQQbTu6Tg0RizuqZh2jWBxG/UeTKXh4DqSD2tK5ylDDKBbZwNHS8ut/RE0RrXeI BVBiEuEU/IxtT/GQtcT4uNFaV3CY+YQa39ZNcN/UnmJHhi5/a5P3FkQUbNjNuPdYRm 3fJsuLzVt97Pj0q1FXfeYcCDEZ/FLaxaUm1juhnO+pogRj9kNXWYtt+CxdHBOqVkuk +W5oa8qPIlNrA== Received: from mail.u-boot.org (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id 945EB67F84 for ; Mon, 6 Oct 2025 14:59:53 -0600 (MDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1759784390; bh=+n/EEeKD3PRw42EBeqS14mx8+Yiz4vwayQhZVfakhz8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=IXJMuW4xruhx/T30Gqu5YbMxFYBfGwekigrRiFjZ7cqW873qh5aWeZdLmrePeFV5D D9Medq0x96N/YAjaXFQSuEgJgyiB7PbTq12pEsLC5mRemwWnK+ITOL0lj1RzAE6RCx UzWRF2XaqwIFrMjQxmL9BMezgYK1UKU07TvDhjUdpN9QPOQ7hJlTSuAN68wwQ29mFu svwNHcrkKMzeC6m/jf76x9gKRctno1pM7HEA9uFA3t1xfXMAMRs3mEYzV9Da/sG0Kz x7QtpjlyTkXCDYCbe9KbPPZY17IRz/dsEwTntKG7CeqbBEpE+gnGH2w2lX4wcpxOKW ufa20ICAf5tFw== Received: from localhost (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id CE7CD67F03; Mon, 6 Oct 2025 14:59:50 -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 d_JLFAdE4QdK; Mon, 6 Oct 2025 14:59:50 -0600 (MDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1759784388; bh=M/PyEYl/xu8mXcuS+/1TzIbVN7Oopa8ihH5+u5xWhkM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=WF+8w+/GU298p74Aryy98C/MUaQTgF++DpDyP1kgg0tUnUsC6zRU7bWkGxoFCkq1a C2eWlGfuo3ePp538VKHHDTKsBWYkrfxk/AwwviJ31IJKMrESK1uW1yLcUatqSbDwd+ LRAQcwfQYSz1RGSF2/rVBoT8m5ZdhO5/LlJWiLkgkWiBuxqfTU/qPINQZIlT5a8Wfe CSIu8/R62QWb9/znxSLJZtE/F1APSE3juWYnKIZgggoOMcdp+R4yZaDHvJMWZZ1iy+ 4RifREliXVUgi4hAhez2gU+7WiSsHWjDTG15IpvFPtEhLtY5kTkGGKsgCrBwJhGLBw TzI/w96Rhn/NQ== Received: from u-boot.org (unknown [73.34.74.121]) by mail.u-boot.org (Postfix) with ESMTPSA id 5111667F8D; Mon, 6 Oct 2025 14:59:48 -0600 (MDT) From: Simon Glass To: U-Boot Concept Date: Mon, 6 Oct 2025 14:58:46 -0600 Message-ID: <20251006205856.2009292-13-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: FFA76Y5FPYGFDWVB65SYZYHMMZRXPAJU X-Message-ID-Hash: FFA76Y5FPYGFDWVB65SYZYHMMZRXPAJU 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 12/14] expo: Add FPS tracking to 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 In test mode, show the FPS (frames per second) below the frame count. This is helpful for performance monitoring during development. The FPS calculation averages over the last 5 seconds to provide a stable reading. Add a test for the FPS calculation logic as well. Mention expo's test mode in the documentation. Co-developed-by: Claude Signed-off-by: Simon Glass --- boot/expo_test.c | 60 ++++++++++++++++++++++++++++++++++++++++++++ doc/develop/expo.rst | 16 ++++++++++++ include/expo_test.h | 28 +++++++++++++++++++++ test/boot/expo.c | 57 +++++++++++++++++++++++++++++++++++++++++ 4 files changed, 161 insertions(+) diff --git a/boot/expo_test.c b/boot/expo_test.c index 0ac2d0551a1..726027aabb6 100644 --- a/boot/expo_test.c +++ b/boot/expo_test.c @@ -15,6 +15,7 @@ #include #include #include +#include #include #include @@ -44,6 +45,8 @@ void expo_test_checkenv(struct expo *exp) test->enabled = env_get_yesno("expotest") == 1; test->render_count = 0; + test->start_time_ms = get_timer(0); + test->last_update = get_timer(0); } void expo_test_update(struct expo *exp) @@ -53,6 +56,44 @@ void expo_test_update(struct expo *exp) test->render_count++; } +int expo_calc_fps(struct expo_test_mode *test) +{ + ulong oldest_time, newest_time; + int oldest_frames, newest_frames; + int frame_delta, time_delta; + int oldest_idx; + int fps; + + /* Use most recent entry */ + newest_time = test->fps_timestamps_ms[test->fps_index]; + newest_frames = test->fps_frame_counts[test->fps_index]; + + /* Find oldest valid entry by looking backwards from current index */ + oldest_idx = (test->fps_index + 1) % EXPO_FPS_AVG_SECONDS; + if (test->fps_timestamps_ms[oldest_idx] == 0) { + /* Array hasn't wrapped yet, use first entry */ + oldest_idx = 0; + } + + oldest_time = test->fps_timestamps_ms[oldest_idx]; + oldest_frames = test->fps_frame_counts[oldest_idx]; + + /* Need at least two data points with different timestamps */ + if (oldest_time >= newest_time) + return 0; + + frame_delta = newest_frames - oldest_frames; + time_delta = newest_time - oldest_time; + + if (!time_delta) + return 0; + + /* Calculate FPS: frames / (time_ms / 1000) */ + fps = (frame_delta * 1000) / time_delta; + + return fps; +} + int expo_test_render(struct expo *exp) { struct expo_test_mode *test = exp->test; @@ -60,6 +101,7 @@ int expo_test_render(struct expo *exp) struct udevice *dev = exp->display; struct video_priv *vid_priv; char buf[30]; + ulong now; int x, y; int ret; @@ -74,6 +116,16 @@ int expo_test_render(struct expo *exp) vid_priv = dev_get_uclass_priv(dev); cons_priv = dev_get_uclass_priv(exp->cons); + /* Update FPS if at least 1 second has elapsed */ + if (get_timer(test->last_update) >= 1000) { + now = get_timer(test->start_time_ms); + test->fps_index = (test->fps_index + 1) % EXPO_FPS_AVG_SECONDS; + test->fps_timestamps_ms[test->fps_index] = now; + test->fps_frame_counts[test->fps_index] = test->render_count; + test->fps_last = expo_calc_fps(test); + test->last_update = get_timer(0); + } + /* Display frame count */ snprintf(buf, sizeof(buf), "frame %6d", test->render_count); x = vid_priv->xsize - 18 * cons_priv->x_charsize; @@ -81,5 +133,13 @@ int expo_test_render(struct expo *exp) vidconsole_set_cursor_pos(exp->cons, x, y); vidconsole_put_string(exp->cons, buf); + /* Display FPS on next line (only if non-zero) */ + if (test->fps_last > 0) { + snprintf(buf, sizeof(buf), "fps %6d", test->fps_last); + y += cons_priv->y_charsize; + vidconsole_set_cursor_pos(exp->cons, x, y); + vidconsole_put_string(exp->cons, buf); + } + return 0; } diff --git a/doc/develop/expo.rst b/doc/develop/expo.rst index 5c2e3157c8f..85ccbe7fd63 100644 --- a/doc/develop/expo.rst +++ b/doc/develop/expo.rst @@ -577,6 +577,22 @@ API documentation Future ideas ------------ +Test Mode +--------- + +Expo supports a test mode that can be enabled by setting the environment +variable `expotest` to 1. When enabled, expo displays the frame count in the +top-right corner of the display. This is useful for debugging and performance +analysis. + +To enable test mode:: + + => setenv expotest 1 + => bootflow menu + +The frame count shows the number of times `expo_render()` has been called since +`expo_enter_mode()` was invoked. The counter resets each time expo mode is entered. + Some ideas for future work: - Default menu item and a timeout diff --git a/include/expo_test.h b/include/expo_test.h index 88cec4a2a96..9d557e29c87 100644 --- a/include/expo_test.h +++ b/include/expo_test.h @@ -9,15 +9,30 @@ struct expo; +/* Number of seconds to average FPS over in test mode */ +#define EXPO_FPS_AVG_SECONDS 5 + /** * struct expo_test_mode - Test mode information for expo * * @enabled: true if test mode is enabled + * @start_time_ms: Time when expo_enter_mode() was called (milliseconds) * @render_count: Number of calls to expo_render() since expo_enter_mode() + * @fps_timestamps_ms: Timestamps for FPS calculation (milliseconds) + * @fps_frame_counts: Frame counts at each timestamp + * @fps_index: Current index in the FPS tracking arrays + * @fps_last: Last calculated FPS value + * @last_update: Time of last FPS update (milliseconds) */ struct expo_test_mode { bool enabled; + ulong start_time_ms; int render_count; + ulong fps_timestamps_ms[EXPO_FPS_AVG_SECONDS]; + int fps_frame_counts[EXPO_FPS_AVG_SECONDS]; + int fps_index; + int fps_last; + ulong last_update; }; #if CONFIG_IS_ENABLED(EXPO_TEST) @@ -62,6 +77,14 @@ void expo_test_update(struct expo *exp); */ int expo_test_render(struct expo *exp); +/** + * expo_calc_fps() - Calculate FPS based on recent frame history + * + * @test: Test mode data containing frame history + * Return: Calculated FPS value, or 0 if insufficient data + */ +int expo_calc_fps(struct expo_test_mode *test); + #else static inline int expo_test_init(struct expo *exp) @@ -86,6 +109,11 @@ static inline int expo_test_render(struct expo *exp) return 0; } +static inline int expo_calc_fps(struct expo_test_mode *test) +{ + return 0; +} + #endif /* EXPO_TEST */ #endif /* __EXPO_TEST_H */ diff --git a/test/boot/expo.c b/test/boot/expo.c index a1aa543ab71..8a401ba9884 100644 --- a/test/boot/expo.c +++ b/test/boot/expo.c @@ -1163,3 +1163,60 @@ static int expo_test_mode(struct unit_test_state *uts) return 0; } BOOTSTD_TEST(expo_test_mode, UTF_DM | UTF_SCAN_FDT | UTF_CONSOLE); + +static int expo_test_calc_fps(struct unit_test_state *uts) +{ + struct expo_test_mode test; + int fps; + + memset(&test, 0, sizeof(test)); + + /* No data - should return 0 */ + fps = expo_calc_fps(&test); + ut_asserteq(0, fps); + + /* Single data point - should return 0 */ + test.fps_index = 0; + test.fps_timestamps_ms[0] = 0; + test.fps_frame_counts[0] = 0; + fps = expo_calc_fps(&test); + ut_asserteq(0, fps); + + /* Two data points: 100 frames in 1000ms = 100 FPS */ + test.fps_index = 1; + test.fps_timestamps_ms[0] = 0; + test.fps_frame_counts[0] = 0; + test.fps_timestamps_ms[1] = 1000; + test.fps_frame_counts[1] = 100; + fps = expo_calc_fps(&test); + ut_asserteq(100, fps); + + /* Three data points spanning 2 seconds: 240 frames in 2000ms = 120 FPS */ + test.fps_index = 2; + test.fps_timestamps_ms[0] = 0; + test.fps_frame_counts[0] = 0; + test.fps_timestamps_ms[1] = 1000; + test.fps_frame_counts[1] = 100; + test.fps_timestamps_ms[2] = 2000; + test.fps_frame_counts[2] = 240; + fps = expo_calc_fps(&test); + ut_asserteq(120, fps); + + /* Test wraparound: index at 1, with data at indices 2,3,4,0,1 */ + test.fps_index = 1; + test.fps_timestamps_ms[2] = 0; + test.fps_frame_counts[2] = 0; + test.fps_timestamps_ms[3] = 1000; + test.fps_frame_counts[3] = 60; + test.fps_timestamps_ms[4] = 2000; + test.fps_frame_counts[4] = 120; + test.fps_timestamps_ms[0] = 3000; + test.fps_frame_counts[0] = 180; + test.fps_timestamps_ms[1] = 4000; + test.fps_frame_counts[1] = 240; + fps = expo_calc_fps(&test); + ut_asserteq(60, fps); /* 240 frames in 4000ms = 60 FPS */ + + return 0; +} +BOOTSTD_TEST(expo_test_calc_fps, 0); From patchwork Mon Oct 6 20:58:47 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 530 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=1759784398; bh=5b9VHTk4NaMqtHJi/5N0J5B77ezCwvhyrJVBvO1hcrc=; 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=XVyIEYPbhbPTeJY3sLkPYx0y1on9Pl+TgX+VYIyQYNOvau30VFWK2jTF8dYsypNRm lbI+z1HfFBRQOT+hChRUIo8jwPKLEDbTFJAwgCtUhiFAyGcqvPYU2KazY2oGzz+uTH /FDEK5E4rNqFLHeeeKHty3jF9F/QwfkLhD4+8n/ZQRL7JIvjCQqsjWJDQXExFRXhF0 PlBazOWjS2Mjrn8AbprdbLfG7gJgWCTGXb65AXSz5DPz8iYsCPE1b6/Tr5Vhhegle9 l9pG4LmsLUCACn3gDDAXC1AvgyhpilrQEBibFqvciHvJJgIXP4eynSHEh08QR1FaYr MMj9MrLRN7aJg== Received: from localhost (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id 4A8E367EE4 for ; Mon, 6 Oct 2025 14:59:58 -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 uKjL_CZ2QBQy for ; Mon, 6 Oct 2025 14:59:58 -0600 (MDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1759784398; bh=5b9VHTk4NaMqtHJi/5N0J5B77ezCwvhyrJVBvO1hcrc=; 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=XVyIEYPbhbPTeJY3sLkPYx0y1on9Pl+TgX+VYIyQYNOvau30VFWK2jTF8dYsypNRm lbI+z1HfFBRQOT+hChRUIo8jwPKLEDbTFJAwgCtUhiFAyGcqvPYU2KazY2oGzz+uTH /FDEK5E4rNqFLHeeeKHty3jF9F/QwfkLhD4+8n/ZQRL7JIvjCQqsjWJDQXExFRXhF0 PlBazOWjS2Mjrn8AbprdbLfG7gJgWCTGXb65AXSz5DPz8iYsCPE1b6/Tr5Vhhegle9 l9pG4LmsLUCACn3gDDAXC1AvgyhpilrQEBibFqvciHvJJgIXP4eynSHEh08QR1FaYr MMj9MrLRN7aJg== Received: from mail.u-boot.org (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id 3A10D67F1D for ; Mon, 6 Oct 2025 14:59:58 -0600 (MDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1759784396; bh=sQjNj63uVwRjNF+YgPw1tSacPY8ihEPFubz7t9OWCAw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=MmesEWB+fb0Nn52MJPovFxweojyk4GAUx8Cn1Mg5mzwGR2YGXos+gNBQj20x7Mi6A aOfWvel0V5+uqcv+fo68nqAIIbk57RBslZiajNc7KLsF0JcgJZTYmOPgvB/lm+Z/gT VHc/YUlZY419RNmAT+YdmvJ461F+ZYwyIlhFPErUdscSxUqMYil1xDRawHlhcOvW/c zyJy3Ct0cbW+zqXIEH2tVkx1lBtfDwMHuuwbNy+kLeTq6rweN2SdZs+ECSJ099iPQ6 AT3bJUO+KTb5aUcHXlwvU9CdW+Oi4BHkxkNvWeMvwi5lFSvuwjVqAo5iydNahCX+Lx 0A+K+LXYurPbw== Received: from localhost (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id 92B7067F52; Mon, 6 Oct 2025 14:59:56 -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 Bo5ZEzbk_5ry; Mon, 6 Oct 2025 14:59:56 -0600 (MDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1759784391; bh=xywvkcq/GyJaoY3jjRWGiKW+35lbtgtsYs0z8G5W5Kg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=nceJXFOhQB8BExSZtH0l+XeqIcVvZSkhrvn6l0QXHgSQtKGIyW29/QSYPtG9VxKSX SLsYO36DA8o5vckXCYZMCTPxOmf1NkwQyKhxOlX0LRVx1BthPkJKZrZXUOdohRvfJ/ TQOfCWxJjvfNz3+OnTWKMwTDMD7cuSmmtXGuiIx6lpYvn2mo3+H5CXBLRmWqh4J5Xi 7Ho44+jgtd+Tg84xpTwk13cZz+/syxu0pPeSxmaPMhbQ2YdH5hzllb8j0IoYp9oKF8 SnG9+vMq9nyd9LWVDLAddS43ldR3Mii3Mf8R+a0UBJyvXrxzaeSTbHdWnanAxV/2AK 41SMorEa4GUGg== Received: from u-boot.org (unknown [73.34.74.121]) by mail.u-boot.org (Postfix) with ESMTPSA id 1D97867F55; Mon, 6 Oct 2025 14:59:51 -0600 (MDT) From: Simon Glass To: U-Boot Concept Date: Mon, 6 Oct 2025 14:58:47 -0600 Message-ID: <20251006205856.2009292-14-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: 7YFEQSWUL763B3XAP42PRUXI2WDF6AJB X-Message-ID-Hash: 7YFEQSWUL763B3XAP42PRUXI2WDF6AJB 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 13/14] expo: Expand timing to include render and poll 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 Provide more timing information for expo operation, including the time taken to: - render the scene - sync the framebuffer to the display - poll for keyboard / mouse input These are averages calculated over the past second. Update the documentation to mention these features. Signed-off-by: Simon Glass --- boot/expo.c | 11 ++++++- boot/expo_test.c | 74 +++++++++++++++++++++++++++++++++++++++++++- doc/develop/expo.rst | 28 ++++++++++++++--- include/expo_test.h | 62 +++++++++++++++++++++++++++++++++++++ 4 files changed, 169 insertions(+), 6 deletions(-) diff --git a/boot/expo.c b/boot/expo.c index 2a75eed2c39..4f2c6d928a3 100644 --- a/boot/expo.c +++ b/boot/expo.c @@ -323,6 +323,7 @@ static int expo_render_(struct expo *exp, bool dirty_only) u32 colour; int ret; + expo_test_mark(exp); expo_test_update(exp); back = vid_priv->white_on_black ? VID_BLACK : VID_WHITE; @@ -352,6 +353,7 @@ static int expo_render_(struct expo *exp, bool dirty_only) return log_msg_ret("tst", ret); video_sync(dev, true); + expo_test_sync(exp); return scn ? 0 : -ECHILD; } @@ -528,6 +530,8 @@ int expo_poll(struct expo *exp, struct expo_action *act) { int key, ret = -EAGAIN; + expo_test_mark(exp); + /* update mouse position if mouse is enabled */ update_mouse_position(exp); @@ -541,11 +545,16 @@ int expo_poll(struct expo *exp, struct expo_action *act) if (!ret) ret = expo_send_click(exp, pos.x, pos.y); } - if (ret) + if (ret) { + expo_test_poll(exp); return log_msg_ret("epk", ret); + } /* get the action (either a key or a click) */ ret = expo_action_get(exp, act); + + expo_test_poll(exp); + if (ret) return log_msg_ret("eag", ret); diff --git a/boot/expo_test.c b/boot/expo_test.c index 726027aabb6..3ddeb86fb2c 100644 --- a/boot/expo_test.c +++ b/boot/expo_test.c @@ -49,6 +49,13 @@ void expo_test_checkenv(struct expo *exp) test->last_update = get_timer(0); } +void expo_test_mark(struct expo *exp) +{ + struct expo_test_mode *test = exp->test; + + test->base_time_us = timer_get_us(); +} + void expo_test_update(struct expo *exp) { struct expo_test_mode *test = exp->test; @@ -56,6 +63,20 @@ void expo_test_update(struct expo *exp) test->render_count++; } +void expo_test_sync(struct expo *exp) +{ + struct expo_test_mode *test = exp->test; + + test->sync_delta_us = get_timer_us(test->base_time_us); +} + +void expo_test_poll(struct expo *exp) +{ + struct expo_test_mode *test = exp->test; + + test->poll_delta_us = get_timer_us(test->base_time_us); +} + int expo_calc_fps(struct expo_test_mode *test) { ulong oldest_time, newest_time; @@ -108,6 +129,10 @@ int expo_test_render(struct expo *exp) if (!test->enabled) return 0; + /* Calculate time between update and render */ + if (test->base_time_us) + test->render_delta_us = get_timer_us(test->base_time_us); + /* Select 8x16 font for test display */ ret = vidconsole_select_font(exp->cons, "8x16", 0); if (ret && ret != -ENOSYS) @@ -116,13 +141,36 @@ int expo_test_render(struct expo *exp) vid_priv = dev_get_uclass_priv(dev); cons_priv = dev_get_uclass_priv(exp->cons); - /* Update FPS if at least 1 second has elapsed */ + /* Accumulate delta times for averaging */ + test->render_total_us += test->render_delta_us; + test->sync_total_us += test->sync_delta_us; + test->poll_total_us += test->poll_delta_us; + test->frame_count_last_sec++; + + /* Update FPS and averages if at least 1 second has elapsed */ if (get_timer(test->last_update) >= 1000) { now = get_timer(test->start_time_ms); test->fps_index = (test->fps_index + 1) % EXPO_FPS_AVG_SECONDS; test->fps_timestamps_ms[test->fps_index] = now; test->fps_frame_counts[test->fps_index] = test->render_count; test->fps_last = expo_calc_fps(test); + + /* Calculate averages over the last second */ + if (test->frame_count_last_sec > 0) { + test->render_avg_us = test->render_total_us / + test->frame_count_last_sec; + test->sync_avg_us = test->sync_total_us / + test->frame_count_last_sec; + test->poll_avg_us = test->poll_total_us / + test->frame_count_last_sec; + } + + /* Reset accumulation counters */ + test->render_total_us = 0; + test->sync_total_us = 0; + test->poll_total_us = 0; + test->frame_count_last_sec = 0; + test->last_update = get_timer(0); } @@ -141,5 +189,29 @@ int expo_test_render(struct expo *exp) vidconsole_put_string(exp->cons, buf); } + /* Display average render time in milliseconds on next line */ + snprintf(buf, sizeof(buf), "render %6lu.%01lums", + test->render_avg_us / 1000, + (test->render_avg_us % 1000) / 100); + y += cons_priv->y_charsize; + vidconsole_set_cursor_pos(exp->cons, x, y); + vidconsole_put_string(exp->cons, buf); + + /* Display average sync time in milliseconds on next line */ + snprintf(buf, sizeof(buf), "sync %6lu.%01lums", + test->sync_avg_us / 1000, + (test->sync_avg_us % 1000) / 100); + y += cons_priv->y_charsize; + vidconsole_set_cursor_pos(exp->cons, x, y); + vidconsole_put_string(exp->cons, buf); + + /* Display average poll time in milliseconds on next line */ + snprintf(buf, sizeof(buf), "poll %6lu.%01lums", + test->poll_avg_us / 1000, + (test->poll_avg_us % 1000) / 100); + y += cons_priv->y_charsize; + vidconsole_set_cursor_pos(exp->cons, x, y); + vidconsole_put_string(exp->cons, buf); + return 0; } diff --git a/doc/develop/expo.rst b/doc/develop/expo.rst index 85ccbe7fd63..9ce00e621e5 100644 --- a/doc/develop/expo.rst +++ b/doc/develop/expo.rst @@ -578,10 +578,10 @@ Future ideas ------------ Test Mode ---------- +~~~~~~~~~ Expo supports a test mode that can be enabled by setting the environment -variable `expotest` to 1. When enabled, expo displays the frame count in the +variable `expotest` to 1. When enabled, expo displays performance metrics in the top-right corner of the display. This is useful for debugging and performance analysis. @@ -590,8 +590,28 @@ To enable test mode:: => setenv expotest 1 => bootflow menu -The frame count shows the number of times `expo_render()` has been called since -`expo_enter_mode()` was invoked. The counter resets each time expo mode is entered. +Test mode displays the following metrics: + +Frame count + Shows the total number of frames rendered. This is the number of times + `expo_render()` has been called since `expo_enter_mode()` was invoked. + The counter resets each time expo mode is entered. + +FPS (frames per second) + Shows the rendering rate averaged over the past 5 seconds. This provides + a stable indication of rendering performance. + +Timing information + Shows average timings (in millisecond) for the following operations, + measured over the past second: + + - Render: Time taken to render the scene + - Sync: Time taken to sync the framebuffer to the display + - Poll: Time taken to poll for keyboard/mouse input + +These metrics help identify performance bottlenecks and verify that expo is +operating efficiently. The timing information is particularly useful when +optimizing display drivers or debugging slow rendering issues. Some ideas for future work: diff --git a/include/expo_test.h b/include/expo_test.h index 9d557e29c87..6363e70a3e5 100644 --- a/include/expo_test.h +++ b/include/expo_test.h @@ -23,6 +23,17 @@ struct expo; * @fps_index: Current index in the FPS tracking arrays * @fps_last: Last calculated FPS value * @last_update: Time of last FPS update (milliseconds) + * @base_time_us: Base time in microseconds for delta calculations + * @render_delta_us: Time between update and render in microseconds + * @sync_delta_us: Time taken by video_manual_sync() in microseconds + * @poll_delta_us: Time taken by expo_poll() in microseconds + * @render_total_us: Cumulative render time in current second (us) + * @sync_total_us: Cumulative sync time in current second (us) + * @poll_total_us: Cumulative poll time in current second (us) + * @frame_count_last_sec: Number of frames in current measurement second + * @render_avg_us: Average render time over last second (microseconds) + * @sync_avg_us: Average sync time over last second (microseconds) + * @poll_avg_us: Average poll time over last second (microseconds) */ struct expo_test_mode { bool enabled; @@ -33,6 +44,17 @@ struct expo_test_mode { int fps_index; int fps_last; ulong last_update; + ulong base_time_us; + ulong render_delta_us; + ulong sync_delta_us; + ulong poll_delta_us; + ulong render_total_us; + ulong sync_total_us; + ulong poll_total_us; + int frame_count_last_sec; + ulong render_avg_us; + ulong sync_avg_us; + ulong poll_avg_us; }; #if CONFIG_IS_ENABLED(EXPO_TEST) @@ -62,6 +84,16 @@ void expo_test_uninit(struct expo *exp); */ void expo_test_checkenv(struct expo *exp); +/** + * expo_test_mark() - Mark the current time for delta calculations + * + * @exp: Expo to update test mode for + * + * Records the current time in microseconds as the base time for subsequent + * delta calculations + */ +void expo_test_mark(struct expo *exp); + /** * expo_test_update() - Update test mode counters * @@ -69,6 +101,24 @@ void expo_test_checkenv(struct expo *exp); */ void expo_test_update(struct expo *exp); +/** + * expo_test_poll() - Calculate poll delta time + * + * @exp: Expo to update test mode for + * + * Calculates the time taken by expo_poll() based on the base time + */ +void expo_test_poll(struct expo *exp); + +/** + * expo_test_sync() - Calculate sync delta time + * + * @exp: Expo to update test mode for + * + * Calculates the time taken by video_manual_sync() based on the base time + */ +void expo_test_sync(struct expo *exp); + /** * expo_test_render() - Render test mode information * @@ -100,10 +150,22 @@ static inline void expo_test_checkenv(struct expo *exp) { } +static inline void expo_test_mark(struct expo *exp) +{ +} + static inline void expo_test_update(struct expo *exp) { } +static inline void expo_test_poll(struct expo *exp) +{ +} + +static inline void expo_test_sync(struct expo *exp) +{ +} + static inline int expo_test_render(struct expo *exp) { return 0; From patchwork Mon Oct 6 20:58:48 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 531 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=1759784400; bh=fmpsHt0q/CuMaZhFGYFoNKMsTsLj1vRsIpamb+4Q7o0=; 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=XCVjaxDbcn8oGT92jVJIO6c8Iyew5iOXqSs1lauIzrOR0Vvo9IiHWFZPPBV1o6DKj 4HTnGLeaHKSLJGKXdiX9knJzRjwhNe5VLUxg/9m+5K8q1su0oPBYb3RFV9nzCUNFx/ CR02jyh06dh6eHilGqmntXHJ05/yosx3SGQxFESSkUrEPNHaWXUeoCYfwXFthbwF+1 UlM7KzCalsTfORq6StlLlwn3C11XpjS6p69aK6RSFpNsfCDIi//RMBcO6QIvIHM9/H gHZwUuFutW0+WGjmCX9mz+axQeI3OZ4UrrhJB+WTLAoyzBtbAsZSxnhnR1rbGupkWe 6jlUMOdPvOQcQ== Received: from localhost (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id BA00C67F1D for ; Mon, 6 Oct 2025 15:00:00 -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 JowDMqWXpoiR for ; Mon, 6 Oct 2025 15:00:00 -0600 (MDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1759784399; bh=fmpsHt0q/CuMaZhFGYFoNKMsTsLj1vRsIpamb+4Q7o0=; 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=YdCoTRvhKY3STZjZMB0MpfspUnMdvLfz/VIWTbzygWHqJMuk53syH4LfTG8cIfxVE ROkcOHZ0zlhFKF5blN3P/XFS6No0D61YzzcNQHwNfxnRZsn33MYRXU+4DpcPBnv6Zi NBMHzILHtNpKIAQ7kVQYJ1XS31Ain41Wcm33bU357X7uDQNZB6SbKX8rasvBwgvoBr w2YdquZguhq3yQw3oKXSsP7O2rUMXWd16oUamOWskIFeW9tgF4WsDTFNkKXjDLd9zl bpQeeOiETaXDWY1960dpdcGtN9IWgDgZjBAhI+tuStsd2slS6aSo1BXdCoXV21ZHnM I9tLVt7ll/3zA== Received: from mail.u-boot.org (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id 04ED967EE4 for ; Mon, 6 Oct 2025 14:59:59 -0600 (MDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1759784397; bh=7ts93HU1DNQEv0C1sV4FRSPzrqA+gVtpIaQp8Kj9vsw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=mGUky5ZH2AE+6FLvSjH0e2sbHfnejhZyzrjb5xIGUm/xwFkUvlq09P7dJycQTmU1G CdV/QNf8W7GAx/wLB2gMw+thTWGziljdNnzUodVZCudtWP+We7brY6xtg9AmYylpVr S4HfE9goDlUUBcPtzEwXweOu4WajQTwSsnM3QVZKqwMXtK9/ZCvy5ptv3O3+uPmSjb xrGVKmg/zm1dAfKZ37YqmdPt73pUgmD3XW+A1WE872j2AehWAmuVuYcJdyQZWCzpL+ +GRQ+Cx0lcGpr7yyq5PN88r63vLOtyuQ4TCRFh4ab6K6EY9E/UCwlVyF4Q3OerOvL2 YaZDOB2oQgoVA== Received: from localhost (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id 7005267F03; Mon, 6 Oct 2025 14:59:57 -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 gx5xAliCTIml; Mon, 6 Oct 2025 14:59:57 -0600 (MDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1759784396; bh=WHq78/PihsmoCmX8VLTQTqKJYlr6H1baOHAIhnh8dX0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=dd8xopA+t1efDoiIspJ2h63f6lZOwBIXaLes+rzptrnfSPs68u+wgtc28YllljF8b IsaUcDR3Vw49Gnh9ALJYTEn4QMa7dzmHZlmTp5Jg3vqoXLqcxtT6ZvOOabWypdbp6D dZDolOI8O3zAtZArh/LHBY9Eb6U/No1gP/0cZ0Y0+Gh8Id/3YqifEct93JlDD1Qgiz t0RseLBaLDs2lZUSS+L4JYKOja8RaVfCHhNzsZeSnUrtTAQ137IUr9h/IDGseLTsL0 nWFsUjW+K+7UKluWg0BvJRxUpGnRQaKIB1CX/fx2WNMAx0+yDkHuHhzcPjEmHYWX0n HW0fP5GsKo5kw== Received: from u-boot.org (unknown [73.34.74.121]) by mail.u-boot.org (Postfix) with ESMTPSA id BA0AB67EE4; Mon, 6 Oct 2025 14:59:55 -0600 (MDT) From: Simon Glass To: U-Boot Concept Date: Mon, 6 Oct 2025 14:58:48 -0600 Message-ID: <20251006205856.2009292-15-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: DN3QLXL2YP45JEEAXJBESGLUI7U4BO27 X-Message-ID-Hash: DN3QLXL2YP45JEEAXJBESGLUI7U4BO27 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 14/14] expo: Use manual-sync 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 Make use of the manual-sync mode provided by the video subsystem. This removes uncertainty about whether the display will actually be updated. Signed-off-by: Simon Glass --- boot/expo.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/boot/expo.c b/boot/expo.c index 4f2c6d928a3..ebe31059e87 100644 --- a/boot/expo.c +++ b/boot/expo.c @@ -352,7 +352,7 @@ static int expo_render_(struct expo *exp, bool dirty_only) if (ret) return log_msg_ret("tst", ret); - video_sync(dev, true); + video_manual_sync(dev, VIDSYNC_COPY | VIDSYNC_FLUSH); expo_test_sync(exp); return scn ? 0 : -ECHILD; @@ -569,7 +569,7 @@ void expo_req_size(struct expo *exp, int width, int height) void expo_enter_mode(struct expo *exp) { - video_manual_sync(exp->display, true); + video_set_manual_sync(true); if (IS_ENABLED(CONFIG_MOUSE) && exp->mouse_enabled) mouse_set_ptr_visible(exp->mouse, false); @@ -578,7 +578,7 @@ void expo_enter_mode(struct expo *exp) void expo_exit_mode(struct expo *exp) { - video_manual_sync(exp->display, false); + video_set_manual_sync(false); if (IS_ENABLED(CONFIG_MOUSE) && exp->mouse_enabled) mouse_set_ptr_visible(exp->mouse, true); }