From patchwork Fri Oct 3 16:54:54 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 482 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=1759510560; bh=/yufxoTpOUTuzWsAZFgQqljNlfDAdl+FRWBDHU9My9k=; 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=ObPOiRqRna/L1AIyoUXC55a5LYWzNaucJk6S4KHglMrAg2ItLyfr+dPCzMeHqWtwh GC/7JqeFMHetgz9hBPKNmJ5efNnOOJ6gnSmvj+ewpLHg0m02H/PcokpFF3MujrDBVG g7J4wVTby3Qq6EWlTVErq9dnvxHnfnmdi73Og3QZARf8h0vaUnNFGSvJWmpLF9Ugd9 49IHmH7v3OTwVgAMN5t293yl/Y/goE9SPPlVO4riLVdpqCtDGN+HY85pSQiRdmZ5Z2 FVvihi/N90+qndssef8sPm/QerTtxzGuyH+15LaXU6/15Rmn0tNFjzlRnzINSjPyIf Yn44d0om50OxQ== Received: from localhost (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id 6781967EBD for ; Fri, 3 Oct 2025 10:56: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 nLHSnna39nYE for ; Fri, 3 Oct 2025 10:56:00 -0600 (MDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1759510558; bh=/yufxoTpOUTuzWsAZFgQqljNlfDAdl+FRWBDHU9My9k=; 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=FGKr4omCV3PPM7/LG8pXf1R9R7TwsCVZfrQx6PzZpLL5UMsYvHKzHtPW9kZ7OWoCO V+vuws9uO+Dp+Z4haxyOG+kCjp4Jya2Y7wKwSohvGwK91lii9hFzImsOQ7quOVOqZw TesOUccrIU5Bq+hkLE/8DOZWA88W9Yd42TM/znt9kZ19TEz+xOvkod0s4mqePl7UCn C6ifmg3eedkggH8eu6HXy+NiepdilglCQbKryHA3ukI9WI5QPlDbVZGty3/9Q0u/Fb wentNHIV4jJQ96CciAv9ofr44cmYvTJP04eeab87UmlveaK6+euY0hqGWogSsHUEHt FJQs2AkE7o2lA== Received: from mail.u-boot.org (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id B06BC67EC0 for ; Fri, 3 Oct 2025 10:55:58 -0600 (MDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1759510555; bh=1bbsovDHsv0O0k0pbN64d1JHw3KHJKVN2w+ICGnlnME=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=No93JFiTdXZ06JgRK/QfIlUVbDPlf3PiCMpjdcJ2KD6PY69YzXtpgDk6tkNZeK3Q3 S5IVTvOf4xbtDyqfBwM8SgopY0Qvq88Q064zPYCj2p9aPq/s5PH3GMpmkex7OAY1YM lSvJffoGwHtnbCSGkCKqXxxUMOzus3D5txtZev6tXHQ/4UKuepTTZhkd6AUhw6amuT 89JlcHQQGDlotgPa8B8J1iPt4wtBYeshi51tCoQfBO3MR4TmqMNm0ZYWMFS1EA6DSq zNt+Iq0X8HhKXsa+hhTgipXsWyCjkjw4dNUq9OVORQaAwJ4wp27McMTISGfp03zyHM k1/N7rXx5EdRw== Received: from localhost (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id 7D55967E12; Fri, 3 Oct 2025 10:55:55 -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 saweg3GBZ2X3; Fri, 3 Oct 2025 10:55:55 -0600 (MDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1759510555; bh=2RVJwugpqrQc8TdZuyYfyln6Z8czigItzeXcyo4gFUY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=YpeReUpX9nNvMho0EySXI2LBhclJN7ZvtdclfYm5DrjlIGZlLJu580P9HWl2mwO17 w+mX/PHcOCSY0Y3UObooHsyPM3CGGc3K5H1A19ugCKx9dQoGLBFvk1pYwhc30AXT9M sH2rjZsHTVno6qZoIwL2DKsI4mj8Z5Kbi6LGShrw20BDNu4JyTiPXma9S8OB9Fiwca WYnpP/QM1N7d7PmcY26pKI3tlABBndlVUXqnlg2i+CPAq5BpetA5YOD5NInpmk1zaz a5SNwXg59j60wLCfIqAJqn4JtzbMBUxzuVSQODh1j/uml7zBCnsjdDRcMfCOmGomRp BDmlWFUaRMfdg== Received: from u-boot.org (unknown [73.34.74.121]) by mail.u-boot.org (Postfix) with ESMTPSA id A49D067E7C; Fri, 3 Oct 2025 10:55:54 -0600 (MDT) From: Simon Glass To: U-Boot Concept Date: Fri, 3 Oct 2025 10:54:54 -0600 Message-ID: <20251003165525.440173-2-sjg@u-boot.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20251003165525.440173-1-sjg@u-boot.org> References: <20251003165525.440173-1-sjg@u-boot.org> MIME-Version: 1.0 Message-ID-Hash: 4SDTCYAPKBPZV7S6GBVTCHVSR4WWX43A X-Message-ID-Hash: 4SDTCYAPKBPZV7S6GBVTCHVSR4WWX43A 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 01/22] doc: sandbox: Update command-line options documentation 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 Some recent flags don't have documentation included. Before adding more flags, fix these: -A, --no_term_present: For pager testing -k, --select_unittests: Select specific unit tests -P, --pager_bypass: Enable pager-bypass mode -W, --title: Set window title Also fix the documentation for --double_lcd which uses -K not -k Co-developed-by: Claude Signed-off-by: Simon Glass --- doc/arch/sandbox/sandbox.rst | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/doc/arch/sandbox/sandbox.rst b/doc/arch/sandbox/sandbox.rst index 89255cb14dd..31a670ce2ab 100644 --- a/doc/arch/sandbox/sandbox.rst +++ b/doc/arch/sandbox/sandbox.rst @@ -103,6 +103,9 @@ available options. Some of these are described below: even if CONFIG_AUTOBOOT_KEYED is enabled, since it interfers with tests and normal usage +-A, --no_term_present + Assume no terminal is present. This is used for pager testing. + -b. boot The distro boot feature doesn't run by default on sandbox, since it normally not vert useful. For the distro_bootcmds to succeed, quite a bit of setup is @@ -162,7 +165,10 @@ available options. Some of these are described below: writes an elf file containing the extracted portion, then execs it. This argument provides the filename, so it can be removed before U-Boot exits. --k, --double_lcd +-k, --select_unittests + Select specific unit tests to run. This is only used with SPL. + +-K, --double_lcd Doubles the size of the emulated LCD, so that it appears bigger. This can be useful on large or high-resolution displays. @@ -199,6 +205,9 @@ available options. Some of these are described below: each program is extracted from the original image and executed (see -j), this is the only way that subsequent phases can locate the full image. +-P, --pager_bypass + Enable pager bypass mode for testing. + -r, --read Read driver state from a dtb file. In conjunction with `-w`, this allows sandbox to save and restore emulated hardware state (such as a TPM) across @@ -248,6 +257,9 @@ available options. Some of these are described below: sandbox to save and restore emulated hardware state (such as a TPM) across each U-Boot phase. +-W, --title + Set the window title for the sandbox display. + Environment Variables --------------------- From patchwork Fri Oct 3 16:54:55 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass <sjg@u-boot.org> X-Patchwork-Id: 483 Return-Path: <concept-bounces+u-boot-concept=u-boot.org@u-boot.org> 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=1759510565; bh=U0fIZVgD+1R4FBWG1Bi7PKl5MiARkU5egCobgqUDlS8=; 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=EbPZds5ba6Y0GhVCV4WBS8rx+9Yw6prJnYbBZQ8HJpv8t5raOsc1ddI4rEQk8x6h2 fAkVFNl/GYDUK6DCQf8Pe8RVJt5f7JDI59p5B/Y6iSLnRT9mkHCNT3Tv7YyMTivg3R dgtmMraraB5sHxUXrTIXOrElmaoE+KLiTTSbN4cqn9sOh1WKmAxhEW6ewu7STPxtLb kMTv0A+YorbzD7yJnWWW/l+7ImcPfdLYmQu8+X8uXXf+t4rSEvGkC50H4ry3o6ihpY j1Z6Ih2u9f1DIyx8uebLqib1CBrxQnrA55nOPa5dIb7kUjOoNRgl+tgLAjf/hCW2rb v2lJDqqx5xhjw== Received: from localhost (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id 5603667EBD for <u-boot-concept@u-boot.org>; Fri, 3 Oct 2025 10:56:05 -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 vNcu9501j6WV for <u-boot-concept@u-boot.org>; Fri, 3 Oct 2025 10:56:05 -0600 (MDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1759510565; bh=U0fIZVgD+1R4FBWG1Bi7PKl5MiARkU5egCobgqUDlS8=; 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=EbPZds5ba6Y0GhVCV4WBS8rx+9Yw6prJnYbBZQ8HJpv8t5raOsc1ddI4rEQk8x6h2 fAkVFNl/GYDUK6DCQf8Pe8RVJt5f7JDI59p5B/Y6iSLnRT9mkHCNT3Tv7YyMTivg3R dgtmMraraB5sHxUXrTIXOrElmaoE+KLiTTSbN4cqn9sOh1WKmAxhEW6ewu7STPxtLb kMTv0A+YorbzD7yJnWWW/l+7ImcPfdLYmQu8+X8uXXf+t4rSEvGkC50H4ry3o6ihpY j1Z6Ih2u9f1DIyx8uebLqib1CBrxQnrA55nOPa5dIb7kUjOoNRgl+tgLAjf/hCW2rb v2lJDqqx5xhjw== Received: from mail.u-boot.org (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id 4606967E83 for <u-boot-concept@u-boot.org>; Fri, 3 Oct 2025 10:56:05 -0600 (MDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1759510562; bh=1aa5wqQV/Wo8LKr+qbeM1GD5dKtCOC7ZhQNZFU8dSXo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Bgj0zCaOY3Fxt5G+7T+oRGZG/kMSe3W6e0+FLtkp5Trqh2nrVK2VB1kaEOlb7E1PR tYjcaqPaSvasGQ3cQ8SfLsPk2U1/OTDlQggppl4HFMnUoOyBbjEkXeXwaE/iu1Goc8 0senZ6zZ2YrgpBe5cKr4NZNnjNEs3+cL6swYetSORdVlT5xIRPeS4ElVI6fWhy28wC oe3En1wLmU1dCqiKfvC2YM8CQ4Lc3jlId1fjiAumXcVpZSXbUpBab6NzafFkLQpyMJ U/pe627hBHHMArPDcdsc2K0w2YcrUIscy2mApsLdQNUkzKY8tQAV5F2lrUr10aqLR2 i1uZWU4QFxKJw== Received: from localhost (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id BAEBB67E83; Fri, 3 Oct 2025 10:56:02 -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 VLRYTxKJgZWZ; Fri, 3 Oct 2025 10:56:02 -0600 (MDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1759510556; bh=Nv+jk5+CD67Q4cm7WgYLZ1ZRNef4s00wdX8k7ZDZWFw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=MSOQflnQB5b9Wa2T8bQnJVfWM9RwxLWwZ8ahUbjQ7rmh4Uq2s3V2gWDBIe3WpjFzI wyI70tcU4kJ1IbRxuWgK+lItcLm4YZU62bxNq06klnviWD2nmLWP2SBMq5rJT5727p NR5fqQcaDdSeKulEvJJrg/FRuanmNM4KouiyQ2CRiH0W+lJ7uMTcxhuvqmc1N9Syve mWNMghOgGTgCR/1bn1SsEpg2CLxA6sz6Syqvu89YYagiiJXWFBisOvYYhMHqJW0Gk7 TAsSpfsPTNMlVK8XH0RmYKE+lkPPrr5eJg4OqCWADx4ft4AyBnAWR6yJ4jJ0eAaf/M qeYMeDkkqwD4A== Received: from u-boot.org (unknown [73.34.74.121]) by mail.u-boot.org (Postfix) with ESMTPSA id C40FA67E7C; Fri, 3 Oct 2025 10:55:55 -0600 (MDT) From: Simon Glass <sjg@u-boot.org> To: U-Boot Concept <concept@u-boot.org> Date: Fri, 3 Oct 2025 10:54:55 -0600 Message-ID: <20251003165525.440173-3-sjg@u-boot.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20251003165525.440173-1-sjg@u-boot.org> References: <20251003165525.440173-1-sjg@u-boot.org> MIME-Version: 1.0 Message-ID-Hash: TNBNIUJTR3DGNSGUOTM3SU2A3ANQDP5B X-Message-ID-Hash: TNBNIUJTR3DGNSGUOTM3SU2A3ANQDP5B 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 <xypron.glpk@gmx.de>, Simon Glass <sjg@chromium.org>, Claude <noreply@anthropic.com> X-Mailman-Version: 3.3.10 Precedence: list Subject: [Concept] [PATCH 02/22] sandbox: Add -V flag for video test delay List-Id: Discussion and patches related to U-Boot Concept <concept.u-boot.org> Archived-At: <https://lists.u-boot.org/archives/list/concept@u-boot.org/message/TNBNIUJTR3DGNSGUOTM3SU2A3ANQDP5B/> List-Archive: <https://lists.u-boot.org/archives/list/concept@u-boot.org/> List-Help: <mailto:concept-request@u-boot.org?subject=help> List-Owner: <mailto:concept-owner@u-boot.org> List-Post: <mailto:concept@u-boot.org> List-Subscribe: <mailto:concept-join@u-boot.org> List-Unsubscribe: <mailto:concept-leave@u-boot.org> From: Simon Glass <sjg@chromium.org> Add a new -V flag to sandbox which accepts a delay in milliseconds. This causes video tests to pause after each assertion, allowing the display output to be visually inspected. This is useful for debugging video tests and understanding what is being drawn at each step. Co-developed-by: Claude <noreply@anthropic.com> Signed-off-by: Simon Glass <sjg@chromium.org> --- arch/sandbox/cpu/start.c | 10 ++++++++++ arch/sandbox/include/asm/state.h | 1 + doc/arch/sandbox/sandbox.rst | 4 ++++ test/dm/video.c | 7 +++++-- 4 files changed, 20 insertions(+), 2 deletions(-) diff --git a/arch/sandbox/cpu/start.c b/arch/sandbox/cpu/start.c index 43adc4cdb4f..559c11a2dbb 100644 --- a/arch/sandbox/cpu/start.c +++ b/arch/sandbox/cpu/start.c @@ -365,6 +365,16 @@ static int sandbox_cmdline_cb_double_lcd(struct sandbox_state *state, SANDBOX_CMDLINE_OPT_SHORT(double_lcd, 'K', 0, "Double the LCD display size in each direction"); +static int sandbox_cmdline_cb_video_test(struct sandbox_state *state, + const char *arg) +{ + state->video_test = simple_strtol(arg, NULL, 10); + + return 0; +} +SANDBOX_CMDLINE_OPT_SHORT(video_test, 'V', 1, + "Enable video test mode (ms delay between asserts)"); + static const char *term_args[STATE_TERM_COUNT] = { "raw-with-sigs", "raw", diff --git a/arch/sandbox/include/asm/state.h b/arch/sandbox/include/asm/state.h index af92f4e6fcd..fc3c39cde27 100644 --- a/arch/sandbox/include/asm/state.h +++ b/arch/sandbox/include/asm/state.h @@ -177,6 +177,7 @@ struct sandbox_state { bool soft_fail; /* Continue on failure */ bool pager_bypass; /* Enable pager-bypass mode */ bool no_term_present; /* Assume no terminal present */ + int video_test; /* ms to wait before next assert */ /* Pointer to information for each SPI bus/cs */ struct sandbox_spi_info spi[CONFIG_SANDBOX_SPI_MAX_BUS] diff --git a/doc/arch/sandbox/sandbox.rst b/doc/arch/sandbox/sandbox.rst index 31a670ce2ab..bfc0ee70834 100644 --- a/doc/arch/sandbox/sandbox.rst +++ b/doc/arch/sandbox/sandbox.rst @@ -252,6 +252,10 @@ available options. Some of these are described below: -v, --verbose Show console output from tests. Normally this is suppressed. +-V, --video_test <ms> + Enable video test mode with a delay (in milliseconds) between assertions. This + allows time to examine the display during testing. + -w, --write Write driver state to state file on exit. In conjunction with `-r`, this allows sandbox to save and restore emulated hardware state (such as a TPM) across diff --git a/test/dm/video.c b/test/dm/video.c index b1bf08a99f7..f8c126dba5c 100644 --- a/test/dm/video.c +++ b/test/dm/video.c @@ -50,6 +50,7 @@ DM_TEST(dm_test_video_base, UTF_SCAN_PDATA | UTF_SCAN_FDT); int video_compress_fb(struct unit_test_state *uts, struct udevice *dev, bool use_copy) { + struct sandbox_state *state = state_get_current(); struct video_priv *priv = dev_get_uclass_priv(dev); uint destlen; void *dest; @@ -70,8 +71,10 @@ int video_compress_fb(struct unit_test_state *uts, struct udevice *dev, if (ret) return ret; - /* provide a useful delay if #define LOG_DEBUG at the top of file */ - if (_DEBUG) + /* provide a useful delay if -V flag is used or LOG_DEBUG is set */ + if (state->video_test) + mdelay(state->video_test); + else if (_DEBUG) mdelay(300); return destlen; From patchwork Fri Oct 3 16:54:56 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass <sjg@u-boot.org> X-Patchwork-Id: 484 Return-Path: <concept-bounces+u-boot-concept=u-boot.org@u-boot.org> 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=1759510567; bh=5roTVs/P2ovZBBj4fKg7Mp+936Ym/henE08PPDg2e5g=; 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=sbxhCejpkrhjj/Y1O4Z9u1doQzGOXZ+tM9m7BtN4Tqo80KTt01UyidxENaNyb/b6t u6H7bEzaWoZB7AsVTycX78dBUUZistNbbn0+eojH87FQoZICGlNauefA+wGl2Cw63B +uYbu2fibA6du9avnHaWS0DhgKROm7o3AFkHog1xayKl2+FcJDAT1CKQdTVOL+tpP/ PplRCZVGcGmV37wQav9VAiUZ9Vkn9S0kMq03D0xSHNHjUhc5Yn+B6qcTtAMn+/xToS iwat4WgUA69x2E2hJbCittmqoVOy4f2g3EaIFTVfB3z25OqlBsVIl6C29DwNb6nPGo HFGYGLztCcGXA== Received: from localhost (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id D4EDB67ECA for <u-boot-concept@u-boot.org>; Fri, 3 Oct 2025 10:56:07 -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 vX_l2UVQJzRP for <u-boot-concept@u-boot.org>; Fri, 3 Oct 2025 10:56:07 -0600 (MDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1759510565; bh=5roTVs/P2ovZBBj4fKg7Mp+936Ym/henE08PPDg2e5g=; 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=SgOjqyKnRSKsLhOZHfXJSWwFS2mtBRkPorAUH1sQ7DAPAwv+UzbnQNkpI14Wt9jo3 LwYxk159SaURLJ4iridTxa6vERtHWk4ltFT7AaNUxMyzU+0TsbJk9W8mm2n+45C2M+ uwZniNlo8vazwyu/sazlovCDpYcOQGTBF+x6Zquo9bvkfvYamoETRddQGFf7pxBYUK yE+frAxD6YNah0v/tCxylgw580BB8HY3eeT6XT3hCS4gn8QTX8qFcDyzZ6LdR4cThS TJcu1YMi7xIqffxtN20Plaw9WGnQZUvCZO7A7DKAlB7LeCz/zvnaq6y31I53zDsDkc 2PBZECSiSXw0g== Received: from mail.u-boot.org (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id D31F567E85 for <u-boot-concept@u-boot.org>; Fri, 3 Oct 2025 10:56:05 -0600 (MDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1759510562; bh=fMx1IspmnxXzntZH/8lrHzQJDdryZ0ciXkOROJ21xfk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=I9fH4uLkXx2P5QrphBodwknCtGeVbZD5YBChAFQzrdFjoG5Cuz8B08fpRHrxIZtkG YAZuYoHD8rGmXk5c+SBLzJJhorIshn31aGNA7Qmn3aCYSCNR3vV1a1VVrO+WxNEMxW iQSSDMZu4MY9F87aOS67SdDc/z3EabP8HSNhKUlP5VPYmGYRi4S5CtswUuXt0FoYe+ HnOE2uIh5N7kqfuMlUbi38UWBsoiSNGi/c/9LGlk1rIuaW0+zkXluqf8UMPxx5WSPS eIpLO57vosthKtNI9yybEJ6F/hMvAhAOJwvmVYjDhl4eyzzgObna4ANkZ7GLylyrwR +valcKdsuBs+A== Received: from localhost (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id C4F8167E7C; Fri, 3 Oct 2025 10:56:02 -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 Qs5S0k8Gm_MG; Fri, 3 Oct 2025 10:56:02 -0600 (MDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1759510561; bh=G+gd8+Qcxv8tqHmGdXfR5ZO14FxCIK+B3aldvFTOrIM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=LTBVGKOhHyk3LHFoj+82uKTi5WdQmh9CdjSlK213dg5RgwzSYPeCl96u+HgXsMHKu bMVEDZaVlVAXToUeW8y8FPiY2qTC293UiHsJbYNYYWinO/9cvGOvlTytRIJ/6yychi U6/vpuDObWlw+hu5UpyuYnfZ5juzF7EIHDjyRcS9cGsML1tkvV/5VW/Cwn35Y/aSOi 5r8Cz5VMU3so7USdWvomUXjshtpp7UD+90YMp5dkgcfcTuhGxcPeGeNqVxc0Rz812n GiWLyFgW+oxHtqOZx9bX6aSCDyLCHpPB9JOaWkksF5ifev2W1Bbtz1V+yiNx3lUKdk u1p/GcHMuSctw== Received: from u-boot.org (unknown [73.34.74.121]) by mail.u-boot.org (Postfix) with ESMTPSA id AAAE967F30; Fri, 3 Oct 2025 10:56:00 -0600 (MDT) From: Simon Glass <sjg@u-boot.org> To: U-Boot Concept <concept@u-boot.org> Date: Fri, 3 Oct 2025 10:54:56 -0600 Message-ID: <20251003165525.440173-4-sjg@u-boot.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20251003165525.440173-1-sjg@u-boot.org> References: <20251003165525.440173-1-sjg@u-boot.org> MIME-Version: 1.0 Message-ID-Hash: FC6IWB6A7RN7CG7UXREQNMYU7XWW6N5B X-Message-ID-Hash: FC6IWB6A7RN7CG7UXREQNMYU7XWW6N5B 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 <xypron.glpk@gmx.de>, Simon Glass <sjg@chromium.org>, Claude <noreply@anthropic.com> X-Mailman-Version: 3.3.10 Precedence: list Subject: [Concept] [PATCH 03/22] sandbox: Add --video_frames option to capture test frames List-Id: Discussion and patches related to U-Boot Concept <concept.u-boot.org> Archived-At: <https://lists.u-boot.org/archives/list/concept@u-boot.org/message/FC6IWB6A7RN7CG7UXREQNMYU7XWW6N5B/> List-Archive: <https://lists.u-boot.org/archives/list/concept@u-boot.org/> List-Help: <mailto:concept-request@u-boot.org?subject=help> List-Owner: <mailto:concept-owner@u-boot.org> List-Post: <mailto:concept@u-boot.org> List-Subscribe: <mailto:concept-join@u-boot.org> List-Unsubscribe: <mailto:concept-leave@u-boot.org> From: Simon Glass <sjg@chromium.org> Add a new --video_frames option to sandbox which accepts a directory path. When set, every video test assertion writes a BMP file (frame0.bmp, frame1.bmp, etc.) to the specified directory, allowing visual inspection of the framebuffer at each test step. A new video_write_bmp() function writes 16/32bpp framebuffer contents as Windows BMP files. On startup, any existing frame*.bmp files in the directory are removed to ensure a clean state. Usage example: ./u-boot --video_frames /tmp/frames -c "ut dm video_text" Co-developed-by: Claude <noreply@anthropic.com> Signed-off-by: Simon Glass <sjg@chromium.org> --- arch/sandbox/cpu/start.c | 22 ++++++++ arch/sandbox/include/asm/state.h | 2 + doc/arch/sandbox/sandbox.rst | 3 ++ test/dm/video.c | 86 ++++++++++++++++++++++++++++++++ 4 files changed, 113 insertions(+) diff --git a/arch/sandbox/cpu/start.c b/arch/sandbox/cpu/start.c index 559c11a2dbb..30d4f83b6ee 100644 --- a/arch/sandbox/cpu/start.c +++ b/arch/sandbox/cpu/start.c @@ -375,6 +375,15 @@ static int sandbox_cmdline_cb_video_test(struct sandbox_state *state, SANDBOX_CMDLINE_OPT_SHORT(video_test, 'V', 1, "Enable video test mode (ms delay between asserts)"); +static int sandbox_cmdline_cb_video_frames(struct sandbox_state *state, + const char *arg) +{ + state->video_frames_dir = arg; + + return 0; +} +SANDBOX_CMDLINE_OPT(video_frames, 1, "Directory to write video frames"); + static const char *term_args[STATE_TERM_COUNT] = { "raw-with-sigs", "raw", @@ -655,6 +664,19 @@ int sandbox_init(int argc, char *argv[], struct global_data *data) if (os_parse_args(state, argc, argv)) return 1; + /* Remove old frame*.bmp files if video_frames_dir is set */ + if (state->video_frames_dir) { + char pattern[256]; + int i; + + for (i = 0; i < 1000; i++) { + snprintf(pattern, sizeof(pattern), "%s/frame%d.bmp", + state->video_frames_dir, i); + if (os_unlink(pattern)) + break; + } + } + /* Detect if serial console is connected to a terminal */ state->serial_is_tty = os_isatty(1) && state->term_raw != STATE_TERM_COOKED; diff --git a/arch/sandbox/include/asm/state.h b/arch/sandbox/include/asm/state.h index fc3c39cde27..6a89f0ca5ef 100644 --- a/arch/sandbox/include/asm/state.h +++ b/arch/sandbox/include/asm/state.h @@ -178,6 +178,8 @@ struct sandbox_state { bool pager_bypass; /* Enable pager-bypass mode */ bool no_term_present; /* Assume no terminal present */ int video_test; /* ms to wait before next assert */ + const char *video_frames_dir; /* Directory to write video frames */ + int video_frame_count; /* Number of frames written */ /* Pointer to information for each SPI bus/cs */ struct sandbox_spi_info spi[CONFIG_SANDBOX_SPI_MAX_BUS] diff --git a/doc/arch/sandbox/sandbox.rst b/doc/arch/sandbox/sandbox.rst index bfc0ee70834..fc2b7c482f4 100644 --- a/doc/arch/sandbox/sandbox.rst +++ b/doc/arch/sandbox/sandbox.rst @@ -252,6 +252,9 @@ available options. Some of these are described below: -v, --verbose Show console output from tests. Normally this is suppressed. +--video_frames <dir> + Write video frames to the specified directory for debugging purposes. + -V, --video_test <ms> Enable video test mode with a delay (in milliseconds) between assertions. This allows time to examine the display during testing. diff --git a/test/dm/video.c b/test/dm/video.c index f8c126dba5c..56e63a6f5cf 100644 --- a/test/dm/video.c +++ b/test/dm/video.c @@ -4,6 +4,7 @@ * Written by Simon Glass <sjg@chromium.org> */ +#include <bmp_layout.h> #include <bzlib.h> #include <dm.h> #include <gzip.h> @@ -47,6 +48,79 @@ static int dm_test_video_base(struct unit_test_state *uts) } DM_TEST(dm_test_video_base, UTF_SCAN_PDATA | UTF_SCAN_FDT); +/** + * video_write_bmp() - Write framebuffer to BMP file + * + * This writes the current framebuffer contents to a BMP file on the host + * filesystem. Useful for debugging video tests. + * + * @uts: Test state + * @dev: Video device + * @fname: Filename to write to + * Return: 0 if OK, -ve on error + */ +static int video_write_bmp(struct unit_test_state *uts, struct udevice *dev, + const char *fname) +{ + struct video_priv *priv = dev_get_uclass_priv(dev); + struct bmp_image *bmp; + u32 width = priv->xsize; + u32 height = priv->ysize; + u32 row_bytes, bmp_size, bpp, bytes_per_pixel; + void *bmp_data; + int ret, y; + + /* Support 16bpp and 32bpp */ + switch (priv->bpix) { + case VIDEO_BPP16: + bpp = 16; + bytes_per_pixel = 2; + break; + case VIDEO_BPP32: + bpp = 32; + bytes_per_pixel = 4; + break; + default: + return -ENOSYS; + } + + /* BMP rows are padded to 4-byte boundary */ + row_bytes = ALIGN(width * bytes_per_pixel, BMP_DATA_ALIGN); + bmp_size = sizeof(struct bmp_header) + row_bytes * height; + + bmp = malloc(bmp_size); + if (!bmp) + return -ENOMEM; + + memset(bmp, 0, bmp_size); + + /* Fill in BMP header */ + bmp->header.signature[0] = 'B'; + bmp->header.signature[1] = 'M'; + bmp->header.file_size = cpu_to_le32(bmp_size); + bmp->header.data_offset = cpu_to_le32(sizeof(struct bmp_header)); + bmp->header.size = cpu_to_le32(40); + bmp->header.width = cpu_to_le32(width); + bmp->header.height = cpu_to_le32(height); + bmp->header.planes = cpu_to_le16(1); + bmp->header.bit_count = cpu_to_le16(bpp); + bmp->header.compression = cpu_to_le32(BMP_BI_RGB); + + /* Copy framebuffer data (BMP is bottom-up) */ + bmp_data = (void *)bmp + sizeof(struct bmp_header); + for (y = 0; y < height; y++) { + void *src = priv->fb + (height - 1 - y) * priv->line_length; + void *dst = bmp_data + y * row_bytes; + + memcpy(dst, src, width * bytes_per_pixel); + } + + ret = os_write_file(fname, bmp, bmp_size); + free(bmp); + + return ret; +} + int video_compress_fb(struct unit_test_state *uts, struct udevice *dev, bool use_copy) { @@ -71,6 +145,18 @@ int video_compress_fb(struct unit_test_state *uts, struct udevice *dev, if (ret) return ret; + /* Write frame to file if --video-frames option is set */ + if (state->video_frames_dir) { + char filename[256]; + + snprintf(filename, sizeof(filename), "%s/frame%d.bmp", + state->video_frames_dir, state->video_frame_count++); + ret = video_write_bmp(uts, dev, filename); + if (ret) + printf("Failed to write frame to %s: %d\n", filename, + ret); + } + /* provide a useful delay if -V flag is used or LOG_DEBUG is set */ if (state->video_test) mdelay(state->video_test); From patchwork Fri Oct 3 16:54:57 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass <sjg@u-boot.org> X-Patchwork-Id: 485 Return-Path: <concept-bounces+u-boot-concept=u-boot.org@u-boot.org> 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=1759510572; bh=HAVRWpSN1duZIIKtJML5g30oLDzLuqgyvOo6cUit5Bs=; 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=w9dP2MWPEmkzZa7zc4SW8X6vN58lVinMrt49c2BfD9bVlM5aBWIolmpQRJIv9wp+v x9swolMG8OzMTUHobBEqofjVfOPRirf52Z9exyembVMlE0b9T50Z7f1LsJiYwiTWUF 2AfWeGncisHW+cZNlMRGih/1ImYYEsA4gpjFfHVPOdsTZH+YET9mqm4crZFLoV3h2b tBl4zlSwex7yvDBpmtgWMos7W9PD92sHAPliK43nHMW+0rMXgv2KAa4rqGxhqEo9qy umoBxPLmwxwMCO5gcEgMsdMsTLF1TlctR5dYJziohuumuDqz3lDM6mTHttGeErRyX1 KMVJ/acC0m0Gw== Received: from localhost (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id A356867EBF for <u-boot-concept@u-boot.org>; Fri, 3 Oct 2025 10:56:12 -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 g0aQ6Xd-d_kM for <u-boot-concept@u-boot.org>; Fri, 3 Oct 2025 10:56:12 -0600 (MDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1759510572; bh=HAVRWpSN1duZIIKtJML5g30oLDzLuqgyvOo6cUit5Bs=; 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=w9dP2MWPEmkzZa7zc4SW8X6vN58lVinMrt49c2BfD9bVlM5aBWIolmpQRJIv9wp+v x9swolMG8OzMTUHobBEqofjVfOPRirf52Z9exyembVMlE0b9T50Z7f1LsJiYwiTWUF 2AfWeGncisHW+cZNlMRGih/1ImYYEsA4gpjFfHVPOdsTZH+YET9mqm4crZFLoV3h2b tBl4zlSwex7yvDBpmtgWMos7W9PD92sHAPliK43nHMW+0rMXgv2KAa4rqGxhqEo9qy umoBxPLmwxwMCO5gcEgMsdMsTLF1TlctR5dYJziohuumuDqz3lDM6mTHttGeErRyX1 KMVJ/acC0m0Gw== Received: from mail.u-boot.org (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id 8CAE967E95 for <u-boot-concept@u-boot.org>; Fri, 3 Oct 2025 10:56:12 -0600 (MDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1759510570; bh=HSsbpHMEZ3bn7VuoKtc0adY1Kj3gkCydBZOKKZYy0is=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=B4aSfl1lDQdcbUkDHXoWjh5RI0FKxhYqwnUKvcZjj+SbuNYW/t20fxTJmbcn1oAkF vb0HlUsQ7nUcD4LIVx6wMVgliI3qecnl+mKFB6NJoyBI+BHQmnPxqsuGk+UgqAfaIB ZboSyfP2/2yrgE4Tug9NDDYY65UbSZyOZ/Kf73bFwwyhdlXQFgcKVdKYULW47c41yM ncav5rMO9wb9K477wChITgt2cIuTHJkdXZ5fsBdBEM0c6L6ndwPBE8CqFpfBlHkcjU fbDssv6h4l8bkjAgjGlDd+/ggaEMPvBgUNtTt4WWuuWqT4spnE09OQHXtD85UxeBjn Gzg2lXjYfuyxQ== Received: from localhost (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id 3D5E967E7C; Fri, 3 Oct 2025 10:56:10 -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 1yU-d-K1Yc70; Fri, 3 Oct 2025 10:56:10 -0600 (MDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1759510562; bh=JrI/iND68VI59qDbKZ1XGRY9tQhhFauDLs6fdHn4ukI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=XgNJky26hkyn6hvVoKLh4MhucJnv3Z8bog1iyw22ydQ4CR/DxPYM5e9XEVOc+Y+2s L59Ps3wJ9GjS/6QI9zjAGVvx25AKr18U1RAFNiZBYiAWwyE1RMDxZ65P7mL2espSHf gerVdBIGz6w5HD+sOps8S/7JuI777N9/oN7B0amNEAe6W/qX5YowH4yYLeEHlMbB3v GlgHPgahIeHmKrT10yc4qxUhhVgomOT8rO3VkF3mP2DL4UayB4P5kwF+LF+2iCG0nm Y8EY8xkLMY1clvk5glPU3eNto8jzRnfN6KmH3fIhHAik3eit9/o87CLeN9CdlU227K jIEo0r3NP5yuA== Received: from u-boot.org (unknown [73.34.74.121]) by mail.u-boot.org (Postfix) with ESMTPSA id 7DA5267E12; Fri, 3 Oct 2025 10:56:02 -0600 (MDT) From: Simon Glass <sjg@u-boot.org> To: U-Boot Concept <concept@u-boot.org> Date: Fri, 3 Oct 2025 10:54:57 -0600 Message-ID: <20251003165525.440173-5-sjg@u-boot.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20251003165525.440173-1-sjg@u-boot.org> References: <20251003165525.440173-1-sjg@u-boot.org> MIME-Version: 1.0 Message-ID-Hash: FKSABE4GLJEH5JPETLQ5WEEZRYHKTRAO X-Message-ID-Hash: FKSABE4GLJEH5JPETLQ5WEEZRYHKTRAO 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 <xypron.glpk@gmx.de>, Simon Glass <sjg@chromium.org> X-Mailman-Version: 3.3.10 Precedence: list Subject: [Concept] [PATCH 04/22] sandbox: Add a comment for sandbox_sdl_get_mouse_event() List-Id: Discussion and patches related to U-Boot Concept <concept.u-boot.org> Archived-At: <https://lists.u-boot.org/archives/list/concept@u-boot.org/message/FKSABE4GLJEH5JPETLQ5WEEZRYHKTRAO/> List-Archive: <https://lists.u-boot.org/archives/list/concept@u-boot.org/> List-Help: <mailto:concept-request@u-boot.org?subject=help> List-Owner: <mailto:concept-owner@u-boot.org> List-Post: <mailto:concept@u-boot.org> List-Subscribe: <mailto:concept-join@u-boot.org> List-Unsubscribe: <mailto:concept-leave@u-boot.org> From: Simon Glass <sjg@chromium.org> This function was added without a comment. Fix it. Signed-off-by: Simon Glass <sjg@chromium.org> --- arch/sandbox/include/asm/sdl.h | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/arch/sandbox/include/asm/sdl.h b/arch/sandbox/include/asm/sdl.h index 86368c8a0a6..735652de6bd 100644 --- a/arch/sandbox/include/asm/sdl.h +++ b/arch/sandbox/include/asm/sdl.h @@ -106,6 +106,15 @@ int sandbox_sdl_sound_init(int rate, int channels); */ int sandbox_sdl_set_bpp(struct udevice *dev, enum video_log2_bpp l2bpp); +/** + * sandbox_sdl_get_mouse_event() - Read a mouse event from SDL + * + * If a mouse event has been recorded since the last call, this marked the event + * as used and then returns its. + * + * @evt: Mouse event + * ReturnL 0 if OK, -EAGAIN if there is no event available + */ int sandbox_sdl_get_mouse_event(struct mouse_event *evt); #else From patchwork Fri Oct 3 16:54:58 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass <sjg@u-boot.org> X-Patchwork-Id: 486 Return-Path: <concept-bounces+u-boot-concept=u-boot.org@u-boot.org> 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=1759510575; bh=zZt4FXYlTA98+GmejZmUxY7BhkzNQghAeVBc8+SXoeI=; 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=Y7FUOGPpoGeNbbCQoxb0m8GOAP24Gu8KcRh4Ojy9Mi1s1adMm6VgH3IUwMX+zHnxS f51lvMfpsWhH7vL1lX8hyUuQmLljo7NhWmPAlNSUeTmYvFNsXh95mbeMhN0ikOEuxC X265NAafdLVBrFh/SWVcfpsvu3pYS2lsf0wixXHXgbXXPGDGVCzPFLUYgPbXkP9b8y kamQaSkQFkCJOHn/1iOkd8bpF/uGMoFgs2Wb3/m/Ikv60N05AG0NkmlQtrfzvPo/6S o00w7wHXWzOJq8PbpKNMtH+Pai0UvGsVU1deMRtViJOqEs0lH5ckUGDZTiDlDrQxQH MDoAabK0cpnTw== Received: from localhost (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id 3E2A167E85 for <u-boot-concept@u-boot.org>; Fri, 3 Oct 2025 10:56:15 -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 laiaVpxvXtbm for <u-boot-concept@u-boot.org>; Fri, 3 Oct 2025 10:56:15 -0600 (MDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1759510573; bh=zZt4FXYlTA98+GmejZmUxY7BhkzNQghAeVBc8+SXoeI=; 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=b527wPi11F0ZLKAL0fxiMIeAcEGw0iKjGmiUBpN34J3Crvya8yRM95kujEKO7FHD2 8r6VaYJD0xjO+le/rpn4nbUJBOmlM3SVbhmByeIXSyNU7Te/Mp0LTrJl4bxxA1qaqb FSZ2ilGtV+u7KnGQCpDWR8W15zCsCypXJTgiu9xLcM2gTiDaFfgB2cx8lM7aQp5+en l3dL7ECedfneUIDn1zdvv3OD3P4aoqdacpxd8j0YHA/kMy8Sc6sK6ZvbmNXaFO265I 2qrCyumNQ/dNHkpbeYOEM051IwBuVA7iCSzmaLlI1fnPd/nMuTsHBeM4VJRHay2blp F6BYBWJhUsB1A== Received: from mail.u-boot.org (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id 3CB8267F12 for <u-boot-concept@u-boot.org>; Fri, 3 Oct 2025 10:56:13 -0600 (MDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1759510570; bh=g/7KUyRFAHby4pOlwGbUDc0xtxUOa85bVnKCJK37qVY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ZlvUWJQ0QCs6QFWZsCqHqbQAcAfP8qp9e4YGNLdMggRkTGJO1EOOhAsux7HHUuTLI PPPYp6UY5nVHvbRV1Rf4pC/b4UjsMTdb0Vx5iKuB6uVLKKPUm7dvG1jOXoq1FUPVoX lxle9ND7i/Knfcdu2BX7KvhLpN9LM4aL1PxytJx9x4OBYHjEOGNJt7nxDvqCYjZgay IikMiLYEZIrOeOWWWMFsvdJk5bxV67b8Uwi4k8R2LWN57XhkbEBp0NGJqWpn2KMvxQ 7g5SM2sy+dxt/1L5vH/TrKIJ3HoLwjPjswUzAqSQL3Ztr6VkeNZAdKTX9bhSZc3eEH eo78B8/V6tR1w== Received: from localhost (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id 6E5DA67E12; Fri, 3 Oct 2025 10:56:10 -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 B9OuEMeXRrGn; Fri, 3 Oct 2025 10:56:10 -0600 (MDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1759510567; bh=SLbszvo0PcSdtgvp1jtC9Z5+1uycuxTnIzn3caUO/Jc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=B460RdlwT4oVzbyjKovIb9xyic5A/z4ftmeEzHTFecATgUH2W84t1cnLS4vFfXlR0 FrtS+Tpjs5FBZLOdJqmKF9QqjiBtbODGmG+gta/blB+ujFIvz1wWgKrdtM2IL+XJeU Nuo7j2xO+241NxkMeLykRumoLsnhjzjvdoriiAq55VsRdVGqv4X9koAiIWCn1OPVsN WwT0BxmPMbzvbZpWtF/sPOR7r396YWmPnMEHcb/15aQwwmYNhurk0T4lm/jrWT6h1i gSCZNDPbsvDVlaNUF2ALcyZ0kk7z8hFJ4LyZbVslmGY+3miAqiBFYibPrqDN/rWKDD MD43gw51nOgGg== Received: from u-boot.org (unknown [73.34.74.121]) by mail.u-boot.org (Postfix) with ESMTPSA id 1C4E567EC7; Fri, 3 Oct 2025 10:56:07 -0600 (MDT) From: Simon Glass <sjg@u-boot.org> To: U-Boot Concept <concept@u-boot.org> Date: Fri, 3 Oct 2025 10:54:58 -0600 Message-ID: <20251003165525.440173-6-sjg@u-boot.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20251003165525.440173-1-sjg@u-boot.org> References: <20251003165525.440173-1-sjg@u-boot.org> MIME-Version: 1.0 Message-ID-Hash: XYVY6X53HTJGX5PGGOMROTLKZITXM4WR X-Message-ID-Hash: XYVY6X53HTJGX5PGGOMROTLKZITXM4WR 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 <xypron.glpk@gmx.de>, Simon Glass <sjg@chromium.org> X-Mailman-Version: 3.3.10 Precedence: list Subject: [Concept] [PATCH 05/22] video: Add a missing comment in struct video_uc_priv List-Id: Discussion and patches related to U-Boot Concept <concept.u-boot.org> Archived-At: <https://lists.u-boot.org/archives/list/concept@u-boot.org/message/XYVY6X53HTJGX5PGGOMROTLKZITXM4WR/> List-Archive: <https://lists.u-boot.org/archives/list/concept@u-boot.org/> List-Help: <mailto:concept-request@u-boot.org?subject=help> List-Owner: <mailto:concept-owner@u-boot.org> List-Post: <mailto:concept@u-boot.org> List-Subscribe: <mailto:concept-join@u-boot.org> List-Unsubscribe: <mailto:concept-leave@u-boot.org> From: Simon Glass <sjg@chromium.org> Document the cyc_active member and arrange things in the correct order. Signed-off-by: Simon Glass <sjg@chromium.org> --- drivers/video/video-uclass.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/video/video-uclass.c b/drivers/video/video-uclass.c index eaf6cf9fc71..f5cd1727fce 100644 --- a/drivers/video/video-uclass.c +++ b/drivers/video/video-uclass.c @@ -64,6 +64,7 @@ struct cyclic_info; * available address to use for a device's framebuffer. It starts at * gd->video_top and works downwards, running out of space when it hits * gd->video_bottom. + * @cyc_active: true if cyclic video sync is currently registered * @cyc: handle for cyclic-execution function, or NULL if none */ struct video_uc_priv { From patchwork Fri Oct 3 16:54:59 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass <sjg@u-boot.org> X-Patchwork-Id: 487 Return-Path: <concept-bounces+u-boot-concept=u-boot.org@u-boot.org> 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=1759510580; bh=LPuBi6KL3PfyZpY3beTZK+wlyVlFbJ0sPzcxT2sLtyA=; 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=cqKkI0HjmiAtt/BzhAVOFw1EVd7661jOszq9d3EKKeduUA85MJ6jzUVow00eUeyaC wE4bc8+h6V1Hx45bNzBbdEgmydmH3iRYPSoyppOnrM+mz7fifQlfBb2KJm7kBiG5SJ 3BMdYBrB+zsQ8ZXYXsUVyIWX8S63ax1/c4/VC/bkGYzRSXfyp3uPcOscpz/zPqyjvd SASPQ8Y1Tvf1ycKKeasDpLy2YKa4/HGEg9KzakyhqGkHOqAFtYXLusNRftVfULwHLy wmngA6ITEl77ppKKtTyUhwRjNBoF4otEtG4+2WyyuYq/46WQIRmjSRth1ZZs+lrCM8 knFWS8LtM0Xkw== Received: from localhost (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id 21B5567EBF for <u-boot-concept@u-boot.org>; Fri, 3 Oct 2025 10:56: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 CM8QbPDGL6F2 for <u-boot-concept@u-boot.org>; Fri, 3 Oct 2025 10:56:20 -0600 (MDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1759510580; bh=LPuBi6KL3PfyZpY3beTZK+wlyVlFbJ0sPzcxT2sLtyA=; 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=cqKkI0HjmiAtt/BzhAVOFw1EVd7661jOszq9d3EKKeduUA85MJ6jzUVow00eUeyaC wE4bc8+h6V1Hx45bNzBbdEgmydmH3iRYPSoyppOnrM+mz7fifQlfBb2KJm7kBiG5SJ 3BMdYBrB+zsQ8ZXYXsUVyIWX8S63ax1/c4/VC/bkGYzRSXfyp3uPcOscpz/zPqyjvd SASPQ8Y1Tvf1ycKKeasDpLy2YKa4/HGEg9KzakyhqGkHOqAFtYXLusNRftVfULwHLy wmngA6ITEl77ppKKtTyUhwRjNBoF4otEtG4+2WyyuYq/46WQIRmjSRth1ZZs+lrCM8 knFWS8LtM0Xkw== Received: from mail.u-boot.org (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id 1043967E82 for <u-boot-concept@u-boot.org>; Fri, 3 Oct 2025 10:56:20 -0600 (MDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1759510577; bh=YXWXpSI9H+yYuUiK1ZUnycK3QiXsF27f2Nf9m+Ek/18=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=PLRaFppFnNKSCnV9+FbvQ2xPq9BisqvtUBoYYz/n+1ylUHYFXWz6uIHKXyH3I1cDH BgSLKy++3xB6FZEQG6UO3To7dpUEyKVMEwQgxmRw/z6uDFjzRulbmuaMBk5SDbLfyt Jqyzk6jlXeqy6Q25tWG3zijA9JFY0apcxCjx+2Me5sN7seWVU3YweTk5DvUiZOltSI pRHOiClZSZAUApj3ugyt/J2uQma5gXNC7EKMtHMVIHKatF7LqiF0nn4lmacUFyVbLL Q0nbWsbhDusE6wRAJA7CaXKF5kLf/U3vemZlNOmemht1+SFCU2lfLQmxNPnxRTJTyD /IsVaAnH/UTbA== Received: from localhost (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id 983D867E95; Fri, 3 Oct 2025 10:56:17 -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 oKXZuAiYQNAa; Fri, 3 Oct 2025 10:56:17 -0600 (MDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1759510571; bh=LZhKreMLV3OcZFACoxDzmNntvC6vjz59SVLUAdJEu+8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=nlTYf9pyVXy/N/P4BaUSQ8T/t19u8LzzXcLkRKHaKT9VJ8YXslG/xwJoi5TZoK+m6 Am1BtPHLbq4V+CiuUooIsE7yDQzTzzXBRwQ/8nWj6OXvprFIEF9oqdFn6EqE8+kvSH ABGlFo7aKQutwghcyNP+LIkt/Z44wx7hVIyuHxEAqerE4WweFz2QL48MYfM8zNXvR5 9ueyFTbOCzQFujrL4qej0iFIHrgFmyV7qJThodNaEbePZ82PCuzfiUHC+d8n6yW2bI qa4W87umo0HLwit4eosreNRmPNnDjHFNfpjHikoY2mPRaWOV9M9K+xMEDOJbehsgNq lqFIaGP9r5a6A== Received: from u-boot.org (unknown [73.34.74.121]) by mail.u-boot.org (Postfix) with ESMTPSA id E47B567E82; Fri, 3 Oct 2025 10:56:10 -0600 (MDT) From: Simon Glass <sjg@u-boot.org> To: U-Boot Concept <concept@u-boot.org> Date: Fri, 3 Oct 2025 10:54:59 -0600 Message-ID: <20251003165525.440173-7-sjg@u-boot.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20251003165525.440173-1-sjg@u-boot.org> References: <20251003165525.440173-1-sjg@u-boot.org> MIME-Version: 1.0 Message-ID-Hash: B246GSDZ5NQ5LWGAUJWNHCM5J3EMQCBW X-Message-ID-Hash: B246GSDZ5NQ5LWGAUJWNHCM5J3EMQCBW 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 <xypron.glpk@gmx.de>, Simon Glass <sjg@chromium.org> X-Mailman-Version: 3.3.10 Precedence: list Subject: [Concept] [PATCH 06/22] video: Add a pointer image List-Id: Discussion and patches related to U-Boot Concept <concept.u-boot.org> Archived-At: <https://lists.u-boot.org/archives/list/concept@u-boot.org/message/B246GSDZ5NQ5LWGAUJWNHCM5J3EMQCBW/> List-Archive: <https://lists.u-boot.org/archives/list/concept@u-boot.org/> List-Help: <mailto:concept-request@u-boot.org?subject=help> List-Owner: <mailto:concept-owner@u-boot.org> List-Post: <mailto:concept@u-boot.org> List-Subscribe: <mailto:concept-join@u-boot.org> List-Unsubscribe: <mailto:concept-leave@u-boot.org> From: Simon Glass <sjg@chromium.org> When the mouse is being used we need a suitable pointer image to draw on the display. Add the RISC OS pointer, in honour of the first GUI available on ARM devices. Signed-off-by: Simon Glass <sjg@chromium.org> --- drivers/video/images/Makefile | 3 +++ drivers/video/images/riscos_arrow.bmp | Bin 0 -> 3798 bytes test/dm/video.c | 3 ++- 3 files changed, 5 insertions(+), 1 deletion(-) create mode 100644 drivers/video/images/riscos_arrow.bmp index 56e63a6f5cf..6c96eee1b8b 100644 diff --git a/drivers/video/images/Makefile b/drivers/video/images/Makefile index 9b0d85cd2c8..9019b36c918 100644 --- a/drivers/video/images/Makefile +++ b/drivers/video/images/Makefile @@ -3,6 +3,9 @@ # Copyright 2025 Simon Glass <sjg@chromium.org> obj-$(CONFIG_VIDEO_LOGO) += u_boot.o +ifdef CONFIG_MOUSE +obj-$(CONFIG_EXPO) += riscos_arrow.o +endif ifdef CONFIG_$(PHASE_)GENERATE_ACPI_TABLE obj-y += bgrt.o diff --git a/drivers/video/images/riscos_arrow.bmp b/drivers/video/images/riscos_arrow.bmp new file mode 100644 index 0000000000000000000000000000000000000000..5327bfd9b5438b8711e11f353903085808cd000c GIT binary patch literal 3798 zcmeH~O-LI-7>3`(7JnM6XehSyu!kr;=%p3$7}J6X3L#qX@6g?ii9&V_y9r)A3SNaC z`g5sm554r<UVG@ZP!Mbj#k=51v6mw2JF|(2#`V(KgC#>|=jEIEo|*aPCroN;_cml2 z;r9WvR>=|cQ8C4U-dle54S?57%?LCj@P9^tr#rj@4o}=3A@L>ry7I5r;4dtq^1)x& zC*klbTSYmX_d=D)F3x@`w|yP<9ADMRx{U94BxdpNy#({wOQ?JW@PPGIGjjh=<+Avw z8F>I-CA=X%is9$^>fv?#P~cU5Sa8V?5zZ?ux?M0W_eK)1?2?liPieDr^IGdZ+R=kM zxQlMxbc<u@^kntT&{+Q2MMPM4h6Jmz{z^+{cF8q?h{je)v*?tlpHYvjm5M^Yq>h`* zdY1Yl^`OH6QvVco!`BBw=cSHPBJRv&9&>JSYAs)<jXG^EI~LmvvrQsv+2luOeVrA0 zU1+ON=GbHsGmI_SPp4TXnD1j86PQAp4=n>_te}7rhFIFPxX7?R72tnQ`lsn-&}#)I zJ)U3{7If(ku?B3zREw>fd-PD6BC!;3bI<dR`hnKxz{!^9{eA0sC+~ok-@q5U=D)fP zj2_dzRkJ1D09_lvr>`}e@dEg~3H1Fc>W(h^Y2i1T%K?WUfX+F-9KQn{3x3>KC+hM3 e2Qb4}O@0Gjy#@yIWG@EHyNwQKal5ijC4Q$t=#ZTN literal 0 HcmV?d00001 diff --git a/test/dm/video.c b/test/dm/video.c --- a/test/dm/video.c +++ b/test/dm/video.c @@ -1211,9 +1211,10 @@ static int dm_test_video_images(struct unit_test_state *uts) ut_assert_nextline("Name Size"); ut_assert_nextline("-------------------- ----------"); ut_assert_nextline("bgrt 43926"); + ut_assert_nextline("riscos_arrow 3798"); ut_assert_nextline("u_boot 6932"); ut_assert_skip_to_line(""); - ut_assert_nextline("Total images: 2"); + ut_assert_nextline("Total images: 3"); ut_assert_console_end(); return 0; From patchwork Fri Oct 3 16:55:00 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass <sjg@u-boot.org> X-Patchwork-Id: 488 Return-Path: <concept-bounces+u-boot-concept=u-boot.org@u-boot.org> 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=1759510582; bh=5JZL6fwoTiGqmfjIsWT99YDrhOx62JxdS/HjhC8aCho=; 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=ktvhTzMGTQy6FnYRI+F6SO77YTr8wmNKU9KwNee8VOnISDj4A4yPVg3Ho/I8wrpFM 2VKR3kcmwtxVm0gMOuBNqksCuIBO/0ghMZjLaTqqjRg15L7ElFLIU0veW1zyfS/sij KsZjYdDSw4czGpOKYrV2TvaLtIAIOvfi82D9jsFMbEe8RWndg11TqIomQ8dn5LXCTs 8Tjf2cd9EX0d4ge9IyqdESQP61lEb5gziQaDHX45byVg2O5Nsh5X7SQkS37iDHueIu HZWA3TbMBcIv/PheomrEu6QggPiZzHxSFK3t3C3obB5SnfDXuin7qIONzAYGMtHW6K /M6kALdY/bH/g== Received: from localhost (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id 8849967EC0 for <u-boot-concept@u-boot.org>; Fri, 3 Oct 2025 10:56:22 -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 Y2s_eGMzkMGY for <u-boot-concept@u-boot.org>; Fri, 3 Oct 2025 10:56:22 -0600 (MDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1759510580; bh=5JZL6fwoTiGqmfjIsWT99YDrhOx62JxdS/HjhC8aCho=; 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=NZWbhzWPwev9Ybz8xDqSFAMxmqM6IrfltZ9Def61NjPg13KwaLccYm7rrxjy/tw92 8dnfty8jSEXt6T1wK/L0scX8/MPbpV0Kd2TBv2Ujx0sCbIrhJauTbSNk3q7t6Ziw5y /2WgGtkh2btTX7J752LZPFz3Grf58klwJQT5ZYzwymPkl+EmjN62RfPLX72RFTovvI aPUgKAEQDfWAQorgcKwry4bl+ZL2g2n6Eh5uNbPOoMi0bbRkR8KV5dZpxv/UV2vyYB Ouv0QubXHZnRZzKAQU/3lGaUrRBa/BtJ3lG++rfNwMsIFn9Q6M83NbQQhzeIJUoIBm 2BbRpZZ2cFSHg== Received: from mail.u-boot.org (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id 9EB2B67F2F for <u-boot-concept@u-boot.org>; Fri, 3 Oct 2025 10:56:20 -0600 (MDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1759510577; bh=XfUFZY1evZ+7WuIeawglWdAEJq0KtARA67XgcmQc0bc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Zm28xQB8wasQbkj76em4duLNmUURoT3gHvJB+iXkFh4zX768cJ78CRRuIWnCzrIod IUBMyGXLrFhFH+68liB9/tylZBX63izWCc8deUKnOYM80EnUpRjuFovQ9o656vjngW I01XH9SRTlY/i3EfY1jk5YAYdh0M/MvtIx0wI1KM+Sy5TyWRkvG8tGvc7O84MGzD4h WzlsGGLK5jBaFqWWjtWNmOf5MYZODRUf8FVDbHAxWmd5PEjrLO07oR4Ln+Moug0ECl l+Oqlc0ZHjW7Lw4gz9vKCjpjAOUQMMkQpcau9nd/ZJBliIzQ7N2CBfUY3MFKrVDFOW 1766NwIjudxRg== Received: from localhost (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id A18C067EBD; Fri, 3 Oct 2025 10:56:17 -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 sgt2TRMFRlNw; Fri, 3 Oct 2025 10:56:17 -0600 (MDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1759510575; bh=/SVaoLnjeYcLLGhEVooF3NjJn5rO6SdJoBkQ+HmXebA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=QnbcxMubsTmcIs7YYoiZQ0Qnp+QUhTfTBWo9X9jh32vcCuw9vXYq1MbRFarJwIbpZ MlOfErtbwbLD6xifYuZCYOv+YlikLiu06rehSmRRgGJ2x7z+qdnlv0WGnE8uG/Tif0 HXk/CFzuT+1I1812XgeVohoZkDGuDi9hkfjLn9tyO7HE0OYebCmefWYVCnKvIWF6CB C2YIm4HoSrOwWShNT0Yp37P+ZTP9WKnpI8XQO4LvccfPyPUF0l1lnKlFAY0ECmbNE7 zqeAYYgSoPQswixB0375WDCEFKnlYc02FQc5sUuIk5+QsA8WSH7EQhehkGdnXA6nYk xlPAtR038R0LA== Received: from u-boot.org (unknown [73.34.74.121]) by mail.u-boot.org (Postfix) with ESMTPSA id 8753967F3E; Fri, 3 Oct 2025 10:56:15 -0600 (MDT) From: Simon Glass <sjg@u-boot.org> To: U-Boot Concept <concept@u-boot.org> Date: Fri, 3 Oct 2025 10:55:00 -0600 Message-ID: <20251003165525.440173-8-sjg@u-boot.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20251003165525.440173-1-sjg@u-boot.org> References: <20251003165525.440173-1-sjg@u-boot.org> MIME-Version: 1.0 Message-ID-Hash: KDPKD4PO6TQQQUDA5QSGF4DFX5CQRM3J X-Message-ID-Hash: KDPKD4PO6TQQQUDA5QSGF4DFX5CQRM3J 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 <xypron.glpk@gmx.de>, Simon Glass <sjg@chromium.org> X-Mailman-Version: 3.3.10 Precedence: list Subject: [Concept] [PATCH 07/22] video: Check drawing the mouse pointer List-Id: Discussion and patches related to U-Boot Concept <concept.u-boot.org> Archived-At: <https://lists.u-boot.org/archives/list/concept@u-boot.org/message/KDPKD4PO6TQQQUDA5QSGF4DFX5CQRM3J/> List-Archive: <https://lists.u-boot.org/archives/list/concept@u-boot.org/> List-Help: <mailto:concept-request@u-boot.org?subject=help> List-Owner: <mailto:concept-owner@u-boot.org> List-Post: <mailto:concept@u-boot.org> List-Subscribe: <mailto:concept-join@u-boot.org> List-Unsubscribe: <mailto:concept-leave@u-boot.org> From: Simon Glass <sjg@chromium.org> Add some simple tests for drawing the mouse pointer on a white and black background. Signed-off-by: Simon Glass <sjg@chromium.org> --- test/dm/video.c | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) diff --git a/test/dm/video.c b/test/dm/video.c index 6c96eee1b8b..a802228b790 100644 --- a/test/dm/video.c +++ b/test/dm/video.c @@ -667,6 +667,35 @@ static int dm_test_video_comp_bmp8(struct unit_test_state *uts) } DM_TEST(dm_test_video_comp_bmp8, UTF_SCAN_PDATA | UTF_SCAN_FDT); +/* Test drawing the riscos pointer */ +static int dm_test_video_bmp_alpha(struct unit_test_state *uts) +{ + struct video_priv *priv; + struct udevice *dev; + ulong addr; + + ut_assertok(video_get_nologo(uts, &dev)); + priv = dev_get_uclass_priv(dev); + addr = map_to_sysmem(video_image_getptr(riscos_arrow)); + + /* Draw a black rectangle first */ + video_draw_box(dev, 100, 100, 200, 200, 0, + video_index_to_colour(priv, VID_BLACK), true); + + /* Draw the pointer on top of the black rectangle */ + ut_assertok(video_bmp_display(dev, addr, 110, 110, false)); + ut_asserteq(174, video_compress_fb(uts, dev, false)); + ut_assertok(video_check_copy_fb(uts, dev)); + + /* Draw the pointer on top of the black rectangle */ + ut_assertok(video_bmp_display(dev, addr, 350, 110, false)); + ut_asserteq(249, video_compress_fb(uts, dev, false)); + ut_assertok(video_check_copy_fb(uts, dev)); + + return 0; +} +DM_TEST(dm_test_video_bmp_alpha, UTF_SCAN_PDATA | UTF_SCAN_FDT); + /* Test TrueType console */ static int dm_test_video_truetype(struct unit_test_state *uts) { From patchwork Fri Oct 3 16:55:01 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass <sjg@u-boot.org> X-Patchwork-Id: 489 Return-Path: <concept-bounces+u-boot-concept=u-boot.org@u-boot.org> 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=1759510587; bh=X1Vx7misU03e1Hfa0G73CmM49kJdS+ituPdz9dJk75I=; 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=FljbNOxtCjUxaXThVU0b2day43g6bSibBa3+C9W4UnFhGmoBR9oOjDzwXzSWi+SSM qHVEMN3hZw6BGYJTXqHWwPwbC5BadOWnmv6UysLMVtlKBja8G2xn+u/hT5q26kYkI/ O7mC44yN4qtZsiOdbhoQ0ZERKo5AqPD2kguH+/gYLiLt2HcH/8sRkqmoHGQWJzyl1W uvXXw+OBnCcwa+4t+WHQo1ULcC5eT8cNZMFEY7NMk8DBjx2+ZRfS9tDWNzFfawiiEL SGeLXdCd3G4vFQYaGCPZQebwpa24Swgom1UBPAFHpSjNJ2WZHYLeCRh8Nv5pIJLz8H ENMPSMqpAv9hw== Received: from localhost (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id 3951D67EC5 for <u-boot-concept@u-boot.org>; Fri, 3 Oct 2025 10:56: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 10024) with ESMTP id Naq-zlrdx1wX for <u-boot-concept@u-boot.org>; Fri, 3 Oct 2025 10:56:27 -0600 (MDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1759510587; bh=X1Vx7misU03e1Hfa0G73CmM49kJdS+ituPdz9dJk75I=; 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=FljbNOxtCjUxaXThVU0b2day43g6bSibBa3+C9W4UnFhGmoBR9oOjDzwXzSWi+SSM qHVEMN3hZw6BGYJTXqHWwPwbC5BadOWnmv6UysLMVtlKBja8G2xn+u/hT5q26kYkI/ O7mC44yN4qtZsiOdbhoQ0ZERKo5AqPD2kguH+/gYLiLt2HcH/8sRkqmoHGQWJzyl1W uvXXw+OBnCcwa+4t+WHQo1ULcC5eT8cNZMFEY7NMk8DBjx2+ZRfS9tDWNzFfawiiEL SGeLXdCd3G4vFQYaGCPZQebwpa24Swgom1UBPAFHpSjNJ2WZHYLeCRh8Nv5pIJLz8H ENMPSMqpAv9hw== Received: from mail.u-boot.org (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id 2323067E85 for <u-boot-concept@u-boot.org>; Fri, 3 Oct 2025 10:56:27 -0600 (MDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1759510584; bh=Ep6M+OJ9zcgVutrKS/LfLoK/H4HYKoy3tSUPkrinFNQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=m4dp1CqAPtusPSky3qmuGx7leiikf3vNMfE2ttDH3wHjU/B70uHV5Ozz3DlNkCIo/ nV62k8nhFNdj5Nx13vRXK04x0eqmof5xagrkgeedV6nPcdDpqt4f7yKxtqxWDizjM7 uQqV33u7bPBxi8lrry2e7J+DqHajNqg2JehGmDTOJ8IOtoGrmcogcjKf9hEuIZkKoO yjdVgDYm/bc2wtHC4x0Q+Kfa/2tH+yUqAuVsN7hXme9sjW4qKFAnAf2UuaL7QaqFp0 BHNAdts5MjtXzMRzv7zrvusxeVRlLk2UmSbCzTmgjzMcjwKznjaz2meZru5XeDmylx q3TsdkWoApMgw== Received: from localhost (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id E754C67E7C; Fri, 3 Oct 2025 10:56:24 -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 DAqnkSxeOyGV; Fri, 3 Oct 2025 10:56:24 -0600 (MDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1759510577; bh=1MfsyGk1rfHCdR9XeKODt145cRS5OXbdVqqH63iq1cI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=NTGROvrhx5q1/kogIkFtR3tkCrWGA4zv88ugYYrzHbDU1yPev83t4tQo5aAxsyJGN OcA1Vuvy8hvhBhFYa3r0DnP09G8KuJGdqrex67xZ+rcbrllckNxzWlP4hIUaEUqHng 5zqheIH2Fgo3iLtij1dgJEEiCBfTAXub9d5hyWGTrIrHI0GITQZhgoFJPT6YAv0pBN krKgcHm4AlGhTfynRlxgH6uPHN7RX+0rLFtfkKjVaJUffyJXoirOLHmQgJcESPtQxU 8fsW27zldlBmxbW6d3mZpEedDaZFwkdNlBz4uM8tW/kSIhiL8fOg06lN7DZW+HndrT wPjHjfuEtUMdw== Received: from u-boot.org (unknown [73.34.74.121]) by mail.u-boot.org (Postfix) with ESMTPSA id 8170C67E85; Fri, 3 Oct 2025 10:56:17 -0600 (MDT) From: Simon Glass <sjg@u-boot.org> To: U-Boot Concept <concept@u-boot.org> Date: Fri, 3 Oct 2025 10:55:01 -0600 Message-ID: <20251003165525.440173-9-sjg@u-boot.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20251003165525.440173-1-sjg@u-boot.org> References: <20251003165525.440173-1-sjg@u-boot.org> MIME-Version: 1.0 Message-ID-Hash: OSTUPOJI54MHWAV6J2GSZVFSCFDAJZWA X-Message-ID-Hash: OSTUPOJI54MHWAV6J2GSZVFSCFDAJZWA 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 <xypron.glpk@gmx.de>, Simon Glass <sjg@chromium.org> X-Mailman-Version: 3.3.10 Precedence: list Subject: [Concept] [PATCH 08/22] video: Move setting of cte in write_pix8() to the top List-Id: Discussion and patches related to U-Boot Concept <concept.u-boot.org> Archived-At: <https://lists.u-boot.org/archives/list/concept@u-boot.org/message/OSTUPOJI54MHWAV6J2GSZVFSCFDAJZWA/> List-Archive: <https://lists.u-boot.org/archives/list/concept@u-boot.org/> List-Help: <mailto:concept-request@u-boot.org?subject=help> List-Owner: <mailto:concept-owner@u-boot.org> List-Post: <mailto:concept@u-boot.org> List-Subscribe: <mailto:concept-join@u-boot.org> List-Unsubscribe: <mailto:concept-leave@u-boot.org> From: Simon Glass <sjg@chromium.org> The compiler can deal with the complexity of deciding whether to set up this local. Move it to the top of the function. Signed-off-by: Simon Glass <sjg@chromium.org> --- drivers/video/video_bmp.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/video/video_bmp.c b/drivers/video/video_bmp.c index 478b8fbe5fd..390996dbaf1 100644 --- a/drivers/video/video_bmp.c +++ b/drivers/video/video_bmp.c @@ -68,14 +68,14 @@ static u32 get_bmp_col_rgba8888(struct bmp_color_table_entry *cte) static void write_pix8(u8 *fb, uint bpix, enum video_format eformat, struct bmp_color_table_entry *palette, u8 *bmap) { + struct bmp_color_table_entry *cte = &palette[*bmap]; + if (bpix == 8) { *fb++ = *bmap; } else if (bpix == 16) { - *(u16 *)fb = get_bmp_col_16bpp(palette[*bmap]); + *(u16 *)fb = get_bmp_col_16bpp(*cte); } else { /* Only support big endian */ - struct bmp_color_table_entry *cte = &palette[*bmap]; - if (bpix == 24) { *fb++ = cte->red; *fb++ = cte->green; From patchwork Fri Oct 3 16:55:02 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass <sjg@u-boot.org> X-Patchwork-Id: 490 Return-Path: <concept-bounces+u-boot-concept=u-boot.org@u-boot.org> 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=1759510589; bh=MO1Ijw8DkZ4fbKkYJ5LL9pNR1NGwyLeo4RWQmiQacvk=; 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=R4HT+YxFQFMjiiXjQtH1OKCgt5Y51Y4NLQerto3ccUTME2/AoSQG/YRVo91lg/vpL kIaGl1uETalS3xP8EAT9EkRVJUyFcbDIyTW6SbVQWJ1LhEfcn2KgYtoK5i3byRbcWC PYIdLP6UlDJftjN2NHUUwSr8EOVbR+F3JBkifdsLXLKThKAl/o8LOpfZcji9Sj4Rve 5jKCO/awBa1MHZMS/fNBcXzGI/S1H+lOY+YmFBm70aE05TRnhV5EB+/amgb+/w/qpI V/e+VwRKK6b6foadPqfBpChvXhLjTDvmu8MDN8b6jJIWVCvXmfuIAVLD2B67kj3IwX Id86+/JNbz4yA== Received: from localhost (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id 9D0B567ECA for <u-boot-concept@u-boot.org>; Fri, 3 Oct 2025 10:56: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 LEHf3-tLlQ1Z for <u-boot-concept@u-boot.org>; Fri, 3 Oct 2025 10:56:29 -0600 (MDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1759510587; bh=MO1Ijw8DkZ4fbKkYJ5LL9pNR1NGwyLeo4RWQmiQacvk=; 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=eSx3ZqHr96FeN6i+96SbUWYUdcg6wuvbCEAIPFEhj4mDJqTlc43raLVMHXT/dTDw1 0ZmuQHwIOlbHuEPQMOvujBiyP0APRWKgCdDPrnq0fG+F8FIrJxEXUKgQhFKVazlL6J HVy6MzznoSzKlALaBKJVyHtShTV0CXQ7HZ8KYrxauFPIGvwJBtcj5T58cSTE4ahZPN sbA27Vew2rEprfnRLhw/s7eQZMUVi80uvg8om0tTDp//JDIvCXoCGG3vx8gWIavhDm stjqdjaiK4ZHOhgQLVLTwJDZhtx0f+/Mpz6lLFDORjir5g6FoWxGLnf9IZl0b80Mn5 pi4sXQlwpRBxQ== Received: from mail.u-boot.org (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id DE90E67EBD for <u-boot-concept@u-boot.org>; Fri, 3 Oct 2025 10:56:27 -0600 (MDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1759510584; bh=MZ5hJPx9pKqFg7uT2y0+9vXvBpvehAJ6twmO3gaXc5A=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=HPStRUtEsoKW6XeIMKlZqkKs33hxYTpa2i8pKkwBzIRowIxWMBnNuKWOSe2VhtqkT 5bam6gjvyB8JeuIU/6uo4tRVyg+NpIeaseFdHP5Br28hCD8PbLkoyvQFVByq6go1Sn P5QepUO+fiBnXvPWSqFJ22bpILqBiSd1PtZSs83DmGaF9iebT2ATTWszlTJaKEmpZ7 AueCCkj4ZYAxekM0z+6rIQD2fhTETlEccMgMOMdBCsShBtnpSDcsV1+I6ASR7P0O/B ohCp1SI3IyNaS42xyoNw7oRT3nSaHovJYxDUXsO1KHdxX39krz0s3WsXL8g8O+udx0 /WxP25o6E7ZZw== Received: from localhost (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id E756067E82; Fri, 3 Oct 2025 10:56:24 -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 qz4TBfmPJ4Gr; Fri, 3 Oct 2025 10:56:24 -0600 (MDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1759510582; bh=ziOrz40g0tu3JXCwy9iGNPcXvpHMLxCCJSRt5ubdXZ4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=YlsIEttR4phehF46jSq4gYL+K9iPj4G0oaY+vpE2utWfjXlm2HSOWlQvhOwUqqRiU tx+xuPAxNoNO47CnZ9kVW1scJxOG6xnmkVpVnQUUxufb6xUh3V+9W5yIUSMztFs8c6 v7Z6xtMsEbeKg6i+wMVnP/sJgQX+x8Pc0AMxDirPWQGf4fWIrOa9Ercd0OJ5iEMjoM gI5ufYlQuw8RpkOV653fNXMoG8NPzHx5Pm912H67BQhLtqJPUcwKBwdG+LzYJYa38N a4lmGkdwHErPGp9u2kXjZTiRfAx1d3yaTbfE/FlI4eB8pw9zxfU6VcHVoxL54wcJlP ePUoEm5vyePNg== Received: from u-boot.org (unknown [73.34.74.121]) by mail.u-boot.org (Postfix) with ESMTPSA id 19DD067EC7; Fri, 3 Oct 2025 10:56:22 -0600 (MDT) From: Simon Glass <sjg@u-boot.org> To: U-Boot Concept <concept@u-boot.org> Date: Fri, 3 Oct 2025 10:55:02 -0600 Message-ID: <20251003165525.440173-10-sjg@u-boot.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20251003165525.440173-1-sjg@u-boot.org> References: <20251003165525.440173-1-sjg@u-boot.org> MIME-Version: 1.0 Message-ID-Hash: FDX43HLJ7LMXDSX6OXUDSU5MQ6ZUNGME X-Message-ID-Hash: FDX43HLJ7LMXDSX6OXUDSU5MQ6ZUNGME 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 <xypron.glpk@gmx.de>, Simon Glass <sjg@chromium.org> X-Mailman-Version: 3.3.10 Precedence: list Subject: [Concept] [PATCH 09/22] video: Support transparency in the inner bmp functions List-Id: Discussion and patches related to U-Boot Concept <concept.u-boot.org> Archived-At: <https://lists.u-boot.org/archives/list/concept@u-boot.org/message/FDX43HLJ7LMXDSX6OXUDSU5MQ6ZUNGME/> List-Archive: <https://lists.u-boot.org/archives/list/concept@u-boot.org/> List-Help: <mailto:concept-request@u-boot.org?subject=help> List-Owner: <mailto:concept-owner@u-boot.org> List-Post: <mailto:concept@u-boot.org> List-Subscribe: <mailto:concept-join@u-boot.org> List-Unsubscribe: <mailto:concept-leave@u-boot.org> From: Simon Glass <sjg@chromium.org> Provide an alpha and acol parameter to control whether transparency is used. For now alpha is always false so this does nothing. Make the current video_bmp_display() an internal static function and add a new video_bmp_display() to call it. Signed-off-by: Simon Glass <sjg@chromium.org> --- drivers/video/video_bmp.c | 43 ++++++++++++++++++++++++++------------- 1 file changed, 29 insertions(+), 14 deletions(-) diff --git a/drivers/video/video_bmp.c b/drivers/video/video_bmp.c index 390996dbaf1..4c9157486cb 100644 --- a/drivers/video/video_bmp.c +++ b/drivers/video/video_bmp.c @@ -64,9 +64,12 @@ static u32 get_bmp_col_rgba8888(struct bmp_color_table_entry *cte) * @bmap: Pointer to BMP bitmap position to write. This contains a single byte * which is either written directly (bpix == 8) or used to look up the * palette to get a colour to write + * @alpha: Enable alpha transparency + * @acol: Alpha color (RGB888 format) */ static void write_pix8(u8 *fb, uint bpix, enum video_format eformat, - struct bmp_color_table_entry *palette, u8 *bmap) + struct bmp_color_table_entry *palette, u8 *bmap, + bool alpha, u32 acol) { struct bmp_color_table_entry *cte = &palette[*bmap]; @@ -96,12 +99,12 @@ static void write_pix8(u8 *fb, uint bpix, enum video_format eformat, static void draw_unencoded_bitmap(u8 **fbp, uint bpix, enum video_format eformat, uchar *bmap, struct bmp_color_table_entry *palette, - int cnt) + int cnt, bool alpha, u32 acolour) { u8 *fb = *fbp; while (cnt > 0) { - write_pix8(fb, bpix, eformat, palette, bmap++); + write_pix8(fb, bpix, eformat, palette, bmap++, alpha, acolour); fb += bpix / 8; cnt--; } @@ -110,12 +113,12 @@ static void draw_unencoded_bitmap(u8 **fbp, uint bpix, static void draw_encoded_bitmap(u8 **fbp, uint bpix, enum video_format eformat, struct bmp_color_table_entry *palette, u8 *bmap, - int cnt) + int cnt, bool alpha, u32 acolour) { u8 *fb = *fbp; while (cnt > 0) { - write_pix8(fb, bpix, eformat, palette, bmap); + write_pix8(fb, bpix, eformat, palette, bmap, alpha, acolour); fb += bpix / 8; cnt--; } @@ -126,7 +129,8 @@ static void video_display_rle8_bitmap(struct udevice *dev, struct bmp_image *bmp, uint bpix, struct bmp_color_table_entry *palette, uchar *fb, int x_off, int y_off, - ulong width, ulong height) + ulong width, ulong height, bool alpha, + u32 acolour) { struct video_priv *priv = dev_get_uclass_priv(dev); uchar *bmap; @@ -178,7 +182,8 @@ static void video_display_rle8_bitmap(struct udevice *dev, cnt = runlen; draw_unencoded_bitmap( &fb, bpix, eformat, - bmap, palette, cnt); + bmap, palette, cnt, + alpha, acolour); } x += runlen; } @@ -204,7 +209,8 @@ static void video_display_rle8_bitmap(struct udevice *dev, cnt = runlen; draw_encoded_bitmap(&fb, bpix, eformat, palette, &bmap[1], - cnt); + cnt, alpha, + acolour); } x += runlen; } @@ -252,8 +258,8 @@ void video_bmp_get_info(const void *bmp_image, ulong *widthp, ulong *heightp, *bpixp = get_unaligned_le16(&bmp->header.bit_count); } -int video_bmp_display(struct udevice *dev, ulong bmp_image, int x, int y, - bool align) +static int draw_bmp(struct udevice *dev, ulong bmp_image, int x, int y, + bool align, bool alpha, u32 acolour) { struct video_priv *priv = dev_get_uclass_priv(dev); int i, j; @@ -337,8 +343,10 @@ int video_bmp_display(struct udevice *dev, ulong bmp_image, int x, int y, &bmp->header.compression); debug("compressed %d %d\n", compression, BMP_BI_RLE8); if (compression == BMP_BI_RLE8) { - video_display_rle8_bitmap(dev, bmp, bpix, palette, fb, - x, y, width, height); + video_display_rle8_bitmap(dev, bmp, bpix, + palette, fb, x, y, + width, height, alpha, + acolour); break; } } @@ -351,9 +359,10 @@ int video_bmp_display(struct udevice *dev, ulong bmp_image, int x, int y, for (i = 0; i < height; ++i) { schedule(); for (j = 0; j < width; j++) { - write_pix8(fb, bpix, eformat, palette, bmap); - bmap++; + write_pix8(fb, bpix, eformat, palette, bmap, + alpha, acolour); fb += bpix / 8; + bmap++; } bmap += (padded_width - width); fb -= byte_width + priv->line_length; @@ -462,3 +471,9 @@ int video_bmp_display(struct udevice *dev, ulong bmp_image, int x, int y, return video_sync(dev, false); } + +int video_bmp_display(struct udevice *dev, ulong bmp_image, int x, int y, + bool align) +{ + return draw_bmp(dev, bmp_image, x, y, align, false, 0); +} From patchwork Fri Oct 3 16:55:03 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass <sjg@u-boot.org> X-Patchwork-Id: 492 Return-Path: <concept-bounces+u-boot-concept=u-boot.org@u-boot.org> 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=1759510598; bh=w2+FvHpBRlhZgicb0TGvJWyMXMoARKJHacBWRi7siOc=; 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=Ml3IyY/EhPCvKfyy9PCS8dyHfWpnJKtafUQxMhRDMKDwYk+NtUXH0Jv39xQOJPNdv ykA1PgXiDCBMUsKnb4k8iBBCyBMzFW2m3VPOR/1JmetlnxFrcU2TUYGkjCv8UsFDE/ K5FSmBoziBcS9XUt/WJjxF1B+EPPzuTgqcaaZEYrHujfgb+Bq/TlJ1IguU4A4cjIio 2Fsu+aUlzYFTVZK197YyGTLYKFh6kDsMdTi101QlmCVFOTen9DbnmKqJOAF5cBZnRg T6xXJHo8ReB6S0bleDiEBfIUcPkAe1nhwZYWm2EbELX3kdtI5sunn6sF1z8ZhTFuTz AKAmjUg5tmdig== Received: from localhost (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id 79D0067E85 for <u-boot-concept@u-boot.org>; Fri, 3 Oct 2025 10:56: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 CVJOToihneEw for <u-boot-concept@u-boot.org>; Fri, 3 Oct 2025 10:56:38 -0600 (MDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1759510596; bh=w2+FvHpBRlhZgicb0TGvJWyMXMoARKJHacBWRi7siOc=; 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=QUG+gkcrMEcTMpd3P7VartjokmoZ7h0B3RuzQzn1RE2uF7OlH5L4998IbsFsllnD+ zQz/RP5uO+W1vPtsjgDCUPVNQo1q4e7J0BaD4WJj+BayV6UKfk+8/+vgLHiaIlHOQ+ MFmayavVdpzw573UYw0eiDu+vAsoSb8EfQNIlKMgPAhzPVp12sAAVY9aXKex96i9xn 4BVBhviPgpl0e0iBbYuSoOp+V+vaP9zxUWm1rLym9HUZ2hTepuAEovYS9iEBIoeq2o RFFlhEH/wveb+GUKJ+SKd2VqB8pH4dCVFeTuwIZYAaysdKVWsSnbDTdoaPZYK5XDlH 5JSIJKrU86imw== Received: from mail.u-boot.org (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id 7237367E83 for <u-boot-concept@u-boot.org>; Fri, 3 Oct 2025 10:56:36 -0600 (MDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1759510592; bh=oiEieHjW3oCWuxPQm6ATqMeq38XwSc8+/Ft7A5HGH9s=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ql6Ql/8svPKSdkRgZ3bV3H2Pf9+C9FQQddHD6P8UGZWWoGeLcjIL8inmjsM9oW/dy I6lgVB7x+SzkVkmEECbV4squROzanujny5PyIbKc+RlUP6HYE0bjFonHWHYgvJglCY CMw80PAmRoVXKdeWwXHo3HsiGxGWCYxN6jVHmEsr6t/OQWd721R2r/n1JTslaDEsqQ K+ynmh6HbU/9SZXtqT6AOow0FtsPTFoqHZYt9VxIzKO3BRBc06nTTnxfLwlVHu5mJq ejfKs3gVdjLtvY1vdWmCahfz1zWrdyz/B9DzMDRMLL80BC6hexZVDKlJzGwGLmnDV0 kr6+JfpNjzyKQ== Received: from localhost (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id 0115767E83; Fri, 3 Oct 2025 10:56:32 -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 8p2eYgoI03wQ; Fri, 3 Oct 2025 10:56:31 -0600 (MDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1759510584; bh=s8qquht7U8qK45FppyvqjT6oVHztXFhN+bwSAxx+OqM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=XLu6sp0Vq86yH8lGvpYwvbKh22K9+Y77dEv8HVeJG4wynOo3gWtC7vmoKRonZ7352 HzcwrcY2OfgPBzO2GyzahPbGp2/rbFLOzHeALZlSRABewRx0NxjVelM57gegnlYuJu CLDmOVBQqlCgNTA14yVvdsBC0JmLNg7OEWCg6J7pmbka0YaPmoeTerBGI0pXH0EqCT OExTz1m4FFQjMP/VioeRL5tl10KCaP+cF/BYiZh+MkUWMFT6aXKBk+Jkzy5XSQb+tq OEspwQ0zfxwcTBzab6+Mt8thZ2QwdDIP9uB4NcVLhVn3OFxt8Fe+OeVRtJV+jdli0i wqvZBU6FSce8A== Received: from u-boot.org (unknown [73.34.74.121]) by mail.u-boot.org (Postfix) with ESMTPSA id 3591A67E12; Fri, 3 Oct 2025 10:56:24 -0600 (MDT) From: Simon Glass <sjg@u-boot.org> To: U-Boot Concept <concept@u-boot.org> Date: Fri, 3 Oct 2025 10:55:03 -0600 Message-ID: <20251003165525.440173-11-sjg@u-boot.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20251003165525.440173-1-sjg@u-boot.org> References: <20251003165525.440173-1-sjg@u-boot.org> MIME-Version: 1.0 Message-ID-Hash: MOP2DWTKTQNBOOO2G5R4P6WMJZDVSULR X-Message-ID-Hash: MOP2DWTKTQNBOOO2G5R4P6WMJZDVSULR 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 <xypron.glpk@gmx.de>, Simon Glass <sjg@chromium.org> X-Mailman-Version: 3.3.10 Precedence: list Subject: [Concept] [PATCH 10/22] video: Use variables for each colour component List-Id: Discussion and patches related to U-Boot Concept <concept.u-boot.org> Archived-At: <https://lists.u-boot.org/archives/list/concept@u-boot.org/message/MOP2DWTKTQNBOOO2G5R4P6WMJZDVSULR/> List-Archive: <https://lists.u-boot.org/archives/list/concept@u-boot.org/> List-Help: <mailto:concept-request@u-boot.org?subject=help> List-Owner: <mailto:concept-owner@u-boot.org> List-Post: <mailto:concept@u-boot.org> List-Subscribe: <mailto:concept-join@u-boot.org> List-Unsubscribe: <mailto:concept-leave@u-boot.org> From: Simon Glass <sjg@chromium.org> Add red, green and blue variables when processing a 24bpp BMP image. Signed-off-by: Simon Glass <sjg@chromium.org> --- drivers/video/video_bmp.c | 40 +++++++++++++++++++++------------------ 1 file changed, 22 insertions(+), 18 deletions(-) diff --git a/drivers/video/video_bmp.c b/drivers/video/video_bmp.c index 4c9157486cb..88a327e4a6d 100644 --- a/drivers/video/video_bmp.c +++ b/drivers/video/video_bmp.c @@ -385,20 +385,23 @@ static int draw_bmp(struct udevice *dev, ulong bmp_image, int x, int y, if (CONFIG_IS_ENABLED(BMP_24BPP)) { for (i = 0; i < height; ++i) { for (j = 0; j < width; j++) { + u8 red = bmap[0]; + u8 green = bmap[1]; + u8 blue = bmap[2]; + if (bpix == 16) { /* 16bit 565RGB format */ - *(u16 *)fb = ((bmap[2] >> 3) - << 11) | - ((bmap[1] >> 2) << 5) | - (bmap[0] >> 3); - bmap += 3; + *(u16 *)fb = + ((blue >> 3) << 11) | + ((green >> 2) << 5) | + (red >> 3); fb += 2; } else if (eformat == VIDEO_X2R10G10B10) { u32 pix; - pix = *bmap++ << 2U; - pix |= *bmap++ << 12U; - pix |= *bmap++ << 22U; + pix = blue << 2U; + pix |= green << 12U; + pix |= red << 22U; *fb++ = pix & 0xff; *fb++ = (pix >> 8) & 0xff; *fb++ = (pix >> 16) & 0xff; @@ -406,20 +409,21 @@ static int draw_bmp(struct udevice *dev, ulong bmp_image, int x, int y, } else if (eformat == VIDEO_RGBA8888) { u32 pix; - pix = *bmap++ << 8U; /* blue */ - pix |= *bmap++ << 16U; /* green */ - pix |= *bmap++ << 24U; /* red */ - - *fb++ = (pix >> 24) & 0xff; - *fb++ = (pix >> 16) & 0xff; + pix = red << 24U; + pix |= green << 16U; + pix |= blue << 8U; + pix |= 0xff; + *fb++ = pix & 0xff; *fb++ = (pix >> 8) & 0xff; - *fb++ = 0xff; + *fb++ = (pix >> 16) & 0xff; + *fb++ = pix >> 24; } else { - *fb++ = *bmap++; - *fb++ = *bmap++; - *fb++ = *bmap++; + *fb++ = red; + *fb++ = green; + *fb++ = blue; *fb++ = 0; } + bmap += 3; } fb -= priv->line_length + width * (bpix / 8); bmap += (padded_width - width); From patchwork Fri Oct 3 16:55:04 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass <sjg@u-boot.org> X-Patchwork-Id: 491 Return-Path: <concept-bounces+u-boot-concept=u-boot.org@u-boot.org> 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=1759510594; bh=MyatTUS/WK1bRF+uMwXOykXYRM5uX+ZbVS+x0fcQ72Y=; 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=lkCqT9MoDgjY9qa89AWzAaGWpD063CzqHDE823kbrmLYHJNPz2/69Qi9YMR4eUrNE BbNMmb/jrEBlZunYNdhq4IZTXCdWa/8ScB9mB/uz2Ch+rOhQ5D59AeDNsZ2jxcIQsg W6p9L1UUA3HmRi+F+8jO+GrPSOq5j1q4L604SUwzSI82oWcgGJQy8W0Lw8yQkCGlC0 Bk3i0Lt5OKu8yvL7r86CsudzerziNl3uUx+ky2yv+4SiT/kQTS1mbDsgF5LktNP9mL AQr0IYUOeQ8pvSlh3KLtMsiEkzW5X6HzSj254q9S1EJgkKEXY2W9M4A3hEGeemHaCa w8pgKsTRvsv2w== Received: from localhost (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id 7B4FF67E85 for <u-boot-concept@u-boot.org>; Fri, 3 Oct 2025 10:56: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 10024) with ESMTP id 6GBMq8gQ20I2 for <u-boot-concept@u-boot.org>; Fri, 3 Oct 2025 10:56:34 -0600 (MDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1759510594; bh=MyatTUS/WK1bRF+uMwXOykXYRM5uX+ZbVS+x0fcQ72Y=; 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=lkCqT9MoDgjY9qa89AWzAaGWpD063CzqHDE823kbrmLYHJNPz2/69Qi9YMR4eUrNE BbNMmb/jrEBlZunYNdhq4IZTXCdWa/8ScB9mB/uz2Ch+rOhQ5D59AeDNsZ2jxcIQsg W6p9L1UUA3HmRi+F+8jO+GrPSOq5j1q4L604SUwzSI82oWcgGJQy8W0Lw8yQkCGlC0 Bk3i0Lt5OKu8yvL7r86CsudzerziNl3uUx+ky2yv+4SiT/kQTS1mbDsgF5LktNP9mL AQr0IYUOeQ8pvSlh3KLtMsiEkzW5X6HzSj254q9S1EJgkKEXY2W9M4A3hEGeemHaCa w8pgKsTRvsv2w== Received: from mail.u-boot.org (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id 67CAB67E82 for <u-boot-concept@u-boot.org>; Fri, 3 Oct 2025 10:56:34 -0600 (MDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1759510592; bh=tNLi0W4ZVmKYc+kkEXr4Wz4+Rm8iXQthS7LL5Fo9n1I=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=cgl97sVdgkwLnqrXULF7tf8kblOMf/+yY6RY60C01wmoPDZubic9jQEFdL4e1pd7N qNExr7Kz7vXsVV4gkMlguGXVZKYsRMyD0CrsvxkNaDo6+ME0zQR1xOKUCFKaclozjS aHbtJv6sqdbKkllXFVkaA1jDlSYtgIuvWF+yjcafxlKLYvxcTijOK03k2C8dzR+d3X wZfBJpAbGZcDqAz0KqJ+EoPMVHqAWJxyA5YGkeOLRXdtzFErzPoUzdStfLlyXhDOmK rnpA+xl/9zxeze5Zr3wlhjj+dcJSeJ3CjAXE71DJPU2bIon6q1Nl7B92cgRu1YlGzt 6RMLK7eCDqg3w== Received: from localhost (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id 0114B67E82; Fri, 3 Oct 2025 10:56:32 -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 WIvoyZCgvmR7; Fri, 3 Oct 2025 10:56:31 -0600 (MDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1759510589; bh=YjkE3loZhvxgSSfjTogfLTiWkpKrhEFRx4Od50l25bQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=sCPBFkmF00h6iWL4aOpvJhFvt8nk33ox7IcpK7hYdSYFgdoo+v2H9YACyw7qC8cud Br+WfEzIDhzYwQVumBlU5MXGCn/6tMy3PVICSj2xKGYT+gKoxqeGPdNuBOhUDXJ8qn hR79/pBdIIOqqot3U2My0tC2lxeIOb+GUj2EB8u36QTfb23MeDTyZqfFG0X7AudMt3 0OsnxwpRB2fEOf4guQ+DfmDJoMNf4M12578E2euJlkz3d5MqCaAgps+/EUoeBAvt00 8Trbefj52E5bji4lphiAu2D/Ki+sAvir9gckyACPWYEy4XhxD4Qb4SxppSm1GpEAC0 d8AVs7bvc8efw== Received: from u-boot.org (unknown [73.34.74.121]) by mail.u-boot.org (Postfix) with ESMTPSA id C2F4367F49; Fri, 3 Oct 2025 10:56:28 -0600 (MDT) From: Simon Glass <sjg@u-boot.org> To: U-Boot Concept <concept@u-boot.org> Date: Fri, 3 Oct 2025 10:55:04 -0600 Message-ID: <20251003165525.440173-12-sjg@u-boot.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20251003165525.440173-1-sjg@u-boot.org> References: <20251003165525.440173-1-sjg@u-boot.org> MIME-Version: 1.0 Message-ID-Hash: UWSUA3KXKVE5PJYQQECRUFPCSFJGLPJH X-Message-ID-Hash: UWSUA3KXKVE5PJYQQECRUFPCSFJGLPJH 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 <xypron.glpk@gmx.de>, Simon Glass <sjg@chromium.org> X-Mailman-Version: 3.3.10 Precedence: list Subject: [Concept] [PATCH 11/22] video: Support transparency with 24bpp BMP image List-Id: Discussion and patches related to U-Boot Concept <concept.u-boot.org> Archived-At: <https://lists.u-boot.org/archives/list/concept@u-boot.org/message/UWSUA3KXKVE5PJYQQECRUFPCSFJGLPJH/> List-Archive: <https://lists.u-boot.org/archives/list/concept@u-boot.org/> List-Help: <mailto:concept-request@u-boot.org?subject=help> List-Owner: <mailto:concept-owner@u-boot.org> List-Post: <mailto:concept@u-boot.org> List-Subscribe: <mailto:concept-join@u-boot.org> List-Unsubscribe: <mailto:concept-leave@u-boot.org> From: Simon Glass <sjg@chromium.org> When the pixel colour matches the transparency colour, skip writing it to the display. Signed-off-by: Simon Glass <sjg@chromium.org> --- drivers/video/video_bmp.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/drivers/video/video_bmp.c b/drivers/video/video_bmp.c index 88a327e4a6d..9c9d9b2091b 100644 --- a/drivers/video/video_bmp.c +++ b/drivers/video/video_bmp.c @@ -388,6 +388,15 @@ static int draw_bmp(struct udevice *dev, ulong bmp_image, int x, int y, u8 red = bmap[0]; u8 green = bmap[1]; u8 blue = bmap[2]; + u32 pixel_color = (red << 16) | + (green << 8) | blue; + + bmap += 3; + /* Skip transparent pixels if alpha enabled */ + if (alpha && pixel_color == acolour) { + fb += bpix / 8; + continue; + } if (bpix == 16) { /* 16bit 565RGB format */ @@ -423,7 +432,6 @@ static int draw_bmp(struct udevice *dev, ulong bmp_image, int x, int y, *fb++ = blue; *fb++ = 0; } - bmap += 3; } fb -= priv->line_length + width * (bpix / 8); bmap += (padded_width - width); From patchwork Fri Oct 3 16:55:05 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass <sjg@u-boot.org> X-Patchwork-Id: 493 Return-Path: <concept-bounces+u-boot-concept=u-boot.org@u-boot.org> 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=1759510598; bh=8ohRtP0h47iRZ+Qozds+YgL+kcC3M+KrEBzt93g0vdQ=; 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=onduiPGrqUde6UmrRqukADRMk7uutzzKvU5Esm/4otvFQLcH6/QJ7IOdqJw+btwTl 4zSfmjh+thhFHB5fveUMe5Slr2PZv2ckTvvSXOdbx9SVhY/Z0kVp6+QDQ5LOt+gUBF 128flTh9AUgztzM9ZnZHJd18T7c8ZdUKPHQWbWEpCRY2HFhmhxhWmyJYnxI1aLj/8G uE9g8pCuXx+2MtUbkkt8Q1QEsQyrIUsqn3RFtzXctOGwinbXtSlBGfQYTlzKqeHqIj DeThtB8KIE0RROSQAscxTWe2oF6NaeZKo4cnBEiU/tTEU5vPlIflnLZBLFGratwdkT 1PtQoY8Qv7IUA== Received: from localhost (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id CF9BC67F47 for <u-boot-concept@u-boot.org>; Fri, 3 Oct 2025 10:56: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 aG-ZrJAAC56i for <u-boot-concept@u-boot.org>; Fri, 3 Oct 2025 10:56:38 -0600 (MDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1759510597; bh=8ohRtP0h47iRZ+Qozds+YgL+kcC3M+KrEBzt93g0vdQ=; 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=HlLnBTAaNlTXu6cRyGoCqsttpl1ihvo0a2GW8NCxwuM9+IScDB32vNimwGM+ypToJ aKnml6+alB344kAJ46gE5omHvarr1EQVePR76j1sH1sGiYgtmAo8r8V7g1tr7tMNvY kr6mEKJHcJ5X6VsBrn/2PlkKXxjBAoJ4IPgrF/A0Elo37sOb6s2MeLELJ6NncuXT8Q hAZM+xZLGGLlKh1TGylfALP3oWLqtNxLYntveNrsc0KD1+9u9Z8j/wKoxxyemNj7AC 3abqHlEIPKiRFa1g+vMub+idemJvd7XncLFbA5L2RFGaqjg3iuikh2cJOuZICWxg/a MX3hHTs1pUyiQ== Received: from mail.u-boot.org (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id 0054C67F4C for <u-boot-concept@u-boot.org>; Fri, 3 Oct 2025 10:56:36 -0600 (MDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1759510595; bh=TjJOlQtf0fNvCJDCUjgJxOAtWAy2iIjkVyPW/gCXsBQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=vdS8+TqCMmYDeRGEINHhLbOzULcnlKGon1gjtICZAYSLGssLCt/lKJHspl67WHigz /sWfb+zVbDD4zvnJGxjx65VMtgmFyVfqzHql5n464PtoBMwhhf3oxJ4Gz4/b5ogtnI yLzVJVEO5+4bXFLFQpraCxiT3F6KeicGtjTrBBbLFqAUNucVcEyyyNN1xGCXdT/CPM MY6WhSLXoOULBs5BRj9GMB5nL3NX6SBeam9NbOMAFHUbFgb7cpbHgb5BDJ+BJnubZN 4MytXaLSVZ093Y3SGRc9+qen7jyHx1k7eZJQw6Cj1DiYe/7Rso/4FRmRrdd6veMPWE yt4Dul1JZ2uNQ== Received: from localhost (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id 1B35B67E12; Fri, 3 Oct 2025 10:56: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 10026) with ESMTP id 4veYiLj5PryY; Fri, 3 Oct 2025 10:56:35 -0600 (MDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1759510591; bh=cXMOETEA6bgMjYWQzgHQNF+PBRsIAhdUU2YHNFe6osg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=wcNm13nPpzxfrnirr8KTNUfHaNhiGGJkpdrhbMuReLBq5lOYInK95OWmfiLGpkVsC UYYqLlPxqvYJ/ZDKNhtFhvBRfC27UA0UxhOaYQpWYuaxiFLv+jhJTj1y+XeY0lP5sx E+dLMLsHJtyPLi8WPbbR7WozRl1TIWw8NO6O2thY6X/kVD9yYIXuHcd9GznRBS3KFE +EccqW0YdrkOo8dkxIj3ejdAWq5rMPa0DiJJAYe/BlXQcTzYDMFs1v0R4H1tpr/tlG +fZ/BTLYV/0+wFJX3DVg/S9uFv7pD4QjHzwQl1P4/vwJndZGQKjnLhNGkIHSZgwGdY GTbgo/BpEGrjg== Received: from u-boot.org (unknown [73.34.74.121]) by mail.u-boot.org (Postfix) with ESMTPSA id C470367E7C; Fri, 3 Oct 2025 10:56:30 -0600 (MDT) From: Simon Glass <sjg@u-boot.org> To: U-Boot Concept <concept@u-boot.org> Date: Fri, 3 Oct 2025 10:55:05 -0600 Message-ID: <20251003165525.440173-13-sjg@u-boot.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20251003165525.440173-1-sjg@u-boot.org> References: <20251003165525.440173-1-sjg@u-boot.org> MIME-Version: 1.0 Message-ID-Hash: GQV6R3UHZ7OQRLW3GWKS55CWPABQTYQC X-Message-ID-Hash: GQV6R3UHZ7OQRLW3GWKS55CWPABQTYQC 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 <xypron.glpk@gmx.de>, Simon Glass <sjg@chromium.org> X-Mailman-Version: 3.3.10 Precedence: list Subject: [Concept] [PATCH 12/22] video: Support transparency with BMP palette List-Id: Discussion and patches related to U-Boot Concept <concept.u-boot.org> Archived-At: <https://lists.u-boot.org/archives/list/concept@u-boot.org/message/GQV6R3UHZ7OQRLW3GWKS55CWPABQTYQC/> List-Archive: <https://lists.u-boot.org/archives/list/concept@u-boot.org/> List-Help: <mailto:concept-request@u-boot.org?subject=help> List-Owner: <mailto:concept-owner@u-boot.org> List-Post: <mailto:concept@u-boot.org> List-Subscribe: <mailto:concept-join@u-boot.org> List-Unsubscribe: <mailto:concept-leave@u-boot.org> From: Simon Glass <sjg@chromium.org> Check the palette entry against the transparency colour and skip writing it to the display if it matches. Signed-off-by: Simon Glass <sjg@chromium.org> --- drivers/video/video_bmp.c | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/drivers/video/video_bmp.c b/drivers/video/video_bmp.c index 9c9d9b2091b..ebdf73e25a9 100644 --- a/drivers/video/video_bmp.c +++ b/drivers/video/video_bmp.c @@ -53,6 +53,20 @@ static u32 get_bmp_col_rgba8888(struct bmp_color_table_entry *cte) (cte->blue << 16U) | 0xff << 24U); } +/** + * matches_alpha() - Check if a palette entry matches the alpha color + * + * @ent: BMP palette entry + * @col: Alpha color to compare (RGB888 format) + * Return: true if the palette entry matches the alpha color + */ +static bool matches_alpha(struct bmp_color_table_entry *ent, u32 col) +{ + u32 colour = (ent->red << 16) | (ent->green << 8) | ent->blue; + + return colour == col; +} + /** * write_pix8() - Write a pixel from a BMP image into the framebuffer * @@ -73,6 +87,10 @@ static void write_pix8(u8 *fb, uint bpix, enum video_format eformat, { struct bmp_color_table_entry *cte = &palette[*bmap]; + /* Check for transparent pixel */ + if (alpha && matches_alpha(cte, acol)) + return; + if (bpix == 8) { *fb++ = *bmap; } else if (bpix == 16) { From patchwork Fri Oct 3 16:55:06 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass <sjg@u-boot.org> X-Patchwork-Id: 494 Return-Path: <concept-bounces+u-boot-concept=u-boot.org@u-boot.org> 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=1759510603; bh=+z0M54OjDsr9b9L9hQM3e+ZAaP+EXhJiJ0En3Z0EoSM=; 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=f0MFqRFrncn5G6kMwo1m2PB3zzRh0kRMmv1IzrxNDRbwr8EFbpcpOBUSaHKAOePBi rWBvfjAw62wHO0EZIfU6g++8xsuP9KRzbs25yNds346IYoejZftxXJJGV8sTE5AjPD kXzygyrmkv0At556LezSev5upRt3sikM4D904Qo3fymBM6Y9nvvohS9jwp1dHhm7iM TVWAEwGgEjQawHXunK95wuLaxTvIvc1bbRGedjR5pqgbqhPR+j8M1/zjEr4T1a7wi0 dYq5ADWJsx9BoRSN2qYvX94eSjlzQufywq9oZ5P8zCslyU+/X3i7XkZbHKJH1y4XzW iKZhOXLPnBNjA== Received: from localhost (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id CE9AC67E12 for <u-boot-concept@u-boot.org>; Fri, 3 Oct 2025 10:56:43 -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 FARxea9FutNp for <u-boot-concept@u-boot.org>; Fri, 3 Oct 2025 10:56:43 -0600 (MDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1759510603; bh=+z0M54OjDsr9b9L9hQM3e+ZAaP+EXhJiJ0En3Z0EoSM=; 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=f0MFqRFrncn5G6kMwo1m2PB3zzRh0kRMmv1IzrxNDRbwr8EFbpcpOBUSaHKAOePBi rWBvfjAw62wHO0EZIfU6g++8xsuP9KRzbs25yNds346IYoejZftxXJJGV8sTE5AjPD kXzygyrmkv0At556LezSev5upRt3sikM4D904Qo3fymBM6Y9nvvohS9jwp1dHhm7iM TVWAEwGgEjQawHXunK95wuLaxTvIvc1bbRGedjR5pqgbqhPR+j8M1/zjEr4T1a7wi0 dYq5ADWJsx9BoRSN2qYvX94eSjlzQufywq9oZ5P8zCslyU+/X3i7XkZbHKJH1y4XzW iKZhOXLPnBNjA== Received: from mail.u-boot.org (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id BC3CD67E82 for <u-boot-concept@u-boot.org>; Fri, 3 Oct 2025 10:56:43 -0600 (MDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1759510601; bh=KImV8YTcH5gM+ARb6/vctDO74ZoJDVKt12o69/TG1G8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=hUbtqdQ9MgLUw5fQqslQ8n8eNkgdZYSl+w9im9cS4TSgLNF7iK/5nAzpoo2wDBhRJ aePtg6eb8XUKL85kUxpmdDhiY8ox1nUQbrXvJIkn0YIyVMD6/ob2kgGi0lhg8dCWXU RcbWARa//xkmxhG4tUB8kjHp/WAe3WNq14RpTpdGhC/e2hYU+Uz06+QrgScLDO7cwR 6/tFkUBvc3yy+VReYeasItq3TXgmo4HMROnOqOg3nyJJD9pnqnT3rywhVoW+beD+DY ItnoV7xCfADD1JXHbyCrAunK6H1qfBFDuxK0XoEqGjc3kAJjmmFji6+bOsTdZm+Gt2 wxL/MWcO2Wkhg== Received: from localhost (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id 6399067E12; Fri, 3 Oct 2025 10:56: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 2Hti2pAAH3za; Fri, 3 Oct 2025 10:56:41 -0600 (MDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1759510595; bh=9DPh9l9pu79kxPZYTcEvxYxTNtCVMOIHDD8toyfpmOE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=uhV1q1vYw0r5WkJLrhGhLxMyq9gNq+yENj+kYf8sw/AesP4kRBwUhkKcQdGT0gn2O 77GYDQr+WCPrg/+Hui9lL+mlKopYzfp2NCIDQjbvagDZNYbVIM6n+zyjWayCymzIYJ FxR5yirXMKqySDa+AOUryzRfkshU1VDWrpzptLg83SVCnaaAwLJt13M86yzjb1TfG6 PxhsXRAtykR0z+eOfv6qn9jhsLD0bcLJbHGIHg/PQqFnyB5DJ6EBarHfXHYxqyE4Y2 WSSKdmJcje9urw2IVSyIBbgkH8pg3zek42RJLPB6LP6Pk5pqawuUwS7DAr2bamWNJC xyOTqF85x6h7A== Received: from u-boot.org (unknown [73.34.74.121]) by mail.u-boot.org (Postfix) with ESMTPSA id 58E7E67E7C; Fri, 3 Oct 2025 10:56:35 -0600 (MDT) From: Simon Glass <sjg@u-boot.org> To: U-Boot Concept <concept@u-boot.org> Date: Fri, 3 Oct 2025 10:55:06 -0600 Message-ID: <20251003165525.440173-14-sjg@u-boot.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20251003165525.440173-1-sjg@u-boot.org> References: <20251003165525.440173-1-sjg@u-boot.org> MIME-Version: 1.0 Message-ID-Hash: SV6ZK3DJZYH4FP7OBCDHYIKYKCYVOYMH X-Message-ID-Hash: SV6ZK3DJZYH4FP7OBCDHYIKYKCYVOYMH 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 <xypron.glpk@gmx.de>, Simon Glass <sjg@chromium.org> X-Mailman-Version: 3.3.10 Precedence: list Subject: [Concept] [PATCH 13/22] video: Export a function to draw a BMP with transparency List-Id: Discussion and patches related to U-Boot Concept <concept.u-boot.org> Archived-At: <https://lists.u-boot.org/archives/list/concept@u-boot.org/message/SV6ZK3DJZYH4FP7OBCDHYIKYKCYVOYMH/> List-Archive: <https://lists.u-boot.org/archives/list/concept@u-boot.org/> List-Help: <mailto:concept-request@u-boot.org?subject=help> List-Owner: <mailto:concept-owner@u-boot.org> List-Post: <mailto:concept@u-boot.org> List-Subscribe: <mailto:concept-join@u-boot.org> List-Unsubscribe: <mailto:concept-leave@u-boot.org> From: Simon Glass <sjg@chromium.org> Provide a new BMP function which can draw a bitmap while regarding a chosen colour as transparent. Signed-off-by: Simon Glass <sjg@chromium.org> --- drivers/video/video_bmp.c | 6 ++++ include/video.h | 16 ++++++++++ test/dm/video.c | 62 ++++++++++++++++++++++++++++++++------- 3 files changed, 74 insertions(+), 10 deletions(-) diff --git a/drivers/video/video_bmp.c b/drivers/video/video_bmp.c index ebdf73e25a9..43aa45f0efe 100644 --- a/drivers/video/video_bmp.c +++ b/drivers/video/video_bmp.c @@ -507,3 +507,9 @@ int video_bmp_display(struct udevice *dev, ulong bmp_image, int x, int y, { return draw_bmp(dev, bmp_image, x, y, align, false, 0); } + +int video_bmp_displaya(struct udevice *dev, ulong bmp_image, int x, int y, + bool align, bool alpha, u32 acolour) +{ + return draw_bmp(dev, bmp_image, x, y, align, alpha, acolour); +} diff --git a/include/video.h b/include/video.h index 9d9a725d30d..1ad5868e2f6 100644 --- a/include/video.h +++ b/include/video.h @@ -383,6 +383,22 @@ void video_bmp_get_info(const void *bmp_image, ulong *widthp, ulong *heightp, int video_bmp_display(struct udevice *dev, ulong bmp_image, int x, int y, bool align); +/** + * video_bmp_displaya() - Display a BMP image with alpha transparency + * + * @dev: Device to use + * @bmp_image: Address of BMP image + * @x: X position to draw image + * @y: Y position to draw image + * @align: true to adjust the coordinates to centre the image (see + * video_bmp_display() for details) + * @alpha: true to enable alpha transparency + * @acolour: Color to treat as transparent (RGB888 format: 0xRRGGBB) + * Return: 0 if OK, -ve on error + */ +int video_bmp_displaya(struct udevice *dev, ulong bmp_image, int x, int y, + bool align, bool alpha, u32 acolour); + /** * video_get_xsize() - Get the width of the display in pixels * diff --git a/test/dm/video.c b/test/dm/video.c index a802228b790..3defa184b14 100644 --- a/test/dm/video.c +++ b/test/dm/video.c @@ -667,15 +667,25 @@ static int dm_test_video_comp_bmp8(struct unit_test_state *uts) } DM_TEST(dm_test_video_comp_bmp8, UTF_SCAN_PDATA | UTF_SCAN_FDT); -/* Test drawing the riscos pointer */ -static int dm_test_video_bmp_alpha(struct unit_test_state *uts) +/** + * check_bmp_alpha() - Test drawing the riscos pointer with transparency + * + * Draws the riscos pointer BMP in various positions with and without + * transparency to verify alpha blending works correctly + * + * @uts: Test state + * @dev: Video device + * @first: Expected compression after first pointer draw + * @second: Expected compression after second pointer draw + * @trans: Expected compression after drawing with transparency + * Return: 0 if OK, -ve on error + */ +static int check_bmp_alpha(struct unit_test_state *uts, struct udevice *dev, + int first, int second, int trans) { - struct video_priv *priv; - struct udevice *dev; + struct video_priv *priv = dev_get_uclass_priv(dev); ulong addr; - ut_assertok(video_get_nologo(uts, &dev)); - priv = dev_get_uclass_priv(dev); addr = map_to_sysmem(video_image_getptr(riscos_arrow)); /* Draw a black rectangle first */ @@ -684,17 +694,49 @@ static int dm_test_video_bmp_alpha(struct unit_test_state *uts) /* Draw the pointer on top of the black rectangle */ ut_assertok(video_bmp_display(dev, addr, 110, 110, false)); - ut_asserteq(174, video_compress_fb(uts, dev, false)); + ut_asserteq(first, video_compress_fb(uts, dev, false)); ut_assertok(video_check_copy_fb(uts, dev)); - /* Draw the pointer on top of the black rectangle */ + /* Draw the pointer on top of the white background */ ut_assertok(video_bmp_display(dev, addr, 350, 110, false)); - ut_asserteq(249, video_compress_fb(uts, dev, false)); + ut_asserteq(second, video_compress_fb(uts, dev, false)); + + /* Draw the pointer with white (0xffffff) as transparent */ + ut_assertok(video_bmp_displaya(dev, addr, 110, 160, false, true, + 0xffffff)); + ut_assertok(video_bmp_displaya(dev, addr, 350, 160, false, true, + 0xffffff)); + ut_asserteq(trans, video_compress_fb(uts, dev, false)); ut_assertok(video_check_copy_fb(uts, dev)); return 0; } -DM_TEST(dm_test_video_bmp_alpha, UTF_SCAN_PDATA | UTF_SCAN_FDT); + +/* Test drawing the riscos pointer on a 16bpp display */ +static int dm_test_video_bmp_alpha16(struct unit_test_state *uts) +{ + struct udevice *dev; + + ut_assertok(video_get_nologo(uts, &dev)); + ut_assertok(check_bmp_alpha(uts, dev, 174, 249, 358)); + + return 0; +} +DM_TEST(dm_test_video_bmp_alpha16, UTF_SCAN_PDATA | UTF_SCAN_FDT); + +/* Test drawing the riscos pointer on 32bpp display */ +static int dm_test_video_bmp_alpha32(struct unit_test_state *uts) +{ + struct udevice *dev; + + ut_assertok(uclass_find_first_device(UCLASS_VIDEO, &dev)); + ut_assertnonnull(dev); + ut_assertok(sandbox_sdl_set_bpp(dev, VIDEO_BPP32)); + ut_assertok(check_bmp_alpha(uts, dev, 641, 710, 869)); + + return 0; +} +DM_TEST(dm_test_video_bmp_alpha32, UTF_SCAN_PDATA | UTF_SCAN_FDT); /* Test TrueType console */ static int dm_test_video_truetype(struct unit_test_state *uts) From patchwork Fri Oct 3 16:55:07 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass <sjg@u-boot.org> X-Patchwork-Id: 495 Return-Path: <concept-bounces+u-boot-concept=u-boot.org@u-boot.org> 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=1759510606; bh=J1Nq8AWo9Nclz9VNw2NfbihMb7u60ymRdsRuVj8KcFA=; 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=cO+rlXIKhI+9O0R2bYssBypvu1Yn/aCxAcPfWqmXArV3YtecwOjZRKM3yaW8230rG t/PFdIXBe3cpWd4t1jEftEZh+1PvzXCfyDJvYnNons9Iq1deph7I8q/IIDew9BbTy2 WJaIBjeEpyEg5LpvzxHYr9Nkbah+4/uYBzs2iu/Y+ISMvSO85OO9ukdJsSvPBoSbOP RxKFmBcuFfUXO+tOlEvsdVVMPMbM9mOtdrq46nk9d6Ff0yz0dAuN9Y1IteoDCXKqkz bamwjBfmDqVEwMnkIqgq64XD6nzHnl1EVB/ft3iZQCYrm6RO2NnQZMaUQ4bgVz6fG4 WLrJh7fPJ797Q== Received: from localhost (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id 6DCE767F49 for <u-boot-concept@u-boot.org>; Fri, 3 Oct 2025 10:56:46 -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 jvUrwk7rOwS3 for <u-boot-concept@u-boot.org>; Fri, 3 Oct 2025 10:56:46 -0600 (MDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1759510604; bh=J1Nq8AWo9Nclz9VNw2NfbihMb7u60ymRdsRuVj8KcFA=; 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=uoP/dbfMwvaC0tK6HnxSd5UaaaJ/XkVn30XviJQC8Oj2SBtad0P1xnwCodk874hgw 99rWGJnKJLiASUcdmRD9zW9bl8c4yVaEjnFINfprtLCiWZpEF3IuCpyu2i463Yoftr d70cvHd6MJcAqNssYvNHlk050xE/ssqMG6OosEOtiwMCFQlwJl3DMa34EhfCl4f4U/ mWZLtIWsJcDjh0CJQwXE88rSmfCRgszxhqHvlGGml6PSpO7neovmozAvKiOW80Pn8E Lgee/XBxr7HXpjgu3wpkDYWsZFoe1hg8i/3X2VrEaTHRa5aPDQtKv5wc3dRqHq+swh kHREREUmqTpQQ== Received: from mail.u-boot.org (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id 5FDCE67E82 for <u-boot-concept@u-boot.org>; Fri, 3 Oct 2025 10:56:44 -0600 (MDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1759510601; bh=JhA+0RJNJIgl3Xo0U92fYrFuwJpFQlNDBWvO726CCH0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Fle31+Nzx9NJX1Qldcok6XmlFhaIMuVr7fEnPfzqjUwVtw/b5U0uUQDYTYx7HLtcX 8HEuRWgEQGVEadwi/m3jnLTvLWYJdIclTov4/vbPh0zTTgk+UpocG8kCwF6SmSJ+So PwCzt9tkuSlD5y4fYmZmNCYoO8HUhtn2lROjpSU1JK3Q+9AymuGEs7gY72V2PIa9mm r2wG5ogpag6T1BA8OWAcfufgxfqVDbrU02ePEEvNr1TiXNGEt40QFdI3i0GrFCpZtF Kj0kmbY7C+Ll5qiBoTv2vdAeN2rx/P+7iBTGsiyC5iXE6oLaSlyXp0msrK3ByKvyyo 0iGFFdyIPKpPQ== Received: from localhost (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id E30F867E7C; Fri, 3 Oct 2025 10:56: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 Uf11FaWNLPMk; Fri, 3 Oct 2025 10:56:41 -0600 (MDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1759510597; bh=KHdCoNbr8yc1C5bfMc0cHUBxdycNPGCqKRqRu3x63cI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=E7THDf3/TQ/JJUb/s8uyVbTRPDuqrK08W7awcldz9cu2CBWmOYmQJJbmagLXvtB4I dHJx0oWUgPOKXhZz47QRYlnJP5Ke8bP4mVRZTtTvLEYlptVslfMimM2qap6WqgKYkE QdLoVuci+CPtHLhLNkY6zY//wx15wcB+xTLfcZG7IY9+80W5DomyWKTRBpFtNjJWRq HWRyq6OQY0PUI78uT09IGgi2i3jM71DHi7KGi7DcbCAuO2F+RvSIFTi3lPGjszgBIq L4hY/fdNXRMCrk3wt5PwBbY/k3mJXSHGI43PVu1TXza7FmC1VHoiUjFxKDf2+PPjJ8 46mIvHPP6+S2g== Received: from u-boot.org (unknown [73.34.74.121]) by mail.u-boot.org (Postfix) with ESMTPSA id 69CF167F4F; Fri, 3 Oct 2025 10:56:37 -0600 (MDT) From: Simon Glass <sjg@u-boot.org> To: U-Boot Concept <concept@u-boot.org> Date: Fri, 3 Oct 2025 10:55:07 -0600 Message-ID: <20251003165525.440173-15-sjg@u-boot.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20251003165525.440173-1-sjg@u-boot.org> References: <20251003165525.440173-1-sjg@u-boot.org> MIME-Version: 1.0 Message-ID-Hash: 62CZUASLFOQUO7OKVCJK6R3QBFBSNKOW X-Message-ID-Hash: 62CZUASLFOQUO7OKVCJK6R3QBFBSNKOW 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 <xypron.glpk@gmx.de>, Simon Glass <sjg@chromium.org>, Claude <noreply@anthropic.com> X-Mailman-Version: 3.3.10 Precedence: list Subject: [Concept] [PATCH 14/22] video: Add a struct video_bbox for damage tracking List-Id: Discussion and patches related to U-Boot Concept <concept.u-boot.org> Archived-At: <https://lists.u-boot.org/archives/list/concept@u-boot.org/message/62CZUASLFOQUO7OKVCJK6R3QBFBSNKOW/> List-Archive: <https://lists.u-boot.org/archives/list/concept@u-boot.org/> List-Help: <mailto:concept-request@u-boot.org?subject=help> List-Owner: <mailto:concept-owner@u-boot.org> List-Post: <mailto:concept@u-boot.org> List-Subscribe: <mailto:concept-join@u-boot.org> List-Unsubscribe: <mailto:concept-leave@u-boot.org> From: Simon Glass <sjg@chromium.org> Replace the anonymous struct in video_priv with struct video_bbox for the damage field. Update all references from xstart/ystart/xend/yend to x0/y0/x1/y1 to match the video_bbox field names. Add local video_bbox pointers in functions that access damage fields repeatedly to improve readability. Co-developed-by: Claude <noreply@anthropic.com> Signed-off-by: Simon Glass <sjg@chromium.org> --- drivers/video/video-uclass.c | 36 +++++++++++++++++++---------------- include/video.h | 13 ++----------- include/video_defs.h | 37 ++++++++++++++++++++++++++++++++++++ test/dm/video.c | 34 +++++++++++++++++---------------- 4 files changed, 77 insertions(+), 43 deletions(-) diff --git a/drivers/video/video-uclass.c b/drivers/video/video-uclass.c index f5cd1727fce..5c2cb251683 100644 --- a/drivers/video/video-uclass.c +++ b/drivers/video/video-uclass.c @@ -411,6 +411,7 @@ void video_set_default_colors(struct udevice *dev, bool invert) void video_damage(struct udevice *vid, int x, int y, int width, int height) { struct video_priv *priv = dev_get_uclass_priv(vid); + struct video_bbox *damage = &priv->damage; int xend = x + width; int yend = y + height; @@ -427,10 +428,10 @@ void video_damage(struct udevice *vid, int x, int y, int width, int height) yend = priv->ysize; /* Span a rectangle across all old and new damage */ - priv->damage.xstart = min(x, priv->damage.xstart); - priv->damage.ystart = min(y, priv->damage.ystart); - priv->damage.xend = max(xend, priv->damage.xend); - priv->damage.yend = max(yend, priv->damage.yend); + damage->x0 = min(x, damage->x0); + damage->y0 = min(y, damage->y0); + damage->x1 = max(xend, damage->x1); + damage->y1 = max(yend, damage->y1); } #endif @@ -457,12 +458,12 @@ static void video_flush_dcache(struct udevice *vid, bool use_copy) return; } - if (priv->damage.xend && priv->damage.yend) { - int lstart = priv->damage.xstart * VNBYTES(priv->bpix); - int lend = priv->damage.xend * VNBYTES(priv->bpix); + if (priv->damage.x1 && priv->damage.y1) { + int lstart = priv->damage.x0 * VNBYTES(priv->bpix); + int lend = priv->damage.x1 * VNBYTES(priv->bpix); int y; - for (y = priv->damage.ystart; y < priv->damage.yend; y++) { + for (y = priv->damage.y0; y < priv->damage.y1; y++) { ulong start = fb + (y * priv->line_length) + lstart; ulong end = start + lend - lstart; @@ -477,16 +478,17 @@ static void video_flush_dcache(struct udevice *vid, bool use_copy) static void video_flush_copy(struct udevice *vid) { struct video_priv *priv = dev_get_uclass_priv(vid); + struct video_bbox *damage = &priv->damage; if (!priv->copy_fb) return; - if (priv->damage.xend && priv->damage.yend) { - int lstart = priv->damage.xstart * VNBYTES(priv->bpix); - int lend = priv->damage.xend * VNBYTES(priv->bpix); + if (damage->x1 && damage->y1) { + int lstart = damage->x0 * VNBYTES(priv->bpix); + int lend = damage->x1 * VNBYTES(priv->bpix); int y; - for (y = priv->damage.ystart; y < priv->damage.yend; y++) { + for (y = damage->y0; y < damage->y1; y++) { ulong offset = (y * priv->line_length) + lstart; ulong len = lend - lstart; @@ -527,10 +529,12 @@ int video_sync(struct udevice *vid, bool force) priv->last_sync = get_timer(0); if (IS_ENABLED(CONFIG_VIDEO_DAMAGE)) { - priv->damage.xstart = priv->xsize; - priv->damage.ystart = priv->ysize; - priv->damage.xend = 0; - priv->damage.yend = 0; + struct video_bbox *damage = &priv->damage; + + damage->x0 = priv->xsize; + damage->y0 = priv->ysize; + damage->x1 = 0; + damage->y1 = 0; } return 0; diff --git a/include/video.h b/include/video.h index 1ad5868e2f6..92dca60a872 100644 --- a/include/video.h +++ b/include/video.h @@ -90,11 +90,7 @@ enum video_format { * @fb_size: Frame buffer size * @copy_fb: Copy of the frame buffer to keep up to date; see struct * video_uc_plat - * @damage: A bounding box of framebuffer regions updated since last sync - * @damage.xstart: X start position in pixels from the left - * @damage.ystart: Y start position in pixels from the top - * @damage.xend: X end position in pixels from the left - * @damage.xend: Y end position in pixels from the top + * @damage: Bounding box of framebuffer regions updated since last sync * @line_length: Length of each frame buffer line, in bytes. This can be * set by the driver, but if not, the uclass will set it after * probing @@ -124,12 +120,7 @@ struct video_priv { void *fb; int fb_size; void *copy_fb; - struct { - int xstart; - int ystart; - int xend; - int yend; - } damage; + struct video_bbox damage; int line_length; u32 colour_fg; u32 colour_bg; diff --git a/include/video_defs.h b/include/video_defs.h index 6bd822dc99e..c17959e3146 100644 --- a/include/video_defs.h +++ b/include/video_defs.h @@ -12,4 +12,41 @@ /* Maximum length of an embedded image name */ #define VIDEO_IMAGE_NAMELEN 16 +#ifndef __ASSEMBLY__ + +#include <stdbool.h> + +/** + * struct video_bbox - Represents a bounding box for video operations + * + * The bounding box is only valid if x1 > x0 and y1 > y0. An invalid bounding + * box (where x1 <= x0 or y1 <= y0) indicates that there is no area to process. + * + * @x0: X start position in pixels from the left + * @y0: Y start position in pixels from the top + * @x1: X end position in pixels from the left + * @y1: Y end position in pixels from the top + */ +struct video_bbox { + int x0; + int y0; + int x1; + int y1; +}; + +/** + * video_bbox_valid() - Check if a bounding box is valid + * + * A valid bounding box has x1 > x0 and y1 > y0. An invalid/inverted bounding + * box (where x1 <= x0 or y1 <= y0) indicates that there is no area to process. + * + * @bbox: Bounding box to check + * Return: true if valid, false if invalid/inverted + */ +static inline bool video_bbox_valid(const struct video_bbox *bbox) +{ + return bbox->x1 > bbox->x0 && bbox->y1 > bbox->y0; +} +#endif /* __ASSEMBLY__ */ + #endif /* __VIDEO_DEFS_H */ diff --git a/test/dm/video.c b/test/dm/video.c index 3defa184b14..7ada4c75bf7 100644 --- a/test/dm/video.c +++ b/test/dm/video.c @@ -903,32 +903,34 @@ static int dm_test_video_damage(struct unit_test_state *uts) ut_assertok(uclass_get_device(UCLASS_VIDEO_CONSOLE, 0, &con)); priv = dev_get_uclass_priv(dev); + struct video_bbox *damage = &priv->damage; + vidconsole_position_cursor(con, 14, 10); vidconsole_put_string(con, test_string_2); - ut_asserteq(449, priv->damage.xstart); - ut_asserteq(325, priv->damage.ystart); - ut_asserteq(661, priv->damage.xend); - ut_asserteq(350, priv->damage.yend); + ut_asserteq(449, damage->x0); + ut_asserteq(325, damage->y0); + ut_asserteq(661, damage->x1); + ut_asserteq(350, damage->y1); vidconsole_position_cursor(con, 7, 5); vidconsole_put_string(con, test_string_1); - ut_asserteq(225, priv->damage.xstart); - ut_asserteq(164, priv->damage.ystart); - ut_asserteq(661, priv->damage.xend); - ut_asserteq(350, priv->damage.yend); + ut_asserteq(225, damage->x0); + ut_asserteq(164, damage->y0); + ut_asserteq(661, damage->x1); + ut_asserteq(350, damage->y1); vidconsole_position_cursor(con, 21, 15); vidconsole_put_string(con, test_string_3); - ut_asserteq(225, priv->damage.xstart); - ut_asserteq(164, priv->damage.ystart); - ut_asserteq(1280, priv->damage.xend); - ut_asserteq(510, priv->damage.yend); + ut_asserteq(225, damage->x0); + ut_asserteq(164, damage->y0); + ut_asserteq(1280, damage->x1); + ut_asserteq(510, damage->y1); video_sync(dev, true); - ut_asserteq(priv->xsize, priv->damage.xstart); - ut_asserteq(priv->ysize, priv->damage.ystart); - ut_asserteq(0, priv->damage.xend); - ut_asserteq(0, priv->damage.yend); + ut_asserteq(priv->xsize, damage->x0); + ut_asserteq(priv->ysize, damage->y0); + ut_asserteq(0, damage->x1); + ut_asserteq(0, damage->y1); ut_asserteq(7335, video_compress_fb(uts, dev, false)); ut_assertok(video_check_copy_fb(uts, dev)); From patchwork Fri Oct 3 16:55:08 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass <sjg@u-boot.org> X-Patchwork-Id: 496 Return-Path: <concept-bounces+u-boot-concept=u-boot.org@u-boot.org> 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=1759510606; bh=DQTWwxvTFo/1bkJZ+EmioPj3aliVtQ87iGySsKPI2Lc=; 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=WJqPuGS2BoyRaAuMvDQRlxqjbk6fvL4NdFlc1C2Vd6smIA2l4TD4yHqfT5wQej2bz UTo8yBHQiBT1h4Wlg0EPONYRy8ansTKhbBu+0X2ifSRd3ZBFoYoCyNuVhnKS9k7UgW CjY1wIRhic5yrTOKhruhEii3HoaXMHkvzp2Z9LYWIzZPQdPIPTvNTqk4e/aGpdJjfl /FSzTjVRoGEDyqJFV4q31qElLmQhk42LErMBEJjwg1uv3LORU0curH2Kh9WPOu51Wv eK/xkhe+dc+WiNv42d0tKA7FuzZUMTi8fwENQnlpaqNtKLfQFfQYVRx0AtekS+DQF6 C4ek378XQj3QQ== Received: from localhost (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id C3DB167EC5 for <u-boot-concept@u-boot.org>; Fri, 3 Oct 2025 10:56:46 -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 A72PejVgDzsD for <u-boot-concept@u-boot.org>; Fri, 3 Oct 2025 10:56:46 -0600 (MDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1759510606; bh=DQTWwxvTFo/1bkJZ+EmioPj3aliVtQ87iGySsKPI2Lc=; 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=WJqPuGS2BoyRaAuMvDQRlxqjbk6fvL4NdFlc1C2Vd6smIA2l4TD4yHqfT5wQej2bz UTo8yBHQiBT1h4Wlg0EPONYRy8ansTKhbBu+0X2ifSRd3ZBFoYoCyNuVhnKS9k7UgW CjY1wIRhic5yrTOKhruhEii3HoaXMHkvzp2Z9LYWIzZPQdPIPTvNTqk4e/aGpdJjfl /FSzTjVRoGEDyqJFV4q31qElLmQhk42LErMBEJjwg1uv3LORU0curH2Kh9WPOu51Wv eK/xkhe+dc+WiNv42d0tKA7FuzZUMTi8fwENQnlpaqNtKLfQFfQYVRx0AtekS+DQF6 C4ek378XQj3QQ== Received: from mail.u-boot.org (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id 3C7D067F43 for <u-boot-concept@u-boot.org>; Fri, 3 Oct 2025 10:56:46 -0600 (MDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1759510603; bh=Y4ISVzFGhGF6LgNzH3Dx09kLiUHmwu+n0lJMd9R+0DY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=NZIJyTI7DCQBT/zk+zZpksbhT7AHpiuNGO05Lmldsp+GvIT6dpE5nuLWwkHlMBTo1 yHsh+6Be7AAdrLoDUR6ujfyAVi2V95Nl0pdT6o6pva4p1IHO0wSCR3DKwGi1K6weYq YKdtlHL/zeQTVKzVk5MCt3OMc5beG7S1Wd7lomHssMLGn0T5A9LKkvHAy9l7Ux2qEb gY2bcN/wGW4oZPJhD6EKyzVJwgxl3njD0dF4mpkzP8NzLi8faH8hXxWkAvNCxm7ovN tdFaM6BvEoMnbw5Z1VLzVG+PAvCnLr3xF4dnyOhd8jAvXVIifVRSMNukdG19Th9eij AicN9g5MpnRwA== Received: from localhost (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id EC16D67EC7; Fri, 3 Oct 2025 10:56:43 -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 E4JbZH1wwdJy; Fri, 3 Oct 2025 10:56:43 -0600 (MDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1759510602; bh=pE/eaMbJshF1Vn2O1WmTX4sUPO96l/PmRIXoS9OZo2A=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=pZgIaohHwBIrDcnLQoWpnBehIct62PmJzNJqJjXppYhGw4Ezd4oGTpgWzFNWbhLwQ j9BVem05fXrvbJ8zXNQ9zblGxdDffjT6jDvhEjaDw3O9tMyh3E2A4XzHFELQo1D6hJ AeZ1wfJC9su4ETCBWjqJbOAiK17K+8Xybbz56EvndXYiuoUPl8gzEgIiNeAqoHHFM1 xzNdgAKktuuJNdAl2x/GUEGkfbG97Ji8DtiYY+0AY8cfTfQUsHslHW4esCFWJXGtiC 2XDKSt842pmn9x7cdEBHr2d6wy54ifedaiLciy6klXs+DHE1VPkSUdWtVNKZ1aM8Fh jgQ3oi5+AmjqA== Received: from u-boot.org (unknown [73.34.74.121]) by mail.u-boot.org (Postfix) with ESMTPSA id 336FB67E83; Fri, 3 Oct 2025 10:56:42 -0600 (MDT) From: Simon Glass <sjg@u-boot.org> To: U-Boot Concept <concept@u-boot.org> Date: Fri, 3 Oct 2025 10:55:08 -0600 Message-ID: <20251003165525.440173-16-sjg@u-boot.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20251003165525.440173-1-sjg@u-boot.org> References: <20251003165525.440173-1-sjg@u-boot.org> MIME-Version: 1.0 Message-ID-Hash: 5AXCAL3XW36CO3AQAJZBDXPMXST6KPDM X-Message-ID-Hash: 5AXCAL3XW36CO3AQAJZBDXPMXST6KPDM 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 <xypron.glpk@gmx.de>, Simon Glass <sjg@chromium.org>, Claude <noreply@anthropic.com> X-Mailman-Version: 3.3.10 Precedence: list Subject: [Concept] [PATCH 15/22] video: Rename video_sync() to sync() in struct video_ops List-Id: Discussion and patches related to U-Boot Concept <concept.u-boot.org> Archived-At: <https://lists.u-boot.org/archives/list/concept@u-boot.org/message/5AXCAL3XW36CO3AQAJZBDXPMXST6KPDM/> List-Archive: <https://lists.u-boot.org/archives/list/concept@u-boot.org/> List-Help: <mailto:concept-request@u-boot.org?subject=help> List-Owner: <mailto:concept-owner@u-boot.org> List-Post: <mailto:concept@u-boot.org> List-Subscribe: <mailto:concept-join@u-boot.org> List-Unsubscribe: <mailto:concept-leave@u-boot.org> From: Simon Glass <sjg@chromium.org> Shorten the video_sync member in struct video_ops to just sync() since the struct name already provides the context that this is a video operation. Update all implementations and callers of this operation. Co-developed-by: Claude <noreply@anthropic.com> Signed-off-by: Simon Glass <sjg@chromium.org> --- drivers/video/efi.c | 2 +- drivers/video/mcde_simple.c | 2 +- drivers/video/seps525.c | 2 +- drivers/video/video-uclass.c | 4 ++-- include/video.h | 12 ++++++------ 5 files changed, 11 insertions(+), 11 deletions(-) diff --git a/drivers/video/efi.c b/drivers/video/efi.c index 1fe76f27bcc..578392c3908 100644 --- a/drivers/video/efi.c +++ b/drivers/video/efi.c @@ -291,7 +291,7 @@ static int efi_video_bind(struct udevice *dev) } const static struct video_ops efi_video_ops = { - .video_sync = efi_video_sync, + .sync = efi_video_sync, }; static const struct udevice_id efi_video_ids[] = { diff --git a/drivers/video/mcde_simple.c b/drivers/video/mcde_simple.c index 2ba5d0de152..7591e088e38 100644 --- a/drivers/video/mcde_simple.c +++ b/drivers/video/mcde_simple.c @@ -122,7 +122,7 @@ static int mcde_simple_video_sync(struct udevice *dev) } static struct video_ops mcde_simple_ops = { - .video_sync = mcde_simple_video_sync, + .sync = mcde_simple_video_sync, }; static const struct udevice_id mcde_simple_ids[] = { diff --git a/drivers/video/seps525.c b/drivers/video/seps525.c index 86cd301c4b9..11293872a5c 100644 --- a/drivers/video/seps525.c +++ b/drivers/video/seps525.c @@ -306,7 +306,7 @@ static int seps525_bind(struct udevice *dev) } static const struct video_ops seps525_ops = { - .video_sync = seps525_sync, + .sync = seps525_sync, }; static const struct udevice_id seps525_ids[] = { diff --git a/drivers/video/video-uclass.c b/drivers/video/video-uclass.c index 5c2cb251683..bf633861ef3 100644 --- a/drivers/video/video-uclass.c +++ b/drivers/video/video-uclass.c @@ -507,8 +507,8 @@ int video_sync(struct udevice *vid, bool force) if (IS_ENABLED(CONFIG_VIDEO_COPY)) video_flush_copy(vid); - if (ops && ops->video_sync) { - ret = ops->video_sync(vid); + if (ops && ops->sync) { + ret = ops->sync(vid); if (ret) return ret; } diff --git a/include/video.h b/include/video.h index 92dca60a872..116a10afc93 100644 --- a/include/video.h +++ b/include/video.h @@ -133,14 +133,14 @@ struct video_priv { /** * struct video_ops - structure for keeping video operations - * @video_sync: Synchronize FB with device. Some device like SPI based LCD - * displays needs synchronization when data in an FB is available. - * For these devices implement video_sync hook to call a sync - * function. vid is pointer to video device udevice. Function - * should return 0 on success video_sync and error code otherwise + * @sync: Synchronize FB with device. Some device like SPI based LCD + * displays needs synchronization when data in an FB is available. + * For these devices implement sync hook to call a sync function. + * vid is pointer to video device udevice. Function should return 0 + * on success and error code otherwise */ struct video_ops { - int (*video_sync)(struct udevice *vid); + int (*sync)(struct udevice *vid); }; #define video_get_ops(dev) ((struct video_ops *)(dev)->driver->ops) From patchwork Fri Oct 3 16:55:09 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass <sjg@u-boot.org> X-Patchwork-Id: 497 Return-Path: <concept-bounces+u-boot-concept=u-boot.org@u-boot.org> 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=1759510610; bh=twKIZIIT3hVU2x3tz/WNpoNyJ4ZE0JXtT3l6lNBUj3Y=; 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=e630uCl62zjENS1BXWTsD1IfS8ZTlV0j4NmqrrymKzJdwCa4BTuOZKNezdosEVgjO JcYbwORF7JnuCmmqAV5GMmdWVtSP69oCvjPo4rS/wEn9T19dlxx0SmJ+FAuv5VVOHe Ceh/FeK1irRiGSn5apbBJEXklQ1297XiWhDNkaNidU/PX2B3l6KdNrpIObg/kJ3lxX WEB75hz35ramgWpYMKby9aLFTkx9doO1Ff5ht2Zi3IbqMHKzxzaTbHxebBoVRwl6/B hF7UKhRgcKPv0mgdcc3EeUnO0H3r/hv3imiSKxb/s4wFLHzyuvuw5RceyyAiWp3r8F IsrhH43m6N4Wg== Received: from localhost (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id DECFB67EBF for <u-boot-concept@u-boot.org>; Fri, 3 Oct 2025 10:56: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 10024) with ESMTP id 41Z5qDsOiIla for <u-boot-concept@u-boot.org>; Fri, 3 Oct 2025 10:56:50 -0600 (MDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1759510610; bh=twKIZIIT3hVU2x3tz/WNpoNyJ4ZE0JXtT3l6lNBUj3Y=; 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=e630uCl62zjENS1BXWTsD1IfS8ZTlV0j4NmqrrymKzJdwCa4BTuOZKNezdosEVgjO JcYbwORF7JnuCmmqAV5GMmdWVtSP69oCvjPo4rS/wEn9T19dlxx0SmJ+FAuv5VVOHe Ceh/FeK1irRiGSn5apbBJEXklQ1297XiWhDNkaNidU/PX2B3l6KdNrpIObg/kJ3lxX WEB75hz35ramgWpYMKby9aLFTkx9doO1Ff5ht2Zi3IbqMHKzxzaTbHxebBoVRwl6/B hF7UKhRgcKPv0mgdcc3EeUnO0H3r/hv3imiSKxb/s4wFLHzyuvuw5RceyyAiWp3r8F IsrhH43m6N4Wg== Received: from mail.u-boot.org (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id CDA4867E83 for <u-boot-concept@u-boot.org>; Fri, 3 Oct 2025 10:56:50 -0600 (MDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1759510609; bh=6rU+HS/2y6/FopCEPUCiiiSX4DzgHUWd1JHggEtSJF8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=coSS2N4qfvGTUfLJIk3wQOlFwEnCXoEEj/0ZEy3mqDHZ4woc3eECl/iKkKtsGwsBa mOYJikdHbTNze4yfqwhde3BSI1AiP6x/iBx5IAhJj9oP14hEzXewRIOSRrUZKOHnen wlHXw5bYMXcJ56edA/SeE/3T2KzLNglZblcA8kxBzRgyH0VyT9KrUNo/e2mhG1u+VM xO1Fe7OM2QSsBEj8Jvhj4ZYjm9gAmYBr6yrcQgR+EbYGeawNj82InmJ4lsSB+ljKBS 25D3aQQPX8ACQy/IP0Cw8L/a3AfvCALEpcJu+UDWcDYQ2lZO1plOinpClJbsFvGG07 XXu/LeTIf3TTQ== Received: from localhost (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id 28E3A67E12; Fri, 3 Oct 2025 10:56:49 -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 wyRr9zYMJRGV; Fri, 3 Oct 2025 10:56:49 -0600 (MDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1759510604; bh=p10I8BgtJC1cMFvqg16HnivQHOh4m7ZXdT8We2AMi5A=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=f70Ht8icu7SKldSDIWaxcYpaTbaYuzmjWgl9HRUiS4WvGM6ZwwuYCXFr9WmJEnbDb pURTx6s6Q2OgrRncZEVqrZ/liekqEky0zB2HsMKMgeEgR/J0smKNz/NhLrynMdeX3F TD8gKJgR/BGT5qHCSvYm+6H+ZdifrENtbU3H5oEc2kLfQYVKeCeXA4hPO1IsufaqPX Us+ET5C6l4xVVeTAE7/dq8f7nTDxqkm78vvq6Y/LRjbqi5m5R+Mci2EI/0M6KV1kuM vxNiEYmNRm+hc3sS+EJJkV8sOAqmtOWHGhlBhvDCj88J5HWwu9ogwdorcgO4FXWHDg KnjHCtCJoPNUw== Received: from u-boot.org (unknown [73.34.74.121]) by mail.u-boot.org (Postfix) with ESMTPSA id 3DD4B67E83; Fri, 3 Oct 2025 10:56:44 -0600 (MDT) From: Simon Glass <sjg@u-boot.org> To: U-Boot Concept <concept@u-boot.org> Date: Fri, 3 Oct 2025 10:55:09 -0600 Message-ID: <20251003165525.440173-17-sjg@u-boot.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20251003165525.440173-1-sjg@u-boot.org> References: <20251003165525.440173-1-sjg@u-boot.org> MIME-Version: 1.0 Message-ID-Hash: PWLTCCAYSBNJSLS37CJYAEDDQ3B2WX75 X-Message-ID-Hash: PWLTCCAYSBNJSLS37CJYAEDDQ3B2WX75 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 <xypron.glpk@gmx.de>, Simon Glass <sjg@chromium.org> X-Mailman-Version: 3.3.10 Precedence: list Subject: [Concept] [PATCH 16/22] video: Tidy up the comment for sync() List-Id: Discussion and patches related to U-Boot Concept <concept.u-boot.org> Archived-At: <https://lists.u-boot.org/archives/list/concept@u-boot.org/message/PWLTCCAYSBNJSLS37CJYAEDDQ3B2WX75/> List-Archive: <https://lists.u-boot.org/archives/list/concept@u-boot.org/> List-Help: <mailto:concept-request@u-boot.org?subject=help> List-Owner: <mailto:concept-owner@u-boot.org> List-Post: <mailto:concept@u-boot.org> List-Subscribe: <mailto:concept-join@u-boot.org> List-Unsubscribe: <mailto:concept-leave@u-boot.org> From: Simon Glass <sjg@chromium.org> Adjust this comment to match the style of other uclasses. Signed-off-by: Simon Glass <sjg@chromium.org> --- include/video.h | 20 ++++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-) diff --git a/include/video.h b/include/video.h index 116a10afc93..3ce603384dc 100644 --- a/include/video.h +++ b/include/video.h @@ -133,14 +133,22 @@ struct video_priv { /** * struct video_ops - structure for keeping video operations - * @sync: Synchronize FB with device. Some device like SPI based LCD - * displays needs synchronization when data in an FB is available. - * For these devices implement sync hook to call a sync function. - * vid is pointer to video device udevice. Function should return 0 - * on success and error code otherwise */ struct video_ops { - int (*sync)(struct udevice *vid); + /** + * @sync() - Synchronize FB with device + * + * Some devices like SPI-based LCD displays needs synchronization when + * data in a framebuffer is available. These devices can implement this + * method which is called whenever a video device is synced. + * + * Note that if CONFIG_VIDEO_DAMAGE is enabled, the driver can use this + * to optimise the region to redraw. + * + * @dev: Video device + * Return 0 on success, or -ve error code + */ + int (*sync)(struct udevice *dev); }; #define video_get_ops(dev) ((struct video_ops *)(dev)->driver->ops) From patchwork Fri Oct 3 16:55:10 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass <sjg@u-boot.org> X-Patchwork-Id: 498 Return-Path: <concept-bounces+u-boot-concept=u-boot.org@u-boot.org> 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=1759510613; bh=iCr+DBZ2tP1xOvE2IWjfmASjr7a2H37kVMBoh6ERLcY=; 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=AhrUdP00Ob34i/isuRA/Vnc0qN7VuofvPGO4FViizLSiLoirVM/kZ8o6no27FdSla skkLA64OW0aJKzEWiPEWsuR4Ow78xDVzme7qRN3B42d8xrHJTulA1RLAMirKf7UcYi VpRzeyLPGluAVg+GMCLyiL7f9owtpKOMRRURXQXI3zfOVKS2O5bUk33pUDW/c1Hqqs A883ufwkWNJxX+OSt+jBOelqz7GFLOyMku4IXFpm1kP4ETR8KYzBVEJc1ICGdFe9a1 qTjDcfsUubNds4LK+LDjl7f4xtsoENi6ucugn+2BPgoCgSM+OEl7cpFDCMTshOpPZL /EO0YYIeJvTcw== Received: from localhost (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id 63CAE67DC0 for <u-boot-concept@u-boot.org>; Fri, 3 Oct 2025 10:56:53 -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 EN7d7yap40mh for <u-boot-concept@u-boot.org>; Fri, 3 Oct 2025 10:56:53 -0600 (MDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1759510612; bh=iCr+DBZ2tP1xOvE2IWjfmASjr7a2H37kVMBoh6ERLcY=; 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=Eq6fHNm1/MKeDdTgsGxDqHcL+FHQKwVq46AFP0rBf6+OEGNZfBslXTAGwrd2XtnA/ 9LYbC8wPjNQ/DEVUDQx9TeLCK3h17eUszKef847+Hd7BSbY+rEqZ1Tzl185Oet5Bjj g0etAB9PWgVUSi9Gs8tpQpsDfdQu86hTD6Da0Sna5zMNqw8s30N1uv/zWuWFvkIwoF QWxMVRvWQ761dLn11LXfCw4z4HclaXz8AzjyQf+n3oWlX5E8FiSaaxWPj6HPaYS9O2 +98MVd3ilKmfyi3b/uOuJUSmInfUGLptLFHlrMQAqAn2lCtCsxFBGxZ509vF7/H3GH BatCUxWRY+83w== Received: from mail.u-boot.org (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id C392F67E82 for <u-boot-concept@u-boot.org>; Fri, 3 Oct 2025 10:56:52 -0600 (MDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1759510610; bh=7iMhMtzps54AWlTa+KuKAEcnzr36HGHFEyl4/JGDFVo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=mO/O9mmCpAimUCyNAGYFu+hUspUYvj6aYYa9XC3/pls9RNe62PvH+vhFLkKe0qnKz FZwOq0H+UgObGI9mwO7oM6CuYffqEyzy25Jm5TAz+Lq7Ye/6FofwXWQ4yAQe3L83jC 5CLM9DCsW7+44/XvEYQx4mDRIVdbw10+AMd2xjsvQkHDTykb/1qLkAIRjEQgU+7AQM DT5zXrJYjMvPGFvMFq/FimEMNMOX+Yl38M7OS/XQ5dX3y3p5wGlbPEXchw7eyi/Wqj wEZZ3IDtGOSaqLqVNJL4RI78Ig2Lu4dK1zinb7i3W1WbWgOSMtNfrO86OtiEDbQWQu TODUrVCymF1Mg== Received: from localhost (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id AAEE867E82; Fri, 3 Oct 2025 10:56: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 f3CTe63PZFo1; Fri, 3 Oct 2025 10:56:50 -0600 (MDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1759510609; bh=VDthGSL0IkgLd1Q9W2q9GzobxdlzeKb4u7kNXy1kWZE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=iABXDHJ/7REXkCFQX/Sh3xxeD+6kLR1BZR60PLJEZ+oiZ8tNYaVh3zD7b4YzsXKC3 Nv74+EmblVmGG+/7sxMQB0t45miKUcjZtXGhTEs+HIabkqfk0NtytEtU8J/rAsMvyU PfID235n/4GWWTrhPezCxA9h/dSUbsKCnR6lEGr7gnlG9ml8fJm2YUvPVsyZllwpzH UN/ryr0Pxp77u+aGnnPPz/0zohjjYhmBR7JmvWkfoz5VBZOzm7MKKn/beySaYTR5Mm 5fuFIqe7MHjqPgsvzeAgLGBsBtERHWGUF1s4WLnjyvHFR/TiwVEe+0zYM+atBs8Bbb dT2LOYG9y2zdA== Received: from u-boot.org (unknown [73.34.74.121]) by mail.u-boot.org (Postfix) with ESMTPSA id E3E8F67DC0; Fri, 3 Oct 2025 10:56:48 -0600 (MDT) From: Simon Glass <sjg@u-boot.org> To: U-Boot Concept <concept@u-boot.org> Date: Fri, 3 Oct 2025 10:55:10 -0600 Message-ID: <20251003165525.440173-18-sjg@u-boot.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20251003165525.440173-1-sjg@u-boot.org> References: <20251003165525.440173-1-sjg@u-boot.org> MIME-Version: 1.0 Message-ID-Hash: NOL3KA6SPOXDXLPJTVSAYKMUVDSZZYEJ X-Message-ID-Hash: NOL3KA6SPOXDXLPJTVSAYKMUVDSZZYEJ 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 <xypron.glpk@gmx.de>, Simon Glass <sjg@chromium.org> X-Mailman-Version: 3.3.10 Precedence: list Subject: [Concept] [PATCH 17/22] video: Provide a way for expo to control video sync List-Id: Discussion and patches related to U-Boot Concept <concept.u-boot.org> Archived-At: <https://lists.u-boot.org/archives/list/concept@u-boot.org/message/NOL3KA6SPOXDXLPJTVSAYKMUVDSZZYEJ/> List-Archive: <https://lists.u-boot.org/archives/list/concept@u-boot.org/> List-Help: <mailto:concept-request@u-boot.org?subject=help> List-Owner: <mailto:concept-owner@u-boot.org> List-Post: <mailto:concept@u-boot.org> List-Subscribe: <mailto:concept-join@u-boot.org> List-Unsubscribe: <mailto:concept-leave@u-boot.org> From: Simon Glass <sjg@chromium.org> When expo is being used, it should only redraw the display when it has made changes. Add a new 'manual sync' mode which tells the video subsystem to ignore video syncs from other sources. This also disables the idle feature, since it can interfere with tests. Signed-off-by: Simon Glass <sjg@chromium.org> --- drivers/video/video-uclass.c | 35 ++++++++++++++++++++++++ include/video.h | 10 +++++++ test/dm/video.c | 52 ++++++++++++++++++++++++++++++++++++ 3 files changed, 97 insertions(+) diff --git a/drivers/video/video-uclass.c b/drivers/video/video-uclass.c index bf633861ef3..f8ba3abc5f4 100644 --- a/drivers/video/video-uclass.c +++ b/drivers/video/video-uclass.c @@ -65,11 +65,13 @@ struct cyclic_info; * gd->video_top and works downwards, running out of space when it hits * gd->video_bottom. * @cyc_active: true if cyclic video sync is currently registered + * @manual_sync: true if manual-sync mode is active (caller controls video sync) * @cyc: handle for cyclic-execution function, or NULL if none */ struct video_uc_priv { ulong video_ptr; bool cyc_active; + bool manual_sync; struct cyclic_info cyc; }; @@ -501,9 +503,14 @@ static void video_flush_copy(struct udevice *vid) 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); struct video_ops *ops = video_get_ops(vid); int ret; + /* Skip sync if manual-sync mode is active */ + if (uc_priv->manual_sync) + return 0; + if (IS_ENABLED(CONFIG_VIDEO_COPY)) video_flush_copy(vid); @@ -622,6 +629,20 @@ int video_default_font_height(struct udevice *dev) static void video_idle(struct cyclic_info *cyc) { + struct video_uc_priv *uc_priv; + struct uclass *uc; + int ret; + + ret = uclass_get(UCLASS_VIDEO, &uc); + if (ret) + return; + + uc_priv = uclass_get_priv(uc); + + /* Skip sync if manual-sync mode is active */ + if (uc_priv->manual_sync) + return; + if (CONFIG_IS_ENABLED(CURSOR)) { struct udevice *cons; struct uclass *uc; @@ -809,6 +830,20 @@ __maybe_unused static int video_destroy(struct uclass *uc) return 0; } +void video_set_manual_sync(bool enable) +{ + struct video_uc_priv *uc_priv; + struct uclass *uc; + int ret; + + ret = uclass_get(UCLASS_VIDEO, &uc); + if (ret) + return; + + uc_priv = uclass_get_priv(uc); + uc_priv->manual_sync = enable; +} + UCLASS_DRIVER(video) = { .id = UCLASS_VIDEO, .name = "video", diff --git a/include/video.h b/include/video.h index 3ce603384dc..3f5c8cbd45a 100644 --- a/include/video.h +++ b/include/video.h @@ -543,4 +543,14 @@ static inline bool video_is_visible(void) #endif } +/** + * video_set_manual_sync() - Set manual-sync mode for video subsystem + * + * When manual-sync mode is enabled, automatic video sync operations are + * suppressed to allow the caller to control rendering timing. + * + * @enable: true to enable manual-sync mode, false to disable + */ +void video_set_manual_sync(bool enable); + #endif diff --git a/test/dm/video.c b/test/dm/video.c index 7ada4c75bf7..cee9e528689 100644 --- a/test/dm/video.c +++ b/test/dm/video.c @@ -1293,3 +1293,55 @@ static int dm_test_video_images(struct unit_test_state *uts) return 0; } DM_TEST(dm_test_video_images, UTF_SCAN_PDATA | UTF_SCAN_FDT | UTF_CONSOLE); + +/* Test manual-sync mode suppresses auto-sync */ +static int dm_test_video_manual_sync(struct unit_test_state *uts) +{ + struct video_priv *priv; + struct udevice *dev, *con; + + ut_assertok(select_vidconsole(uts, "vidconsole0")); + ut_assertok(video_get_nologo(uts, &dev)); + ut_assertok(uclass_get_device(UCLASS_VIDEO_CONSOLE, 0, &con)); + priv = dev_get_uclass_priv(dev); + + /* Write some text and verify it appears in the framebuffer */ + vidconsole_put_string(con, "Test"); + ut_asserteq(118, video_compress_fb(uts, dev, false)); + + /* Sync to copy buffer before enabling manual-sync mode */ + ut_assertok(video_sync(dev, true)); + + /* Enable manual-sync mode - sync should be suppressed */ + video_set_manual_sync(true); + + /* Clear and write new text - auto-sync should not happen */ + video_clear(dev); + vidconsole_put_string(con, "Manual Sync"); + + /* should do nothing in manual-sync mode */ + ut_assertok(video_sync(dev, false)); + + /* The copy framebuffer should still show old content */ + if (IS_ENABLED(CONFIG_VIDEO_COPY)) { + ut_assertf(memcmp(priv->fb, priv->copy_fb, priv->fb_size), + "Copy fb should not match fb in manual-sync mode"); + } + + /* + * video_sync() with force=true should still do nothing, except of + * course that without a copy framebuffer the string will be present on + * (only) framebuffer + */ + ut_assertok(video_sync(dev, true)); + if (IS_ENABLED(CONFIG_VIDEO_COPY)) { + ut_asserteq(118, video_compress_fb(uts, dev, true)); + ut_assertf(memcmp(priv->fb, priv->copy_fb, priv->fb_size), + "Copy fb should not match fb in manual-sync mode"); + } else { + ut_asserteq(183, video_compress_fb(uts, dev, true)); + } + + return 0; +} +DM_TEST(dm_test_video_manual_sync, UTF_SCAN_PDATA | UTF_SCAN_FDT); From patchwork Fri Oct 3 16:55:11 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass <sjg@u-boot.org> X-Patchwork-Id: 499 Return-Path: <concept-bounces+u-boot-concept=u-boot.org@u-boot.org> 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=1759510617; bh=9T1P4ItSj53IqF2damTqviFx9E7WU1/BCqI6y/pr8qg=; 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=w8rYoyqwtGi3BcGuKjLjy0WrUFOCXtLgtkX3JdeFDm2flW1tfvL+Zr1VfJXONsrpn +hv1CjO3MqEPWOPz0W3Nx/uwB8WO2wOR9zWCo0B2rhJvupfV2ZTrBjsGASgtrI9pnQ +mcjdDcqqV0rIkB4eHFzlTz2Xk6n18ScwpHeGrXlNaTIuHsij7ZrRvz27sYBHQDlb+ JVLxE8n/Hf699rEZkuCB56ThNiQajLe7bYL+e6SZCcTCLCjkZUooe4cad8guNHrU9K BPW5WB0MBpJDTJBUydsmn0xFlbRyCQyXHnVsZcyMfLIMJE1/XngtdaSkuV78YQx94b 1GBt30z5qFzfQ== Received: from localhost (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id 6A9CD67EC5 for <u-boot-concept@u-boot.org>; Fri, 3 Oct 2025 10:56: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 10024) with ESMTP id uYr4ES269wqJ for <u-boot-concept@u-boot.org>; Fri, 3 Oct 2025 10:56:57 -0600 (MDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1759510617; bh=9T1P4ItSj53IqF2damTqviFx9E7WU1/BCqI6y/pr8qg=; 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=w8rYoyqwtGi3BcGuKjLjy0WrUFOCXtLgtkX3JdeFDm2flW1tfvL+Zr1VfJXONsrpn +hv1CjO3MqEPWOPz0W3Nx/uwB8WO2wOR9zWCo0B2rhJvupfV2ZTrBjsGASgtrI9pnQ +mcjdDcqqV0rIkB4eHFzlTz2Xk6n18ScwpHeGrXlNaTIuHsij7ZrRvz27sYBHQDlb+ JVLxE8n/Hf699rEZkuCB56ThNiQajLe7bYL+e6SZCcTCLCjkZUooe4cad8guNHrU9K BPW5WB0MBpJDTJBUydsmn0xFlbRyCQyXHnVsZcyMfLIMJE1/XngtdaSkuV78YQx94b 1GBt30z5qFzfQ== Received: from mail.u-boot.org (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id 5391367E86 for <u-boot-concept@u-boot.org>; Fri, 3 Oct 2025 10:56:57 -0600 (MDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1759510615; bh=tVTZSylEIp6g7CrnFj/GynyURuIT6UEHgM4gSHB01RI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=T4dnO9XnWcz3JGcp8MV8awZoep0PuYlok81+jtDgdXbDwa+Aug+YnVG4zIhKCdm54 WgnNoInrP0xw6aHFZOtOWO2rd6g1kUgbm/1IpSfmnrFNd+/SEdPMqfpsBFpljer8CV 8Murtz0c7bF0YmtHMsb0/uvFummw3JXGE9oRdTQn5PEQ8nToyiZhrQBwQ1ZeGXoi6M +tHHO7r6V+5YZPPi/3t0G27cDdH1AtCyoMbCJMjBYyRi3xTY0eRDDwSTHBova37rcp Fk17GvH/ryFt6/CRlssr6yxDavlwmz6PmLKu03MtAvd9+3KjMgFwax5K05RD6V3BA+ 49iAxFWpWqNDA== Received: from localhost (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id BC77167E12; Fri, 3 Oct 2025 10:56:55 -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 H1PBp9tVwF74; Fri, 3 Oct 2025 10:56:55 -0600 (MDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1759510611; bh=qlKBXeTJshejRTrnNeMTnB/Kt+iNNOzswcxb/eKBwpo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=KQB/JigiNUfUHoTrtfsuCpnlq+5PmccJBPNjAmIALwYJnmYMYlNaeZNVyAZ/wYGjN 9l5cwQ0Qq33D8/mPhjH5sqBVgW4bLQU7DOySyjtRc3z+/dmKNla9I9LVAZzZTblchu 95/y1h8uV7jGESYbwCG/HgV0zKCDuO5gsX5CUXgYs5NdqMKrB8OTlL/tq0uFDN/6ON 4exgqR7Dys+K15Ddn+sjntD1kWnH+XFLc7NLWpxt3YKScrsWyYPxuotsoNezHNfbKm XhiP6ImyaDZx+vb560qQzCOcfBLLGXkEDjsyCWNa6a9tZSflTnNH5agU5zBKd/kQDg JXKqh38VOKyWw== Received: from u-boot.org (unknown [73.34.74.121]) by mail.u-boot.org (Postfix) with ESMTPSA id EE59567ECA; Fri, 3 Oct 2025 10:56:50 -0600 (MDT) From: Simon Glass <sjg@u-boot.org> To: U-Boot Concept <concept@u-boot.org> Date: Fri, 3 Oct 2025 10:55:11 -0600 Message-ID: <20251003165525.440173-19-sjg@u-boot.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20251003165525.440173-1-sjg@u-boot.org> References: <20251003165525.440173-1-sjg@u-boot.org> MIME-Version: 1.0 Message-ID-Hash: QX7HOD3BCLVY62AG5INT7CPVNV35H37T X-Message-ID-Hash: QX7HOD3BCLVY62AG5INT7CPVNV35H37T 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 <xypron.glpk@gmx.de>, Simon Glass <sjg@chromium.org>, Claude <noreply@anthropic.com> X-Mailman-Version: 3.3.10 Precedence: list Subject: [Concept] [PATCH 18/22] video: Add flags parameter to sync() operation List-Id: Discussion and patches related to U-Boot Concept <concept.u-boot.org> Archived-At: <https://lists.u-boot.org/archives/list/concept@u-boot.org/message/QX7HOD3BCLVY62AG5INT7CPVNV35H37T/> List-Archive: <https://lists.u-boot.org/archives/list/concept@u-boot.org/> List-Help: <mailto:concept-request@u-boot.org?subject=help> List-Owner: <mailto:concept-owner@u-boot.org> List-Post: <mailto:concept@u-boot.org> List-Subscribe: <mailto:concept-join@u-boot.org> List-Unsubscribe: <mailto:concept-leave@u-boot.org> From: Simon Glass <sjg@chromium.org> Add an enum video_sync_flags with VIDSYNC_FORCE, VIDSYNC_FLUSH, and VIDSYNC_COPY flags and update the sync() operation in struct video_ops to accept a flags parameter. This allows for more flexible control of video sync behavior. The VIDSYNC_FLUSH flag is set when a full flush should be performed, and the VIDSYNC_COPY flag indicates whether the framebuffer should be flushed to the copy buffer. The logic is now calculated before calling sync() so drivers can observe these states. Co-developed-by: Claude <noreply@anthropic.com> Signed-off-by: Simon Glass <sjg@chromium.org> --- drivers/video/efi.c | 2 +- drivers/video/mcde_simple.c | 2 +- drivers/video/seps525.c | 2 +- drivers/video/video-uclass.c | 14 +++++++++++--- include/video.h | 15 ++++++++++++++- 5 files changed, 28 insertions(+), 7 deletions(-) diff --git a/drivers/video/efi.c b/drivers/video/efi.c index 578392c3908..b5e472395e9 100644 --- a/drivers/video/efi.c +++ b/drivers/video/efi.c @@ -43,7 +43,7 @@ struct efi_video_priv { bool use_blit; }; -static int efi_video_sync(struct udevice *dev) +static int efi_video_sync(struct udevice *dev, uint flags) { struct video_priv *vid_priv = dev_get_uclass_priv(dev); struct efi_video_priv *priv = dev_get_priv(dev); diff --git a/drivers/video/mcde_simple.c b/drivers/video/mcde_simple.c index 7591e088e38..9dd9c382644 100644 --- a/drivers/video/mcde_simple.c +++ b/drivers/video/mcde_simple.c @@ -94,7 +94,7 @@ static int mcde_simple_probe(struct udevice *dev) return 0; } -static int mcde_simple_video_sync(struct udevice *dev) +static int mcde_simple_video_sync(struct udevice *dev, uint flags) { struct mcde_simple_priv *priv = dev_get_priv(dev); unsigned int val; diff --git a/drivers/video/seps525.c b/drivers/video/seps525.c index 11293872a5c..aaf716cb65d 100644 --- a/drivers/video/seps525.c +++ b/drivers/video/seps525.c @@ -221,7 +221,7 @@ static int seps525_spi_startup(struct udevice *dev) return 0; } -static int seps525_sync(struct udevice *vid) +static int seps525_sync(struct udevice *vid, uint flags) { struct video_priv *uc_priv = dev_get_uclass_priv(vid); struct seps525_priv *priv = dev_get_priv(vid); diff --git a/drivers/video/video-uclass.c b/drivers/video/video-uclass.c index f8ba3abc5f4..8f5689a8a51 100644 --- a/drivers/video/video-uclass.c +++ b/drivers/video/video-uclass.c @@ -505,23 +505,31 @@ 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); struct video_ops *ops = video_get_ops(vid); + uint flags = 0; int ret; /* Skip sync if manual-sync mode is active */ if (uc_priv->manual_sync) return 0; + if (force) + flags |= VIDSYNC_FORCE; + + /* Check if sync should do full flush */ + if (!CONFIG_IS_ENABLED(CYCLIC) || force || + get_timer(priv->last_sync) >= CONFIG_VIDEO_SYNC_MS) + flags |= VIDSYNC_FLUSH; + if (IS_ENABLED(CONFIG_VIDEO_COPY)) video_flush_copy(vid); if (ops && ops->sync) { - ret = ops->sync(vid); + ret = ops->sync(vid, flags); if (ret) return ret; } - if (CONFIG_IS_ENABLED(CYCLIC) && !force && - get_timer(priv->last_sync) < CONFIG_VIDEO_SYNC_MS) + if (!(flags & VIDSYNC_FLUSH)) return 0; video_flush_dcache(vid, false); diff --git a/include/video.h b/include/video.h index 3f5c8cbd45a..d08781d3a78 100644 --- a/include/video.h +++ b/include/video.h @@ -10,6 +10,7 @@ #include <linker_lists.h> #include <stdio_dev.h> #include <video_defs.h> +#include <linux/bitops.h> #ifdef CONFIG_SANDBOX #include <asm/state.h> #endif @@ -74,6 +75,17 @@ enum video_format { VIDEO_X2R10G10B10, }; +/** + * enum video_sync_flags - Flags for video_sync() operations + * + * @VIDSYNC_FORCE: Force sync even if recently synced or in manual-sync mode + * @VIDSYNC_FLUSH: Flush dcache and perform full sync operations + */ +enum video_sync_flags { + VIDSYNC_FORCE = BIT(0), + VIDSYNC_FLUSH = BIT(1), +}; + /** * struct video_priv - Device information used by the video uclass * @@ -146,9 +158,10 @@ struct video_ops { * to optimise the region to redraw. * * @dev: Video device + * @flags: Flags for the sync operation (enum video_sync_flags) * Return 0 on success, or -ve error code */ - int (*sync)(struct udevice *dev); + int (*sync)(struct udevice *dev, uint flags); }; #define video_get_ops(dev) ((struct video_ops *)(dev)->driver->ops) From patchwork Fri Oct 3 16:55:12 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass <sjg@u-boot.org> X-Patchwork-Id: 500 Return-Path: <concept-bounces+u-boot-concept=u-boot.org@u-boot.org> 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=1759510619; bh=wz6T8D6AnZRehsCCE6/02hpEU9zIqHRlyjlMiysmnLI=; 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=FEZQs7STmEBWqwDJNcOvZNNb7zpYLvz/AZsbnkaq/RLpaAeUpXDepu85TDl5zSz2b Ahai6UzipEOkPDt4tEbZ71lGYzYQm7lN8amNgbpDUmM77ZtTNYzvpXBJv++nMtAyTd TwCsgbKA62uAmEr3DTRtXVJtOH4BAMkxxEXaGr7cjzx9yyrAmEn8mdueR3kDzEeiy8 qRU9o98PDSMvvEftrjEuHEQcIJSPbWs/sskf8Nr8/rlPKtzXTtac3u2jGVVXDepIxi wYd+g+7B15/eqIVKD7xh8P9lZ9hrym/hgKfBRcCqxZwjqE5pzVRYVOD3Dq1eldu56m ZpbN0ijEY0COg== Received: from localhost (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id C885F67F46 for <u-boot-concept@u-boot.org>; Fri, 3 Oct 2025 10:56:59 -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 LrgozLCdZxpu for <u-boot-concept@u-boot.org>; Fri, 3 Oct 2025 10:56:59 -0600 (MDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1759510618; bh=wz6T8D6AnZRehsCCE6/02hpEU9zIqHRlyjlMiysmnLI=; 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=kPrFAz5QH4DZQjGYGsMhSfkO/3tMdl0lg3sdYMxjA0Qh4PmkO74RR88q2+KoJypO5 /KJjg+Bx075HeS2WT5pkK5o0nnRQlJg+XnLOMrTTvyHBskj0UnfjgH+tAYcDPiQLAS icdq28Q4keLnaUl+jpDDXpmCRYE5ieKpTKvJupz2kKaw5poKW0J7n915G8NvrEMgmL gR7nPnerPVLC/tyPKfrnHLOJWUq4l3W/g7kYCfE0SWVhIEqiLZ+5ksnSfQvlhSL+km BOp+SwCZzm/plilREkl0fOanKI6BSuDmJioVkTvvD10fVs5PUMt40XjsBBhOlgKVzp BQ3RqjtsLkVmA== Received: from mail.u-boot.org (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id D60C567E86 for <u-boot-concept@u-boot.org>; Fri, 3 Oct 2025 10:56:58 -0600 (MDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1759510617; bh=GatLQG762X8iw4Yyajl7TzQmFgPGNm8JTH5HO8bn+bs=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=YFK6ShiQYM1KOue4bEtQeZUAQD8sMdHEqqq4QwU1tJxcX2JqxobGu2gdr80noldcC gHUqwUFQiPE9fyfgUygK3hPqBYZQ2Nre7RC7NEYBEUV8J9LtnwHqlt457HfxoaCf42 TOpIR8hxYbQgdNxfm30A7mBsxkizBbE31EudRuSEAJlsXxrvrbnMt/JG3qhGS8ueui ftE3DYFSsPuxv7BV56aW8KEF1GWsHqNAzEQZolfitmnILPcXI9lvzw0GujjhlyZlU2 O16iD6WHizuHqNIroxS8C71uB+7ZjUCMBXzxb8fRUY+0CtFDOQI590SIWAbhbhs/gr ApwI0oHo3jZAg== Received: from localhost (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id 67FC467E85; Fri, 3 Oct 2025 10:56: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 itEzQYATfgmN; Fri, 3 Oct 2025 10:56:57 -0600 (MDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1759510615; bh=GcQHb5GbL/YvLtvJvt0nvHgYDDV8nuY8fTOu+e5+R28=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=RwOKBiWZ1UfI2OHeZkClOCwEfhUTrQ++hG0Ij59WgyRVM3q5V3i2ybCNZZbytyDYU oqB7vIZ9OGJNzcNmlGgxW/FWSI/i34zONZEz7VOhww6TRylD8smr+7iKApUOOP2K6r mISNeOoaT52R9RnIc8UEVh8pYJjr/gpsQFIe3+FxrY9afTBLAGVh1fsRLe6unBskZN tCwiWku1yrxFVs7w9SKqOW8JwjLXQRN2O0KUqhrvpfjH7X3a4U9MaJbgWksLbmTMva l1ZQUB+twURUbwOyC+XpN2WzS/GCUfuDqGXG4TG3xJiTvBJ5eSBBEQebOS1wxw6oKM YuxCGImAXe3YA== Received: from u-boot.org (unknown [73.34.74.121]) by mail.u-boot.org (Postfix) with ESMTPSA id 9846C67DC0; Fri, 3 Oct 2025 10:56:55 -0600 (MDT) From: Simon Glass <sjg@u-boot.org> To: U-Boot Concept <concept@u-boot.org> Date: Fri, 3 Oct 2025 10:55:12 -0600 Message-ID: <20251003165525.440173-20-sjg@u-boot.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20251003165525.440173-1-sjg@u-boot.org> References: <20251003165525.440173-1-sjg@u-boot.org> MIME-Version: 1.0 Message-ID-Hash: TGVTCMVSWFMPLSRH7DLBM3QBCQ77LPXB X-Message-ID-Hash: TGVTCMVSWFMPLSRH7DLBM3QBCQ77LPXB 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 <xypron.glpk@gmx.de>, Simon Glass <sjg@chromium.org>, Claude <noreply@anthropic.com> X-Mailman-Version: 3.3.10 Precedence: list Subject: [Concept] [PATCH 19/22] video: Refactor video_sync() to use video_manual_sync() List-Id: Discussion and patches related to U-Boot Concept <concept.u-boot.org> Archived-At: <https://lists.u-boot.org/archives/list/concept@u-boot.org/message/TGVTCMVSWFMPLSRH7DLBM3QBCQ77LPXB/> List-Archive: <https://lists.u-boot.org/archives/list/concept@u-boot.org/> List-Help: <mailto:concept-request@u-boot.org?subject=help> List-Owner: <mailto:concept-owner@u-boot.org> List-Post: <mailto:concept@u-boot.org> List-Subscribe: <mailto:concept-join@u-boot.org> List-Unsubscribe: <mailto:concept-leave@u-boot.org> From: Simon Glass <sjg@chromium.org> Extract the core sync logic from video_sync() into a new video_manual_sync() function that accepts flags directly. This allows callers to perform sync operations with explicit control over the sync behavior. The video_sync() function now: - Determines the appropriate flags (VIDSYNC_FORCE, VIDSYNC_FLUSH, VIDSYNC_COPY) based on the force parameter and timing - Calls video_manual_sync() with those flags The video_manual_sync() function: - Takes explicit flags as a parameter - Handles VIDSYNC_COPY flag to control copy framebuffer flush - Performs the actual sync operations This separation allows manual-sync mode users (and tests) to call video_manual_sync() directly with custom flags while video_sync() continues to work as before for normal scenarios. Add tests for video_manual_sync() to check the behaviour with different flag combinations. Co-developed-by: Claude <noreply@anthropic.com> Signed-off-by: Simon Glass <sjg@chromium.org> --- drivers/video/video-uclass.c | 46 ++++++++++++++++++++++-------------- include/video.h | 16 +++++++++++++ test/dm/video.c | 27 +++++++++++++++++++++ 3 files changed, 71 insertions(+), 18 deletions(-) diff --git a/drivers/video/video-uclass.c b/drivers/video/video-uclass.c index 8f5689a8a51..a8849cf6289 100644 --- a/drivers/video/video-uclass.c +++ b/drivers/video/video-uclass.c @@ -499,28 +499,13 @@ static void video_flush_copy(struct udevice *vid) } } -/* Flush video activity to the caches */ -int video_sync(struct udevice *vid, bool force) +int video_manual_sync(struct udevice *vid, uint flags) { struct video_priv *priv = dev_get_uclass_priv(vid); - struct video_uc_priv *uc_priv = uclass_get_priv(vid->uclass); struct video_ops *ops = video_get_ops(vid); - uint flags = 0; int ret; - /* Skip sync if manual-sync mode is active */ - if (uc_priv->manual_sync) - return 0; - - if (force) - flags |= VIDSYNC_FORCE; - - /* Check if sync should do full flush */ - if (!CONFIG_IS_ENABLED(CYCLIC) || force || - get_timer(priv->last_sync) >= CONFIG_VIDEO_SYNC_MS) - flags |= VIDSYNC_FLUSH; - - if (IS_ENABLED(CONFIG_VIDEO_COPY)) + if (IS_ENABLED(CONFIG_VIDEO_COPY) && (flags & VIDSYNC_COPY)) video_flush_copy(vid); if (ops && ops->sync) { @@ -534,7 +519,7 @@ int video_sync(struct udevice *vid, bool force) video_flush_dcache(vid, false); - if (IS_ENABLED(CONFIG_VIDEO_COPY)) + if (IS_ENABLED(CONFIG_VIDEO_COPY) && (flags & VIDSYNC_COPY)) video_flush_dcache(vid, true); #if defined(CONFIG_VIDEO_SANDBOX_SDL) @@ -555,6 +540,31 @@ int video_sync(struct udevice *vid, bool force) return 0; } +/* Flush video activity to the caches */ +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; + + /* Skip sync if manual-sync mode is active */ + if (uc_priv->manual_sync) + return 0; + + if (force) + flags |= VIDSYNC_FORCE; + + /* Check if sync should do full flush */ + if (!CONFIG_IS_ENABLED(CYCLIC) || force || + get_timer(priv->last_sync) >= CONFIG_VIDEO_SYNC_MS) + flags |= VIDSYNC_FLUSH; + + if (IS_ENABLED(CONFIG_VIDEO_COPY)) + flags |= VIDSYNC_COPY; + + return video_manual_sync(vid, flags); +} + void video_sync_all(void) { struct udevice *dev; diff --git a/include/video.h b/include/video.h index d08781d3a78..d8ba27ab8a7 100644 --- a/include/video.h +++ b/include/video.h @@ -80,10 +80,12 @@ enum video_format { * * @VIDSYNC_FORCE: Force sync even if recently synced or in manual-sync mode * @VIDSYNC_FLUSH: Flush dcache and perform full sync operations + * @VIDSYNC_COPY: Flush framebuffer to copy buffer */ enum video_sync_flags { VIDSYNC_FORCE = BIT(0), VIDSYNC_FLUSH = BIT(1), + VIDSYNC_COPY = BIT(2), }; /** @@ -341,6 +343,20 @@ int video_fill_part(struct udevice *dev, int xstart, int ystart, int xend, int video_draw_box(struct udevice *dev, int x0, int y0, int x1, int y1, int width, u32 colour, bool fill); +/** + * video_manual_sync() - Manually sync a device's frame buffer with its hardware + * + * @vid: Device to sync + * @flags: Flags for the sync (enum video_sync_flags) + * + * @return: 0 on success, error code otherwise + * + * Performs the actual sync operation with the provided flags. This is called + * by video_sync() after determining the appropriate flags, but can also be + * called directly when manual-sync mode is enabled. + */ +int video_manual_sync(struct udevice *vid, uint flags); + /** * video_sync() - Sync a device's frame buffer with its hardware * diff --git a/test/dm/video.c b/test/dm/video.c index cee9e528689..080297d8350 100644 --- a/test/dm/video.c +++ b/test/dm/video.c @@ -1342,6 +1342,33 @@ static int dm_test_video_manual_sync(struct unit_test_state *uts) ut_asserteq(183, video_compress_fb(uts, dev, true)); } + /* Now test video_manual_sync() directly with VIDSYNC_FORCE and COPY */ + ut_assertok(video_manual_sync(dev, VIDSYNC_FORCE | VIDSYNC_FLUSH | + VIDSYNC_COPY)); + ut_asserteq(183, video_compress_fb(uts, dev, false)); + + /* The copy framebuffer should now match since we forced the sync */ + ut_assertok(video_check_copy_fb(uts, dev)); + + /* Write new text again */ + vidconsole_put_string(con, "Test2"); + + /* without VIDSYNC_FLUSH or COPY - should do nothing */ + ut_assertok(video_manual_sync(dev, 0)); + + /* Copy fb should not match since neither flush nor copy occurred */ + if (IS_ENABLED(CONFIG_VIDEO_COPY)) { + ut_assertf(memcmp(priv->fb, priv->copy_fb, priv->fb_size), + "Copy fb shouldn't match fb w/o VIDSYNC_FLUSH/COPY"); + } + + /* video_manual_sync() with full flags - should perform full sync */ + ut_assertok(video_manual_sync(dev, VIDSYNC_FLUSH | VIDSYNC_COPY)); + ut_assertok(video_check_copy_fb(uts, dev)); + + /* Disable manual-sync mode */ + video_set_manual_sync(false); + return 0; } DM_TEST(dm_test_video_manual_sync, UTF_SCAN_PDATA | UTF_SCAN_FDT); From patchwork Fri Oct 3 16:55:13 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass <sjg@u-boot.org> X-Patchwork-Id: 501 Return-Path: <concept-bounces+u-boot-concept=u-boot.org@u-boot.org> 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=1759510624; bh=Z3X2p0AU9f6ah4MUU9LTUsvKR6Iqz84e4hQoIxy9tEs=; 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=mBn5BGIBTa2xvJn4NSmvE2N7d5mGPJgM/iMC/uWfeYSNCyEBiE4kVVakxgAaiba1F 47D1T878Il3PpQmZ+p4degGgUc2vHBy8+xU0zdkeQYPHAcQRR/iawh3trxhmwZGHaf xSs6vFfoptrdOfQ9eKo32HSAgCQxPDBRFu3gpODIw97mawPwjSF37hBcW3l8xXSM8q h7vchZLash2r09YI5rZGOgWcQY+wDMcn+IPDcpsrv5ytZCkPlwSGV/rrU4rv3yej7k aZ7YGuTmpVe2zlka/HZ6gb7HZnLfWkIMJ7vylS4c6q+CApyqYu+dXLWsaYDjiuMeNs NkazXiyJ7HlNw== Received: from localhost (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id AEB2F67EC5 for <u-boot-concept@u-boot.org>; Fri, 3 Oct 2025 10:57:04 -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 nsJu5n3g9ikS for <u-boot-concept@u-boot.org>; Fri, 3 Oct 2025 10:57:04 -0600 (MDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1759510624; bh=Z3X2p0AU9f6ah4MUU9LTUsvKR6Iqz84e4hQoIxy9tEs=; 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=mBn5BGIBTa2xvJn4NSmvE2N7d5mGPJgM/iMC/uWfeYSNCyEBiE4kVVakxgAaiba1F 47D1T878Il3PpQmZ+p4degGgUc2vHBy8+xU0zdkeQYPHAcQRR/iawh3trxhmwZGHaf xSs6vFfoptrdOfQ9eKo32HSAgCQxPDBRFu3gpODIw97mawPwjSF37hBcW3l8xXSM8q h7vchZLash2r09YI5rZGOgWcQY+wDMcn+IPDcpsrv5ytZCkPlwSGV/rrU4rv3yej7k aZ7YGuTmpVe2zlka/HZ6gb7HZnLfWkIMJ7vylS4c6q+CApyqYu+dXLWsaYDjiuMeNs NkazXiyJ7HlNw== Received: from mail.u-boot.org (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id 9CC0C67E86 for <u-boot-concept@u-boot.org>; Fri, 3 Oct 2025 10:57:04 -0600 (MDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1759510622; bh=xa4+HtR+JCVOwYHiWxF8KfIOMP5jUzAK1dK+k0qxcgs=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=w7sx2XX3L6IuROYS0dT0x3PRgDGAqJVuK8CtxVVX4mxVgvZAk1dmai6Tye/qT4tjq gZtRG13Yhe0+7Bki3h874OzLzWmMEi5tuYG4k5MWz1/dT9omC+XZ9DMeiSLnF3S17k xWCTnL8i3CISqNhXEQhQbk0PEuRc/A+YfYU0OM2+epY7C1I+OYt9DBJKrfe3fey1gX 9QByxp36qaKfUb28NkjNPXrKXsh56bdZmGt3y1ydxVWvg0K0NYAY0nv5a7iX+1bWAH BgyD7cG9A07aNeLUGaJHZDNn1guTZCBqJyJfvii1STMPMimq11vOmmoyKEGp4yfnCZ n+SFlcv4chOkA== Received: from localhost (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id 302C867DC0; Fri, 3 Oct 2025 10:57:02 -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 cNcEeomi3rOO; Fri, 3 Oct 2025 10:57:02 -0600 (MDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1759510618; bh=Ib0yWe30QFndridCh8X5IZp3LHXuySmsNvygX8mBs6Q=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Fq05esBRxqEWDZ8JrIoX3vEsMVK1SJF5ffRlA9uc7Ez6Pb2yqUS5JlDEr2USLMWXu y5JzQs/scdsRnPYJYh5mtRAV+UJvOAUOhUDQkJOoRZ60oz5BZ60xtmGlcg5nJRZppM HOVK2FxoQNUbqLeh7BE8qM3fOyai8hPgiHnbktdDRF40ydPyN2oN1TgxQiK7/Tuipt z1E7DQD3+qALEcYYVrKjsiffzatpfNR65hvSrI/vG275X6usXUopQc6AXu0IWUoDbq /3ghtfP6m1cmZHJrkqoDZfYryqHc9+T40EHQZFSb7WzMFNtOqifydewJckmNjXlkfN 2lPT8+kcJiLxQ== Received: from u-boot.org (unknown [73.34.74.121]) by mail.u-boot.org (Postfix) with ESMTPSA id A900467F45; Fri, 3 Oct 2025 10:56:57 -0600 (MDT) From: Simon Glass <sjg@u-boot.org> To: U-Boot Concept <concept@u-boot.org> Date: Fri, 3 Oct 2025 10:55:13 -0600 Message-ID: <20251003165525.440173-21-sjg@u-boot.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20251003165525.440173-1-sjg@u-boot.org> References: <20251003165525.440173-1-sjg@u-boot.org> MIME-Version: 1.0 Message-ID-Hash: NML37JNUTEQAKHU4WABPP4G6TY7KCATE X-Message-ID-Hash: NML37JNUTEQAKHU4WABPP4G6TY7KCATE 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 <xypron.glpk@gmx.de>, Simon Glass <sjg@chromium.org>, Claude <noreply@anthropic.com> X-Mailman-Version: 3.3.10 Precedence: list Subject: [Concept] [PATCH 20/22] video: sandbox: Optimise drawing based on damage List-Id: Discussion and patches related to U-Boot Concept <concept.u-boot.org> Archived-At: <https://lists.u-boot.org/archives/list/concept@u-boot.org/message/NML37JNUTEQAKHU4WABPP4G6TY7KCATE/> List-Archive: <https://lists.u-boot.org/archives/list/concept@u-boot.org/> List-Help: <mailto:concept-request@u-boot.org?subject=help> List-Owner: <mailto:concept-owner@u-boot.org> List-Post: <mailto:concept@u-boot.org> List-Subscribe: <mailto:concept-join@u-boot.org> List-Unsubscribe: <mailto:concept-leave@u-boot.org> From: Simon Glass <sjg@chromium.org> Update sandbox_sdl_sync() to accept an optional damage rectangle and update only the damaged region. This should reduce the amount of work performed by the driver when only a small part of the display needs to be updated. Co-developed-by: Claude <noreply@anthropic.com> Signed-off-by: Simon Glass <sjg@chromium.org> --- arch/sandbox/cpu/sdl.c | 46 ++++++++++++++++++++++++++++++++++-------- 1 file changed, 38 insertions(+), 8 deletions(-) diff --git a/arch/sandbox/cpu/sdl.c b/arch/sandbox/cpu/sdl.c index fa431010b11..f4038c2431a 100644 --- a/arch/sandbox/cpu/sdl.c +++ b/arch/sandbox/cpu/sdl.c @@ -6,6 +6,7 @@ #include <errno.h> #include <mouse.h> #include <unistd.h> +#include <video_defs.h> #include <stdbool.h> #include <sysreset.h> #include <linux/input.h> @@ -232,17 +233,46 @@ int sandbox_sdl_init_display(int width, int height, int log2_bpp, return 0; } -static int copy_to_texture(void *lcd_base) +static int copy_to_texture(void *lcd_base, const struct video_bbox *damage) { char *dest; int pitch, x, y; int src_pitch; void *pixels; char *src; + SDL_Rect rect, *rectp = NULL; int ret; + int x0, y0, x1, y1; + + /* Set up damage region if provided */ + if (damage && damage->x1 > damage->x0 && damage->y1 > damage->y0) { + rect.x = damage->x0; + rect.y = damage->y0; + rect.w = damage->x1 - damage->x0; + rect.h = damage->y1 - damage->y0; + rectp = ▭ + x0 = damage->x0; + y0 = damage->y0; + x1 = damage->x1; + y1 = damage->y1; + } else { + x0 = 0; + y0 = 0; + x1 = sdl.width; + y1 = sdl.height; + } if (sdl.src_depth == sdl.depth) { - SDL_UpdateTexture(sdl.texture, NULL, lcd_base, sdl.pitch); + if (rectp) { + /* Update only the damaged region */ + src_pitch = sdl.width * sdl.src_depth / 8; + src = lcd_base + y0 * src_pitch + + x0 * sdl.src_depth / 8; + SDL_UpdateTexture(sdl.texture, rectp, src, src_pitch); + } else { + SDL_UpdateTexture(sdl.texture, NULL, lcd_base, + sdl.pitch); + } return 0; } @@ -255,7 +285,7 @@ static int copy_to_texture(void *lcd_base) return -EINVAL; } - ret = SDL_LockTexture(sdl.texture, NULL, &pixels, &pitch); + ret = SDL_LockTexture(sdl.texture, rectp, &pixels, &pitch); if (ret) { printf("SDL lock %d: %s\n", ret, SDL_GetError()); return ret; @@ -263,12 +293,12 @@ static int copy_to_texture(void *lcd_base) /* Copy the pixels one by one */ src_pitch = sdl.width * sdl.src_depth / 8; - for (y = 0; y < sdl.height; y++) { + for (y = y0; y < y1; y++) { char val; - dest = pixels + y * pitch; - src = lcd_base + src_pitch * y; - for (x = 0; x < sdl.width; x++, dest += 4) { + dest = pixels + (y - y0) * pitch; + src = lcd_base + src_pitch * y + x0; + for (x = x0; x < x1; x++, dest += 4) { val = *src++; dest[0] = val; dest[1] = val; @@ -289,7 +319,7 @@ int sandbox_sdl_sync(void *lcd_base) if (!sdl.texture) return 0; SDL_RenderClear(sdl.renderer); - ret = copy_to_texture(lcd_base); + ret = copy_to_texture(lcd_base, NULL); if (ret) { printf("copy_to_texture: %d: %s\n", ret, SDL_GetError()); return -EIO; From patchwork Fri Oct 3 16:55:14 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass <sjg@u-boot.org> X-Patchwork-Id: 502 Return-Path: <concept-bounces+u-boot-concept=u-boot.org@u-boot.org> 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=1759510627; bh=vkoEVIvwAhCfSDCnaLgeNg4SPoZDF46Cb6VyauFsJHg=; 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=W1k8LsS/XTMg1fyGbkeFUzPT1uk+nJZqtSaF6v3J1SP4q+0QgAyejIGI04fWnNjrT XoCQiZ4saOO2gCNUXe+uvdwjPjPudHTRDy7iN+LPC10dN+Bz3bHEMRFRfWrsy5WAWi cTIInULyTmtinajb3/4Ai20WenG07DRZu+rSo93XOLT/QuY3Pp7r3fIsLyjw8lttg+ +blmB2QtYLOVi4kB9knqSRmkwkObKgi/kxwCTRzVC/LoYfsJamokBw8pxObDN7yx+D HG102s0bs7yshYIV91oHH34rpyatqsNB2CKpbY7OLKel1O58HAGATqhLhwLAKvvy0T MwqmofqY8wvpg== Received: from localhost (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id 3E79867DC0 for <u-boot-concept@u-boot.org>; Fri, 3 Oct 2025 10:57:07 -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 QJQRJ3xXsErH for <u-boot-concept@u-boot.org>; Fri, 3 Oct 2025 10:57:07 -0600 (MDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1759510626; bh=vkoEVIvwAhCfSDCnaLgeNg4SPoZDF46Cb6VyauFsJHg=; 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=th494r2yGw8ASKKi8OmZAMY/k1867cfjznbKRSFrVq71UADUUMIf+tWHm0ZlZR8Wm c6RHAN+PHwUdqLeLrwhWTAt80xf+4Mstgn2wwabkEEr03EQfbJWOLpKUNXeBZrCaIz VXUI++g9CqBnxfbtSaORT8FL0JvFE2pMNJZoTZnnmnWWYml5qg2NnJyJ4JxcULPClJ Km8KWyyptrk8Oy2l6EFAHJ8tZvgxoKQkghdDkarLJsT1U1HIRgqbT367YbPKnIZF18 PrxqR5NVxoBw/uY0+UQ1YJlxs5956hktQAuhteRj7n8lgForIdQHvrVoLrY7GQmF1W EHJiV+TYiPnUg== Received: from mail.u-boot.org (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id 37DD667E85 for <u-boot-concept@u-boot.org>; Fri, 3 Oct 2025 10:57:06 -0600 (MDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1759510624; bh=C+r1GNy/8T+u1l2hfrXSG/HqBHIeWB78Ls+yHD8Os1A=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=fRcZncv9J5knRZlFK+rq3Oqd7okUNlDZqnbw3sIYTUfDW1hOJFIkdfgl9gRFMPER2 wnbBVHGpzpaSMda4HFG1ulLkWkGbHfLfibo5dNx7/gb0JNWJ39m92zra4efH4Xgw1a w9enXS0SjE/nYkwLr8rIqcOocfpIWTb1ADRaye6aHxdBNUJ+1HHxvNy6ZR0rL4hg5a 77Tnz3cG36v8voyFcM75swHcmF+WmyVrUhFya6xCvy5+rxYr1Mw2+Z6S+jRl8JHOhT uqabYDHqKnNlQ1zX5CbrC6twdEPbj9I1WG9+u2ZLatMGbmDgx8bDtX2CG2Ej8E15uy cBuytBPzdh/6g== Received: from localhost (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id 2800F67DC0; Fri, 3 Oct 2025 10:57:04 -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 Baghn0IDfgST; Fri, 3 Oct 2025 10:57:04 -0600 (MDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1759510622; bh=hg6pjU2AWH6IiznyEJX01wbKoW2o3dD7LHWxsB1BC4o=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=v4TKNSmE7TOwELl141mTRvIL8mb0rbqhcAccm07e5tBgGC5ZXNrDgl3nxOzZ+gYLE +hoaxbmhr5c9d1oUSJzEILMLgxjt+yBJk7YOMjcVQBZm//edn5jZ7amihzMWSIgv1t k1ua5XtyJIdw/L3gb6d34gjK7aYeKG6BLsgu+nxOR6hocR7IwUja3nRhMkLCyrHT/j u5Joxi5X5P23HyuYmAKihlghyCW8OsZzUtDDwt8BabM6fxzNOG1BOCJeSRrU45LaTO jRT+qgJ46b9S9JIo6KCrRMmXH7AjRLIcqnhCsx5N3eBhXW/Cyf8r2W8+vOiBPsyCxg zpFna0nnJlTdQ== Received: from u-boot.org (unknown [73.34.74.121]) by mail.u-boot.org (Postfix) with ESMTPSA id 51CE567E12; Fri, 3 Oct 2025 10:57:02 -0600 (MDT) From: Simon Glass <sjg@u-boot.org> To: U-Boot Concept <concept@u-boot.org> Date: Fri, 3 Oct 2025 10:55:14 -0600 Message-ID: <20251003165525.440173-22-sjg@u-boot.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20251003165525.440173-1-sjg@u-boot.org> References: <20251003165525.440173-1-sjg@u-boot.org> MIME-Version: 1.0 Message-ID-Hash: GNUDMWGBTC4INUWEB6UCNOQPB4WKBBNO X-Message-ID-Hash: GNUDMWGBTC4INUWEB6UCNOQPB4WKBBNO 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 <xypron.glpk@gmx.de>, Simon Glass <sjg@chromium.org>, Claude <noreply@anthropic.com> X-Mailman-Version: 3.3.10 Precedence: list Subject: [Concept] [PATCH 21/22] video: sandbox: Add sync() method for video List-Id: Discussion and patches related to U-Boot Concept <concept.u-boot.org> Archived-At: <https://lists.u-boot.org/archives/list/concept@u-boot.org/message/GNUDMWGBTC4INUWEB6UCNOQPB4WKBBNO/> List-Archive: <https://lists.u-boot.org/archives/list/concept@u-boot.org/> List-Help: <mailto:concept-request@u-boot.org?subject=help> List-Owner: <mailto:concept-owner@u-boot.org> List-Post: <mailto:concept@u-boot.org> List-Subscribe: <mailto:concept-join@u-boot.org> List-Unsubscribe: <mailto:concept-leave@u-boot.org> From: Simon Glass <sjg@chromium.org> At present, video_sync() has a special case for sandbox. Remove this and add a sync() method in the sandbox_sdl driver instead. The sync() method checks the VIDSYNC_FLUSH flag and skips sync operation if it's not set, avoiding unnecessary SDL updates. If CONFIG_VIDEO_DAMAGE is enabled, the SDL portion accepts an optional damage rectangle parameter to support only updating the damaged region. Use the struct video_bbox definition from the video_defs.h header as this avoids trying to include too many U-Boot headers in code that is build with system headers. Co-developed-by: Claude <noreply@anthropic.com> Signed-off-by: Simon Glass <sjg@chromium.org> --- arch/sandbox/cpu/sdl.c | 5 +++-- arch/sandbox/include/asm/sdl.h | 7 +++++-- drivers/video/sandbox_sdl.c | 19 +++++++++++++++++++ drivers/video/video-uclass.c | 4 ---- 4 files changed, 27 insertions(+), 8 deletions(-) diff --git a/arch/sandbox/cpu/sdl.c b/arch/sandbox/cpu/sdl.c index f4038c2431a..246fa37d457 100644 --- a/arch/sandbox/cpu/sdl.c +++ b/arch/sandbox/cpu/sdl.c @@ -12,6 +12,7 @@ #include <linux/input.h> #include <SDL2/SDL.h> #include <asm/state.h> +#include <video_defs.h> /** * struct buf_info - a data buffer holding audio data @@ -311,7 +312,7 @@ static int copy_to_texture(void *lcd_base, const struct video_bbox *damage) return 0; } -int sandbox_sdl_sync(void *lcd_base) +int sandbox_sdl_sync(void *lcd_base, const struct video_bbox *damage) { struct SDL_Rect rect; int ret; @@ -319,7 +320,7 @@ int sandbox_sdl_sync(void *lcd_base) if (!sdl.texture) return 0; SDL_RenderClear(sdl.renderer); - ret = copy_to_texture(lcd_base, NULL); + ret = copy_to_texture(lcd_base, damage); if (ret) { printf("copy_to_texture: %d: %s\n", ret, SDL_GetError()); return -EIO; diff --git a/arch/sandbox/include/asm/sdl.h b/arch/sandbox/include/asm/sdl.h index 735652de6bd..93d934f9c54 100644 --- a/arch/sandbox/include/asm/sdl.h +++ b/arch/sandbox/include/asm/sdl.h @@ -10,6 +10,7 @@ #include <video.h> struct mouse_event; +struct video_bbox; #ifdef CONFIG_SANDBOX_SDL @@ -42,9 +43,10 @@ int sandbox_sdl_remove_display(void); * user can see it. * * @lcd_base: Base of frame buffer + * @damage: Optional damage rectangle to limit the update region (may be NULL) * Return: 0 if screen was updated, -ENODEV is there is no screen. */ -int sandbox_sdl_sync(void *lcd_base); +int sandbox_sdl_sync(void *lcd_base, const struct video_bbox *damage); /** * sandbox_sdl_scan_keys() - scan for pressed keys @@ -129,7 +131,8 @@ static inline int sandbox_sdl_remove_display(void) return -ENODEV; } -static inline int sandbox_sdl_sync(void *lcd_base) +static inline int sandbox_sdl_sync(void *lcd_base, + const struct video_bbox *damage) { return -ENODEV; } diff --git a/drivers/video/sandbox_sdl.c b/drivers/video/sandbox_sdl.c index 69dfa930273..67b4b6c7911 100644 --- a/drivers/video/sandbox_sdl.c +++ b/drivers/video/sandbox_sdl.c @@ -127,6 +127,24 @@ static int sandbox_sdl_bind(struct udevice *dev) return ret; } +static int sandbox_sdl_video_sync(struct udevice *vid, uint flags) +{ + struct video_priv *priv = dev_get_uclass_priv(vid); + const struct video_bbox *damage = NULL; + + if (!(flags & VIDSYNC_FLUSH)) + return 0; + + if (IS_ENABLED(CONFIG_VIDEO_DAMAGE)) + damage = &priv->damage; + + return sandbox_sdl_sync(priv->fb, damage); +} + +static const struct video_ops sandbox_sdl_ops = { + .sync = sandbox_sdl_video_sync, +}; + static const struct udevice_id sandbox_sdl_ids[] = { { .compatible = "sandbox,lcd-sdl" }, { } @@ -139,5 +157,6 @@ U_BOOT_DRIVER(sandbox_lcd_sdl) = { .bind = sandbox_sdl_bind, .probe = sandbox_sdl_probe, .remove = sandbox_sdl_remove, + .ops = &sandbox_sdl_ops, .plat_auto = sizeof(struct sandbox_sdl_plat), }; diff --git a/drivers/video/video-uclass.c b/drivers/video/video-uclass.c index a8849cf6289..491dd23bff0 100644 --- a/drivers/video/video-uclass.c +++ b/drivers/video/video-uclass.c @@ -522,10 +522,6 @@ int video_manual_sync(struct udevice *vid, uint flags) if (IS_ENABLED(CONFIG_VIDEO_COPY) && (flags & VIDSYNC_COPY)) video_flush_dcache(vid, true); -#if defined(CONFIG_VIDEO_SANDBOX_SDL) - /* to see the copy framebuffer, use priv->copy_fb */ - sandbox_sdl_sync(priv->fb); -#endif priv->last_sync = get_timer(0); if (IS_ENABLED(CONFIG_VIDEO_DAMAGE)) { From patchwork Fri Oct 3 16:55:15 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass <sjg@u-boot.org> X-Patchwork-Id: 503 Return-Path: <concept-bounces+u-boot-concept=u-boot.org@u-boot.org> 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=1759510632; bh=fXg3y1MGcmhHWZjUm1WUnWeVAxFX+bJNPpAL2VuLVJs=; 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=GYQntcf+kQibLPfpA98kpd4/Ml+eTmorPUa221VJNSqFmKyXCzE6kQySRsF5aShh2 uW10jz9xUIdWt6RR+UMEaUrGfG9VDZgejC7OEIV/gcGMxdY0zQUL2wRwAAi6OUY3Xi GvxvBBNeZHtBwNXpcYR7VHOc4nrq+aq6P/SLu7oxs1JfsVkwOiZnLWS6r7XdOKkNfo 9xr8OxHGcfo4wEN6WAjU9lSO51iWbRYPPC36HozAlFlBBjO+daFjHNf/GEZ9PVjpx8 h7OrUGCy6SG+nk9Ptqpsv0umT1BNe7jSrmiOAvBb8hcoM9EiE4GvPROw3UodWBT93u yDUKjdK8xoncQ== Received: from localhost (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id 2750067EBD for <u-boot-concept@u-boot.org>; Fri, 3 Oct 2025 10:57:12 -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 l2exEG4RCmGA for <u-boot-concept@u-boot.org>; Fri, 3 Oct 2025 10:57:12 -0600 (MDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1759510632; bh=fXg3y1MGcmhHWZjUm1WUnWeVAxFX+bJNPpAL2VuLVJs=; 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=GYQntcf+kQibLPfpA98kpd4/Ml+eTmorPUa221VJNSqFmKyXCzE6kQySRsF5aShh2 uW10jz9xUIdWt6RR+UMEaUrGfG9VDZgejC7OEIV/gcGMxdY0zQUL2wRwAAi6OUY3Xi GvxvBBNeZHtBwNXpcYR7VHOc4nrq+aq6P/SLu7oxs1JfsVkwOiZnLWS6r7XdOKkNfo 9xr8OxHGcfo4wEN6WAjU9lSO51iWbRYPPC36HozAlFlBBjO+daFjHNf/GEZ9PVjpx8 h7OrUGCy6SG+nk9Ptqpsv0umT1BNe7jSrmiOAvBb8hcoM9EiE4GvPROw3UodWBT93u yDUKjdK8xoncQ== Received: from mail.u-boot.org (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id 1666267E82 for <u-boot-concept@u-boot.org>; Fri, 3 Oct 2025 10:57:12 -0600 (MDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1759510629; bh=DPviaa0aHH6JF6aVeUWATW7VwrAlOccX1yPUtx0Ostw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=YWQrilnBkD8QxkskuK3YNJCAnpEaQ+BQKfheCgUXY9AnQAxBl+2o971P2Oq7vEIT9 u+xXkhCwmRlPEOzSg7h/oQvKTuu665+cAny50DJQyfZzGRSkrz618MJKby3aN3S/Tz 0zWQ24sBZ+AxoId6kJtrTJi8TH6x0RzNN5GT3P/xNUPyP7Sp3laGWlAJMTWvVEL93m WEIwV8XwwhGXwnbyqwvaTUqklkSKs5LwSEDOPl4+3/VYVPepjWeepUPqqmxsIbJNLL g9IMw1Z51FDVLVyeze9ONIHzzcIIHQeMyKr/dKquUloWJIIZYWgceck5/qxl3p7gx2 qFLvzLTgrMTZA== Received: from localhost (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id 9829167E82; Fri, 3 Oct 2025 10:57:09 -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 KrDrtOZ9vVsQ; Fri, 3 Oct 2025 10:57:09 -0600 (MDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1759510624; bh=IqiXKxYKv1xu2qWReTvBwQ8H8YekE2ax8xaqVUzz7FI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Wx/S0btNMojKUvaXSKSWlq58DB3MizScqcnjkqHawsRJxrgdFwq1unD7OlvctysUl AlSijUcFLU6CL3DNEZLCAJ73t+MEOzsSaEtwoS/6Gz536TXe8cTU8NHOYJUyhioyNp FyPKp717QfrCceXvpkINWY5hFV1jXwf8YOVmWUJLCbXvHn0f7tv4QpzD4kmwt+2xxC I7BLRiMeHCcal8unyi8k2+kvmmHUVxrahxFltecdlKMTXFk06ejXUJ81YlRXDEGF0b X0jMmcBwrXTvSUK6oz59gqTbdn/yW1GODN8xbnq7PS4dzC4ZA4nRF0+jevEkzZCuGb d3uJ4wrFjSppQ== Received: from u-boot.org (unknown [73.34.74.121]) by mail.u-boot.org (Postfix) with ESMTPSA id 64E7767E12; Fri, 3 Oct 2025 10:57:04 -0600 (MDT) From: Simon Glass <sjg@u-boot.org> To: U-Boot Concept <concept@u-boot.org> Date: Fri, 3 Oct 2025 10:55:15 -0600 Message-ID: <20251003165525.440173-23-sjg@u-boot.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20251003165525.440173-1-sjg@u-boot.org> References: <20251003165525.440173-1-sjg@u-boot.org> MIME-Version: 1.0 Message-ID-Hash: L3KPHQ7GLRGAPRNHQDJFSEDXB6GXGLQC X-Message-ID-Hash: L3KPHQ7GLRGAPRNHQDJFSEDXB6GXGLQC 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 <xypron.glpk@gmx.de>, Simon Glass <sjg@chromium.org>, Claude <noreply@anthropic.com> X-Mailman-Version: 3.3.10 Precedence: list Subject: [Concept] [PATCH 22/22] video: sandbox: Add test for sync() damage rectangle List-Id: Discussion and patches related to U-Boot Concept <concept.u-boot.org> Archived-At: <https://lists.u-boot.org/archives/list/concept@u-boot.org/message/L3KPHQ7GLRGAPRNHQDJFSEDXB6GXGLQC/> List-Archive: <https://lists.u-boot.org/archives/list/concept@u-boot.org/> List-Help: <mailto:concept-request@u-boot.org?subject=help> List-Owner: <mailto:concept-owner@u-boot.org> List-Post: <mailto:concept@u-boot.org> List-Subscribe: <mailto:concept-join@u-boot.org> List-Unsubscribe: <mailto:concept-leave@u-boot.org> From: Simon Glass <sjg@chromium.org> Add a test that verifies the sandbox SDL driver receives the correct damage rectangle in its sync() method. The test: - Clears the display and verifies full-screen damage is passed to sync() - Writes text at a specific position and verifies smaller damage region - Draws a box and verifies the damage matches the box dimensions The damage rectangle is recorded in sandbox_sdl_plat.last_sync_damage and can be retrieved using sandbox_sdl_get_sync_damage() for testing purposes. Co-developed-by: Claude <noreply@anthropic.com> Signed-off-by: Simon Glass <sjg@chromium.org> --- drivers/video/sandbox_sdl.c | 23 +++++++-- include/dm/test.h | 15 ++++++ test/dm/video.c | 96 +++++++++++++++++++++++++++++++++++++ 3 files changed, 131 insertions(+), 3 deletions(-) diff --git a/drivers/video/sandbox_sdl.c b/drivers/video/sandbox_sdl.c index 67b4b6c7911..fc5843a2822 100644 --- a/drivers/video/sandbox_sdl.c +++ b/drivers/video/sandbox_sdl.c @@ -129,22 +129,39 @@ static int sandbox_sdl_bind(struct udevice *dev) static int sandbox_sdl_video_sync(struct udevice *vid, uint flags) { - struct video_priv *priv = dev_get_uclass_priv(vid); + struct sandbox_sdl_plat *plat = dev_get_plat(vid); + struct video_priv *uc_priv = dev_get_uclass_priv(vid); const struct video_bbox *damage = NULL; if (!(flags & VIDSYNC_FLUSH)) return 0; if (IS_ENABLED(CONFIG_VIDEO_DAMAGE)) - damage = &priv->damage; + damage = &uc_priv->damage; - return sandbox_sdl_sync(priv->fb, damage); + /* Record the damage box for testing */ + if (damage) + plat->last_sync_damage = *damage; + else + memset(&plat->last_sync_damage, '\0', + sizeof(plat->last_sync_damage)); + + return sandbox_sdl_sync(uc_priv->fb, damage); } static const struct video_ops sandbox_sdl_ops = { .sync = sandbox_sdl_video_sync, }; +int sandbox_sdl_get_sync_damage(struct udevice *dev, struct video_bbox *damage) +{ + struct sandbox_sdl_plat *plat = dev_get_plat(dev); + + *damage = plat->last_sync_damage; + + return 0; +} + static const struct udevice_id sandbox_sdl_ids[] = { { .compatible = "sandbox,lcd-sdl" }, { } diff --git a/include/dm/test.h b/include/dm/test.h index 4aabb4603b9..10fd63e759f 100644 --- a/include/dm/test.h +++ b/include/dm/test.h @@ -7,6 +7,7 @@ #define __DM_TEST_H #include <linux/types.h> +#include <video_defs.h> struct udevice; @@ -157,6 +158,7 @@ extern struct unit_test_state global_dm_test_state; * 2=upside down, 3=90 degree counterclockwise) * @vidconsole_drv_name: Name of video console driver (set by tests) * @font_size: Console font size to select (set by tests) + * @last_sync_damage: Last damage rectangle passed to sync() method (for testing) */ struct sandbox_sdl_plat { int xres; @@ -165,6 +167,7 @@ struct sandbox_sdl_plat { int rot; const char *vidconsole_drv_name; int font_size; + struct video_bbox last_sync_damage; }; /** @@ -232,4 +235,16 @@ void dm_leak_check_start(struct unit_test_state *uts); * @dms: Overall test state */int dm_leak_check_end(struct unit_test_state *uts); +/** + * sandbox_sdl_get_sync_damage() - Get the last damage rect passed to sync() + * + * This is used for testing to verify that the correct damage rectangle was + * passed to the driver's sync() method. + * + * @dev: Video device + * @damage: Returns the last damage rectangle + * Return: 0 if OK, -ve on error + */ +int sandbox_sdl_get_sync_damage(struct udevice *dev, struct video_bbox *damage); + #endif diff --git a/test/dm/video.c b/test/dm/video.c index 080297d8350..5a5d8053856 100644 --- a/test/dm/video.c +++ b/test/dm/video.c @@ -1372,3 +1372,99 @@ static int dm_test_video_manual_sync(struct unit_test_state *uts) return 0; } DM_TEST(dm_test_video_manual_sync, UTF_SCAN_PDATA | UTF_SCAN_FDT); + +/* Test that sync() receives the correct damage rectangle */ +static int dm_test_video_sync_damage(struct unit_test_state *uts) +{ + struct video_bbox damage; + struct udevice *dev, *con; + struct video_priv *priv; + + if (!IS_ENABLED(CONFIG_VIDEO_DAMAGE)) + return -EAGAIN; + + ut_assertok(select_vidconsole(uts, "vidconsole0")); + ut_assertok(video_get_nologo(uts, &dev)); + ut_assertok(uclass_get_device(UCLASS_VIDEO_CONSOLE, 0, &con)); + ut_assertok(vidconsole_select_font(con, "8x16", 0)); + priv = dev_get_uclass_priv(dev); + + /* Use manual sync to prevent interference with the test */ + video_set_manual_sync(true); + + /* Clear the display - this creates a full-screen damage and syncs */ + video_clear(dev); + ut_assertok(video_manual_sync(dev, VIDSYNC_FLUSH | VIDSYNC_COPY)); + ut_asserteq(46, video_compress_fb(uts, dev, false)); + + /* Get the damage rectangle that was passed to sync() */ + ut_assertok(sandbox_sdl_get_sync_damage(dev, &damage)); + + /* Should be the full screen */ + ut_assert(video_bbox_valid(&damage)); + ut_asserteq(0, damage.x0); + ut_asserteq(0, damage.y0); + ut_asserteq(priv->xsize, damage.x1); + ut_asserteq(priv->ysize, damage.y1); + + /* Sync again with no changes - should have empty damage */ + ut_assertok(video_manual_sync(dev, VIDSYNC_FLUSH | VIDSYNC_COPY)); + ut_assertok(sandbox_sdl_get_sync_damage(dev, &damage)); + ut_assert(!video_bbox_valid(&damage)); + + /* Check that priv->damage is still reset to empty */ + ut_assert(!video_bbox_valid(&priv->damage)); + + /* Write a small piece of text at a specific position */ + vidconsole_putc_xy(con, VID_TO_POS(400), 67, 'T'); + + /* Check priv->damage before sync - should have text damage */ + ut_assert(video_bbox_valid(&priv->damage)); + ut_asserteq(400, priv->damage.x0); + ut_asserteq(67, priv->damage.y0); + ut_asserteq(400 + 8, priv->damage.x1); /* 8x16 font */ + ut_asserteq(67 + 16, priv->damage.y1); + + ut_assertok(video_manual_sync(dev, VIDSYNC_FLUSH | VIDSYNC_COPY)); + + /* Get the damage rectangle that was passed to sync() */ + ut_assertok(sandbox_sdl_get_sync_damage(dev, &damage)); + + /* The damage should cover just the character */ + ut_assert(video_bbox_valid(&damage)); + ut_asserteq(400, damage.x0); + ut_asserteq(67, damage.y0); + ut_asserteq(400 + 8, damage.x1); + ut_asserteq(67 + 16, damage.y1); + + /* Check priv->damage after sync - should be reset to empty */ + ut_assert(!video_bbox_valid(&priv->damage)); + + /* Draw a filled box at a different position */ + ut_assertok(video_draw_box(dev, 200, 300, 250, 340, 1, 0xffffff, true)); + + /* Check priv->damage before sync - should have box damage */ + ut_assert(video_bbox_valid(&priv->damage)); + ut_asserteq(200, priv->damage.x0); + ut_asserteq(300, priv->damage.y0); + ut_asserteq(250, priv->damage.x1); + ut_asserteq(340, priv->damage.y1); + + ut_assertok(video_manual_sync(dev, VIDSYNC_FLUSH | VIDSYNC_COPY)); + + /* Get the damage rectangle for the box */ + ut_assertok(sandbox_sdl_get_sync_damage(dev, &damage)); + + /* The damage should cover the box area */ + ut_assert(video_bbox_valid(&damage)); + ut_asserteq(200, damage.x0); + ut_asserteq(300, damage.y0); + ut_asserteq(250, damage.x1); + ut_asserteq(340, damage.y1); + + /* Check priv->damage after sync - should be reset to inverted/empty */ + ut_assert(!video_bbox_valid(&priv->damage)); + + return 0; +} +DM_TEST(dm_test_video_sync_damage, UTF_SCAN_PDATA | UTF_SCAN_FDT);