From patchwork Thu Oct 2 15:45:41 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 473 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=1759419979; bh=eW1X0qhfi4dYjWmfsoBk4uxYRurlp16uacoLFtCe7Tc=; 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=g7NCwEcA0sBcr327Lwd4tyKk/kqSJ8ab5pZkh1dJVyHIjWmfgwc1bVNJhoGU15s9g vVEqtCb/8PmbsRUTG+Vd4cZLHbRRaBLcrh0fMNuVo0hmdBnqss3pCL9g1awM7FKL6z MMQffOhsnjxsOyE0dPIsOPSSHzeFk/i+BDlXe/QxiQsZszCDqzbjj+1LudJ9x2/Dyq Qkh0XzgTQ8SDAJ6nqWGWIDxgApU5VC/lQ1ou38+mxL5/56Dx3inUiw5XTcP/KeYyAj a2/g7Wb+nJlD3NODRrLjs7Tq3lLtQw1hLCO+Tv1Ajxz8MVo/Jn7TB9NYnOcm9+yeLf NanU6irIHobkg== Received: from localhost (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id 3E9FD67F15 for ; Thu, 2 Oct 2025 09:46:19 -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 A8LXy2ox5WYE for ; Thu, 2 Oct 2025 09:46:19 -0600 (MDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1759419979; bh=eW1X0qhfi4dYjWmfsoBk4uxYRurlp16uacoLFtCe7Tc=; 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=g7NCwEcA0sBcr327Lwd4tyKk/kqSJ8ab5pZkh1dJVyHIjWmfgwc1bVNJhoGU15s9g vVEqtCb/8PmbsRUTG+Vd4cZLHbRRaBLcrh0fMNuVo0hmdBnqss3pCL9g1awM7FKL6z MMQffOhsnjxsOyE0dPIsOPSSHzeFk/i+BDlXe/QxiQsZszCDqzbjj+1LudJ9x2/Dyq Qkh0XzgTQ8SDAJ6nqWGWIDxgApU5VC/lQ1ou38+mxL5/56Dx3inUiw5XTcP/KeYyAj a2/g7Wb+nJlD3NODRrLjs7Tq3lLtQw1hLCO+Tv1Ajxz8MVo/Jn7TB9NYnOcm9+yeLf NanU6irIHobkg== Received: from mail.u-boot.org (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id 2D39267F17 for ; Thu, 2 Oct 2025 09:46:19 -0600 (MDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1759419977; bh=I9bzl99gg4DHohdXTH3YVn6QmBTSVn+xUj1igw9FOLA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=G3K7CGtILzmBCN8/u6O7KL2uixn+QIFMopiL9wiE8cI+ducVqCKour2VKnvOhcqhu jrjgqh2NdNBMpY8+jeoPirlO9bKaAiM8Lhw0usZa7vbAoHzTuPglG/avmQVHfoJLtw ktB9p2nvarppMdMHQwBgJfKv1Gem/xHXl8FPXBNG3GPC9sNSxemzXge6tl9BCD9shm gh6gTvGOoP4pbZ8dEEgYAIVscRry+/BlPTlDFXqCuloQEnVjQBbliVnnTjdUJdtWRy 22UKuunTNlTSnVwfetZRv+WnO6BrWPWmhXVatduTNcvyvvEATeEyRqpo/cS08E38lj 6sES0CS7SJHtA== Received: from localhost (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id E677867E4D; Thu, 2 Oct 2025 09:46: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 Xam3hd3N4RMA; Thu, 2 Oct 2025 09:46:17 -0600 (MDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1759419973; bh=E4XqfMnpqPv9cpFkNRz0HcBWHoLsXtK7APE2LXMF+p0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=K7K/BkKU1CsshZdDYrrIE9zvhh70pqEWbkvGrgd0JS8GtRIX/8GUtFs8LJW9/W+cq BigDSX8Okw9Be7DX1+zm/oC/i8LjJevF4UYnh1YsXdUk84YcnI/mq3+07Ch/atXzm5 yuMPsBeWtes66ySvfttWNiWf47Z//AU7nzhA7Fjuzr6mFnLcJ0UeJ8Q6BXSmqG5tnw zPHLIG68T/3PwEkyIIQOt1o6pjbZaiUlmJfuYbN/PWZn0CnN6ZbHeSdm5zxxxn7U+v y/gsNhVvaO4cQwxzKpub/RjVRJ/TGshp8XF0o8qNqnjzJlGVe0r9sDIXCod1qOnhSX ZwBJmIegySh9A== Received: from u-boot.org (unknown [73.34.74.121]) by mail.u-boot.org (Postfix) with ESMTPSA id 9083967D8D; Thu, 2 Oct 2025 09:46:13 -0600 (MDT) From: Simon Glass To: U-Boot Concept Date: Thu, 2 Oct 2025 09:45:41 -0600 Message-ID: <20251002154554.4129220-2-sjg@u-boot.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20251002154554.4129220-1-sjg@u-boot.org> References: <20251002154554.4129220-1-sjg@u-boot.org> MIME-Version: 1.0 Message-ID-Hash: 23FX5D6XAMSNQTXBRFPXVSPQWINMGW2W X-Message-ID-Hash: 23FX5D6XAMSNQTXBRFPXVSPQWINMGW2W X-MailFrom: sjg@u-boot.org X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; loop; banned-address; emergency; member-moderation; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; digests; suspicious-header CC: Heinrich Schuchardt , Simon Glass X-Mailman-Version: 3.3.10 Precedence: list Subject: [Concept] [PATCH v2 1/9] cmd: Update setcurs to use hex 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 Commands in U-Boot should use hex consistently. Update this command accordingly. Signed-off-by: Simon Glass --- Changes in v2: - Add new patch to switch this command to use hex cmd/video.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/cmd/video.c b/cmd/video.c index 91bd6de14dc..d11472c3ef6 100644 --- a/cmd/video.c +++ b/cmd/video.c @@ -22,8 +22,8 @@ static int do_video_setcursor(struct cmd_tbl *cmdtp, int flag, int argc, if (uclass_first_device_err(UCLASS_VIDEO_CONSOLE, &dev)) return CMD_RET_FAILURE; - col = dectoul(argv[1], NULL); - row = dectoul(argv[2], NULL); + col = hextoul(argv[1], NULL); + row = hextoul(argv[2], NULL); vidconsole_position_cursor(dev, col, row); return 0; @@ -50,7 +50,7 @@ static int do_video_puts(struct cmd_tbl *cmdtp, int flag, int argc, U_BOOT_CMD( setcurs, 3, 1, do_video_setcursor, "set cursor position within screen", - " in character" + " in hex characters" ); U_BOOT_CMD( From patchwork Thu Oct 2 15:45:42 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 474 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=1759419984; bh=D0cycKFvX0D81aBW4blUVnnxULYeWlEo7jbEUPUuow4=; 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=stwtGzes4D91lgpzN5j53Pc5lEy899TXNsALIujYhKoc3l/t4AD1nLFJeLfSz4Ion bGWMJMyhB818ldBECJ+EolaC3nk7XXy11X/JLiXA2PvjdxQWVXX0cgteB1zJRFVdYQ Zh/7ifynnZCz76MxLVgLyis3FUKQKBtvcfrYUgnIZnt++oWUlG4pzWqVjnEyyoCFGw 0sEEtLK2fL5rbZ8ir2+u9fbG1+f3VT2rUcJV7oe2C3p6BzjJhvbOU4uouSBfZIlfQN SEzTPpb2nFc9V3zvx3Z4noT3xOJo0HoHqO+W6BTGKut21QBnSbJ9yRpB2z/jBLB7iC NZBpNJd1aqwAg== Received: from localhost (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id 1E8FE67F1A for ; Thu, 2 Oct 2025 09:46: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 10024) with ESMTP id by68Vu8BPqfK for ; Thu, 2 Oct 2025 09:46:24 -0600 (MDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1759419984; bh=D0cycKFvX0D81aBW4blUVnnxULYeWlEo7jbEUPUuow4=; 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=stwtGzes4D91lgpzN5j53Pc5lEy899TXNsALIujYhKoc3l/t4AD1nLFJeLfSz4Ion bGWMJMyhB818ldBECJ+EolaC3nk7XXy11X/JLiXA2PvjdxQWVXX0cgteB1zJRFVdYQ Zh/7ifynnZCz76MxLVgLyis3FUKQKBtvcfrYUgnIZnt++oWUlG4pzWqVjnEyyoCFGw 0sEEtLK2fL5rbZ8ir2+u9fbG1+f3VT2rUcJV7oe2C3p6BzjJhvbOU4uouSBfZIlfQN SEzTPpb2nFc9V3zvx3Z4noT3xOJo0HoHqO+W6BTGKut21QBnSbJ9yRpB2z/jBLB7iC NZBpNJd1aqwAg== Received: from mail.u-boot.org (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id 0E03F67F14 for ; Thu, 2 Oct 2025 09:46:24 -0600 (MDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1759419982; bh=ftMd5UjT10zpfWiQP5IVp0pLOlZpZczTbfHOcCwtW7A=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=hNpatVsSipSk/7yyrURSJ1Ya4Wgj0AdFdXLdNFLwGdMuHwIpUnkmgPMaY8wdNoCbY 5CfQLl9abCiU5fenXCFHWVIGybswkiuUWydiAQYIirE4B5Vt25i18CsiJMr4ZkMLrb Q2foetkV44P8wvO10kzK8gnUlDvVJH4/ycRKMxGr62GCdBdG8KhCeQZVRx7Cpk6n8h w4XB6xKDYn22qOyk+8FvSBZL/BVaEv8/t9BRtpRAsfbxvnUtL5ZsQoFJMIOOmKozll 9WkBvW+4WBcNYWVvsWPmJlU785jeq9rxsJoKNTtn+9gmNYdgVp1oEXXe6BMFptmHZq xE25wJRKynolg== Received: from localhost (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id 9D6AA67E4D; Thu, 2 Oct 2025 09:46: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 10026) with ESMTP id mUFMxB3Zc1Q7; Thu, 2 Oct 2025 09:46:22 -0600 (MDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1759419978; bh=5c8jxY/stf3JiSym95WpyCTv9LSVeF7xZqWphA5Lt1U=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=a1eSt6ImAqNCFLfRJciQhPQSK3AF0XHbqr22YhYAePvhlwxQ0Zs52nslBJDSpFSOq gCQlXFyKir7mHhaCWXzpif4kSoRd+7s8C52kye35HX624kyIOoK637WbUOHE+lHFQZ aAN85BHaYgmwk/c9UGEGBauWIQU/5ol79gBdDBYKdnIZT1hXixMNSbSxlD3x0/K80r uvUvsuSVKsK3bMufPQYNk0LuQF36QQKFoem46k8KUNTvTxNXHyzainUoALlTYlFZ+I 2yvP+/C79o6e78TMOqIySklrg89Qxr2+cvUrRh1hvf3X7DlBCC5lDAKKL6Wf+qVSR7 GJJ3LaKX1Kmng== Received: from u-boot.org (unknown [73.34.74.121]) by mail.u-boot.org (Postfix) with ESMTPSA id 39B8567D8D; Thu, 2 Oct 2025 09:46:18 -0600 (MDT) From: Simon Glass To: U-Boot Concept Date: Thu, 2 Oct 2025 09:45:42 -0600 Message-ID: <20251002154554.4129220-3-sjg@u-boot.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20251002154554.4129220-1-sjg@u-boot.org> References: <20251002154554.4129220-1-sjg@u-boot.org> MIME-Version: 1.0 Message-ID-Hash: MHWVO2PUA2VX3V5BH3SIUNHI7MWJT2BM X-Message-ID-Hash: MHWVO2PUA2VX3V5BH3SIUNHI7MWJT2BM 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 v2 2/9] doc: video: Add docs for video commands List-Id: Discussion and patches related to U-Boot Concept Archived-At: List-Archive: List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: From: Simon Glass Add documentation and a simple test for the setcurs and lcdputs commands. Co-developed-by: Claude Signed-off-by: Simon Glass --- Changes in v2: - Split out docs into its own patch; use video: tag doc/usage/cmd/lcdputs.rst | 57 +++++++++++++++++++++++++++++++++++++++ doc/usage/cmd/setcurs.rst | 56 ++++++++++++++++++++++++++++++++++++++ doc/usage/index.rst | 2 ++ 3 files changed, 115 insertions(+) create mode 100644 doc/usage/cmd/lcdputs.rst create mode 100644 doc/usage/cmd/setcurs.rst diff --git a/doc/usage/cmd/lcdputs.rst b/doc/usage/cmd/lcdputs.rst new file mode 100644 index 00000000000..f34dbb3e3f1 --- /dev/null +++ b/doc/usage/cmd/lcdputs.rst @@ -0,0 +1,57 @@ +.. SPDX-License-Identifier: GPL-2.0-or-later + +.. index:: + single: lcdputs (command) + +lcdputs command +=============== + +Synopsis +-------- + +:: + + lcdputs + +Description +----------- + +The lcdputs command prints a string to the video framebuffer at the current +cursor position. + +string + Text string to display on the video console + +Examples +-------- + +Print a simple string:: + + => lcdputs "Hello World" + +Combine with setcurs to position text:: + + => setcurs 10 5 + => lcdputs "Positioned text" + +Print multiple lines:: + + => setcurs 0 0 + => lcdputs "Line 1" + => setcurs 0 1 + => lcdputs "Line 2" + +Configuration +------------- + +The lcdputs command is available if CONFIG_CMD_VIDEO=y. + +See also +-------- + +* :doc:`setcurs` - set cursor position + +Return value +------------ + +The return value $? is 0 (true) on success, 1 (false) on failure. diff --git a/doc/usage/cmd/setcurs.rst b/doc/usage/cmd/setcurs.rst new file mode 100644 index 00000000000..4619206fb40 --- /dev/null +++ b/doc/usage/cmd/setcurs.rst @@ -0,0 +1,56 @@ +.. SPDX-License-Identifier: GPL-2.0-or-later + +.. index:: + single: setcurs (command) + +setcurs command +=============== + +Synopsis +-------- + +:: + + setcurs + +Description +----------- + +The setcurs command sets the cursor position on the video console. + +col + Column position in hex, with 0 being the left side. Note that this is the + text-column position, so the number of pixels per position depends on the + font size. + +row + Row position in hex, with 0 being the top edge. Note that this is the + text-row position, so the number of pixels per position depends on the + font size. + + +Examples +-------- + +Set cursor to column 0x10, row 5:: + + => setcurs 10 5 + +Move cursor to top left:: + + => setcurs 0 0 + +Configuration +------------- + +The setcurs command is available if CONFIG_CMD_VIDEO=y. + +See also +-------- + +* :doc:`lcdputs` - print string on video framebuffer + +Return value +------------ + +The return value $? is 0 (true) on success, 1 (false) on failure. diff --git a/doc/usage/index.rst b/doc/usage/index.rst index 21d6d120e7c..0f271c1280d 100644 --- a/doc/usage/index.rst +++ b/doc/usage/index.rst @@ -85,6 +85,7 @@ Shell commands cmd/if cmd/itest cmd/imxtract + cmd/lcdputs cmd/load cmd/loadb cmd/loadm @@ -117,6 +118,7 @@ Shell commands cmd/scmi cmd/scp03 cmd/seama + cmd/setcurs cmd/setexpr cmd/sf cmd/shim From patchwork Thu Oct 2 15:45:43 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 475 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=1759419988; bh=+Knc1mqh7SUyARbZWMwcscNfje5bg2wt5qKnu3ZR/p0=; 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=Ccknja86eFBEghz3GPBZ5F33jjaUNKuQq94Kt7QKWQhpIzsYjT7A3SdhSeXOelhUT hxWF8m99gg+3UYI+LfreesiDDe1iDTUM7rq16NYiVy51tE3SbcKU6GxbLGw7Lx1ZxP AydXKUpsBSql7pHVuEKPi5BqH7ACTiyqcBUpoxDUpLesDOhxeMCY3uoTTZER4x9Duc l7tdedQ6l5tutKgtYIgk+HBq3D9/TfmIPKEw7JJ+d+OR2DmyfBvi7R4OyF13ZVJIyW V+GSrgBu8ZcKMeHmvJqgYV4rcvLJxbIhODHVx0bGRdAht3/MqcL/wr64LCJaw8b8Ue xvvJmdeaF1PXg== Received: from localhost (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id A196B67F17 for ; Thu, 2 Oct 2025 09:46:28 -0600 (MDT) X-Virus-Scanned: Debian amavis at Received: from mail.u-boot.org ([127.0.0.1]) by localhost (mail.u-boot.org [127.0.0.1]) (amavis, port 10024) with ESMTP id 9qQLg3reGZkH for ; Thu, 2 Oct 2025 09:46:28 -0600 (MDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1759419988; bh=+Knc1mqh7SUyARbZWMwcscNfje5bg2wt5qKnu3ZR/p0=; 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=Ccknja86eFBEghz3GPBZ5F33jjaUNKuQq94Kt7QKWQhpIzsYjT7A3SdhSeXOelhUT hxWF8m99gg+3UYI+LfreesiDDe1iDTUM7rq16NYiVy51tE3SbcKU6GxbLGw7Lx1ZxP AydXKUpsBSql7pHVuEKPi5BqH7ACTiyqcBUpoxDUpLesDOhxeMCY3uoTTZER4x9Duc l7tdedQ6l5tutKgtYIgk+HBq3D9/TfmIPKEw7JJ+d+OR2DmyfBvi7R4OyF13ZVJIyW V+GSrgBu8ZcKMeHmvJqgYV4rcvLJxbIhODHVx0bGRdAht3/MqcL/wr64LCJaw8b8Ue xvvJmdeaF1PXg== Received: from mail.u-boot.org (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id 91CD367E66 for ; Thu, 2 Oct 2025 09:46:28 -0600 (MDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1759419986; bh=F0Vk6O2lrsEhkknSFEHnL6Qb/hd54kXPwOQod44H4T0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=O28j7+UhAHJ7LgqEbpHaM0EcMa9WVZ/cUxLOkhCR5Dc+6/E2Ile9nh9Lr9jonKURk LM7SlNeerE8kvGh08eIL3dxeF4Ia2IW8h4wytUxKPcLcJQHyLrVgAxDjfkIVhIoTul m8Xe72kVijYy/9d7olpMzEyo6I+p/v9G4ZSBiVs1cCmCCK+8eNC92jFXCiwJ5h8O/y LHqlsJ3133zOAKs98E9TL0WwOxEFjtjS4vSgqdKKIOP9NA59ZE0xWFKOiWiU86rcUD N21/ZxTAOTOXSFFFjAT84/Rzzy06V37nBelcNop44+2lUQHQFgXB9y2Ovs+IS6K4Lb LHIW2I8FjnMew== Received: from localhost (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id 92EBF67E4D; Thu, 2 Oct 2025 09:46:26 -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 OkKPItDvjn-U; Thu, 2 Oct 2025 09:46:26 -0600 (MDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1759419983; bh=W9PVUa/1C3EqomdGMKD9FauQI5Aw0uh9E98k6uoTVP4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=CGvLSQQoROKVYyzA6TwSVebqc2ixsXa9pNseyW/YuTRGLq6UQu5lP9AKx2ZjgrpCs FtX+xmJhheJuHvLGwx390BhpDE1vGXggHAbxKqC4N/IAUgL22mfe2BB5MGDWagxbUN aV4XpyMDBH58DFk0SbMDs/lk3Kfurw1qhRCrbB/qgnJooRC3FyVSQdIIej7h5YJh/I XiRBIGaBN1MLvsu7w6eBknMfysez+TNMB2Gcmwp/ZkJ2zd8PphRvZ0QOp5nxJIt2Sn fBvd+NrJRJnLI/LLhFlTicajLzKgEgFDvAE4YfJx9kKi1L+PaboOMtGlrGpVJUz6qC U5Ap4490UKe5w== Received: from u-boot.org (unknown [73.34.74.121]) by mail.u-boot.org (Postfix) with ESMTPSA id E62A067D8D; Thu, 2 Oct 2025 09:46:22 -0600 (MDT) From: Simon Glass To: U-Boot Concept Date: Thu, 2 Oct 2025 09:45:43 -0600 Message-ID: <20251002154554.4129220-4-sjg@u-boot.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20251002154554.4129220-1-sjg@u-boot.org> References: <20251002154554.4129220-1-sjg@u-boot.org> MIME-Version: 1.0 Message-ID-Hash: U3HHZHFQ24YKSMO24W5XYZX3WXJW7TTU X-Message-ID-Hash: U3HHZHFQ24YKSMO24W5XYZX3WXJW7TTU 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 v2 3/9] video: Add tests for the video commands List-Id: Discussion and patches related to U-Boot Concept Archived-At: List-Archive: List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: From: Simon Glass Add a simple test for the setcurs and lcdputs commands. Co-developed-by: Claude Signed-off-by: Simon Glass --- Changes in v2: - Pull out the docs into a separate patch - Update test result for hex test/dm/video.c | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/test/dm/video.c b/test/dm/video.c index 702e9854005..847342891fd 100644 --- a/test/dm/video.c +++ b/test/dm/video.c @@ -1080,3 +1080,23 @@ static int dm_test_video_backspace_truetype(struct unit_test_state *uts) return 0; } DM_TEST(dm_test_video_backspace_truetype, UTF_SCAN_PDATA | UTF_SCAN_FDT); + +/* video commands */ +static int dm_test_video_cmd(struct unit_test_state *uts) +{ + 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)); + ut_assertok(vidconsole_select_font(con, "8x16", 0)); + + ut_assertok(run_command("setcurs 10 5", 0)); + + ut_assertok(run_command("lcdputs \"Test string\"", 0)); + ut_asserteq(187, video_compress_fb(uts, dev, false)); + ut_assertok(video_check_copy_fb(uts, dev)); + + return 0; +} +DM_TEST(dm_test_video_cmd, UTF_SCAN_PDATA | UTF_SCAN_FDT); From patchwork Thu Oct 2 15:45:44 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 476 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=1759419994; bh=TRc5kOhA5ioT2MigN0XgBMgOAUjj26hZubzTtPlwhNQ=; 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=FvdmHD6LR79kwpLC9i4+yhmoW4zN5sxau7oSLm2voiASfhGsAHyZ9SsevSLdH+okE IXVHZxDoUg6zNYxQCQwYzwVetKBh7z5bvz50RBOiR23nLr4bHhAvsXtxb3d5PKL15m AjGT27wXi02mJG75XL4eF+tDNBjkpU2IjhIamf8J78MXMnaLQe41QXbw/OXB8oneIR qKT82bC1Soyaqq9/TAbF2264HJpIHyz6fgnKdn6us+JQUVpS0cVOXWnZH9F9bkvoFc fXrRjhh6A2SZMOV3b/fdnhX/pEMiBG7Q1WFU2uFugIHe6LaHu/YOE0n63vrmQy/bTU SwpNKIglDaOUQ== Received: from localhost (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id 7ECE567F1D for ; Thu, 2 Oct 2025 09:46: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 m658op3qHJEN for ; Thu, 2 Oct 2025 09:46:34 -0600 (MDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1759419994; bh=TRc5kOhA5ioT2MigN0XgBMgOAUjj26hZubzTtPlwhNQ=; 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=FvdmHD6LR79kwpLC9i4+yhmoW4zN5sxau7oSLm2voiASfhGsAHyZ9SsevSLdH+okE IXVHZxDoUg6zNYxQCQwYzwVetKBh7z5bvz50RBOiR23nLr4bHhAvsXtxb3d5PKL15m AjGT27wXi02mJG75XL4eF+tDNBjkpU2IjhIamf8J78MXMnaLQe41QXbw/OXB8oneIR qKT82bC1Soyaqq9/TAbF2264HJpIHyz6fgnKdn6us+JQUVpS0cVOXWnZH9F9bkvoFc fXrRjhh6A2SZMOV3b/fdnhX/pEMiBG7Q1WFU2uFugIHe6LaHu/YOE0n63vrmQy/bTU SwpNKIglDaOUQ== Received: from mail.u-boot.org (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id 6D81E67F16 for ; Thu, 2 Oct 2025 09:46:34 -0600 (MDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1759419993; bh=N8bWnBFW8qeOeFAGQxXSvZSeBP5Uh4SFTtmyEXaGXXM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=QGZHJg103MRdJTDSROmWRBjV+OlVejJRn6Xx/bmSOgvtLIJfJYhW6KuIAhdF9p/xn M1r4JRmlJAwOY2b6UMbTuUKeCqKHq2iCRvLJlDYFZACWeYhncRwIzikAOhfWCIvUpT eNNiczx8qgDLYHOqjJ3tctJRmREXkPngDbWAAQc+EIsZua0cfeD8Uelef/fZ2AfhKW P1s4dLAgJYFXDMJFR3jpaNA0n3wflJEgJmu/bZ+ImGFvcZvUs5Bc9y/rPRqjw8AjvP SEx1DwYUOSBbhzPhaBUCsw9oJ1/vTyvki8i6zmS+q+L79Wum2ht17PDw9O6WtF2Cii nEFsbD/M7LgAw== Received: from localhost (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id 143D867F15; Thu, 2 Oct 2025 09:46:33 -0600 (MDT) X-Virus-Scanned: Debian amavis at Received: from mail.u-boot.org ([127.0.0.1]) by localhost (mail.u-boot.org [127.0.0.1]) (amavis, port 10026) with ESMTP id HcJkqk-1_UQb; Thu, 2 Oct 2025 09:46:33 -0600 (MDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1759419985; bh=pYvphHIgGcXcnr+0peDcEtdtEGSiZpQlo6VWa8vrwdg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=EhrFmeTwvZ3MzTaHMV9+GluaHgrIKvXb2oCHb3RX1P0m4ufAiFUjHSHLfc2hu4phW ssTxkiJ4Kr4j1EKz5zndh9OKc97bCscI/ie2+EEAjvYkzgFrFdClfTCx2O71muYGfE M1i0bnEU+a1E73EoHBeMAaxNwufm9mnTEQW4MtnIuGKQPc3BObYF081/eT8yVpTk9i KemVPv9g7HannVVtQci2fCznDDvCSQ2dK/iaBdRXHaexsk24cNKFrX4Sob5AyIaw5W w3Z+7/7oQ5bU6/ktiezZDnogOBnTgH2QbD1y59gOR9sM2KdkUuSkd9Wyqkg+95wCb8 SyoCC8UYfzxxQ== Received: from u-boot.org (unknown [73.34.74.121]) by mail.u-boot.org (Postfix) with ESMTPSA id E51A067EC6; Thu, 2 Oct 2025 09:46:24 -0600 (MDT) From: Simon Glass To: U-Boot Concept Date: Thu, 2 Oct 2025 09:45:44 -0600 Message-ID: <20251002154554.4129220-5-sjg@u-boot.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20251002154554.4129220-1-sjg@u-boot.org> References: <20251002154554.4129220-1-sjg@u-boot.org> MIME-Version: 1.0 Message-ID-Hash: 5F363PORNFTSDY33Y2JRBQXZZVECKNG3 X-Message-ID-Hash: 5F363PORNFTSDY33Y2JRBQXZZVECKNG3 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 v2 4/9] video: Add video command with subcommands List-Id: Discussion and patches related to U-Boot Concept Archived-At: List-Archive: List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: From: Simon Glass Add a new 'video' command with 'setcursor' and 'puts' subcommands that provide an alternative interface to the existing setcurs and lcdputs commands. Update the test is updated to test both the legacy commands and the new 'video' command. Co-developed-by: Claude Signed-off-by: Simon Glass --- Changes in v2: - Correct confusing output text which should be 16 instead of 10 - Improve docs for row and col cmd/video.c | 8 +++++ doc/usage/cmd/lcdputs.rst | 1 + doc/usage/cmd/setcurs.rst | 1 + doc/usage/cmd/video.rst | 72 +++++++++++++++++++++++++++++++++++++++ doc/usage/index.rst | 1 + test/dm/video.c | 5 +++ 6 files changed, 88 insertions(+) create mode 100644 doc/usage/cmd/video.rst diff --git a/cmd/video.c b/cmd/video.c index d11472c3ef6..9f3a91959df 100644 --- a/cmd/video.c +++ b/cmd/video.c @@ -58,3 +58,11 @@ U_BOOT_CMD( "print string on video framebuffer", " " ); + +U_BOOT_LONGHELP(video, + "setcursor - Set cursor position\n" + "video puts - Write string at current position"); + +U_BOOT_CMD_WITH_SUBCMDS(video, "Video commands", video_help_text, + U_BOOT_SUBCMD_MKENT(setcursor, 3, 1, do_video_setcursor), + U_BOOT_SUBCMD_MKENT(puts, 2, 1, do_video_puts)); diff --git a/doc/usage/cmd/lcdputs.rst b/doc/usage/cmd/lcdputs.rst index f34dbb3e3f1..26e777970d5 100644 --- a/doc/usage/cmd/lcdputs.rst +++ b/doc/usage/cmd/lcdputs.rst @@ -49,6 +49,7 @@ The lcdputs command is available if CONFIG_CMD_VIDEO=y. See also -------- +* :doc:`video` - video command with subcommands * :doc:`setcurs` - set cursor position Return value diff --git a/doc/usage/cmd/setcurs.rst b/doc/usage/cmd/setcurs.rst index 4619206fb40..aca2fc34e7f 100644 --- a/doc/usage/cmd/setcurs.rst +++ b/doc/usage/cmd/setcurs.rst @@ -48,6 +48,7 @@ The setcurs command is available if CONFIG_CMD_VIDEO=y. See also -------- +* :doc:`video` - video command with subcommands * :doc:`lcdputs` - print string on video framebuffer Return value diff --git a/doc/usage/cmd/video.rst b/doc/usage/cmd/video.rst new file mode 100644 index 00000000000..1e7c7f0c050 --- /dev/null +++ b/doc/usage/cmd/video.rst @@ -0,0 +1,72 @@ +.. SPDX-License-Identifier: GPL-2.0-or-later + +.. index:: + single: video (command) + +video command +============= + +Synopsis +-------- + +:: + + video setcursor + video puts + +Description +----------- + +The video command provides access to the video-console subsystem. + +video setcursor +~~~~~~~~~~~~~~~ + + video setcursor + +Set the cursor position on the video console. + +col + Column position in hex, with 0 being the left side. Note that this is the + text-column position, so the number of pixels per position depends on the + font size. + +row + Row position in hex, with 0 being the top edge. Note that this is the + text-row position, so the number of pixels per position depends on the + font size. + +video puts +~~~~~~~~~~ + + video puts + +Write a string to the video console at the current cursor position. + +string + Text string to display + +Examples +-------- + +Set cursor and print text:: + + => video setcursor 10 5 + => video puts "Hello World" + +Print at different positions:: + + => video setcursor 0 0 + => video puts "Top left" + => video setcursor 0 10 + => video puts "Line 16" + +Configuration +------------- + +The video command is available if CONFIG_CMD_VIDEO=y. + +Return value +------------ + +The return value $? is 0 (true) on success, 1 (false) on failure. diff --git a/doc/usage/index.rst b/doc/usage/index.rst index 0f271c1280d..d1887f7d26a 100644 --- a/doc/usage/index.rst +++ b/doc/usage/index.rst @@ -137,6 +137,7 @@ Shell commands cmd/ums cmd/unbind cmd/ut + cmd/video cmd/virtio cmd/wdt cmd/wget diff --git a/test/dm/video.c b/test/dm/video.c index 847342891fd..af305e60268 100644 --- a/test/dm/video.c +++ b/test/dm/video.c @@ -1097,6 +1097,11 @@ static int dm_test_video_cmd(struct unit_test_state *uts) ut_asserteq(187, video_compress_fb(uts, dev, false)); ut_assertok(video_check_copy_fb(uts, dev)); + ut_assertok(run_command("video setcursor 0 0", 0)); + ut_assertok(run_command("video puts \"Top left\"", 0)); + ut_asserteq(272, video_compress_fb(uts, dev, false)); + ut_assertok(video_check_copy_fb(uts, dev)); + return 0; } DM_TEST(dm_test_video_cmd, UTF_SCAN_PDATA | UTF_SCAN_FDT); From patchwork Thu Oct 2 15:45:45 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 477 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=1759419997; bh=I6c1TUK/11KcHPf0pa2J+ANzjj4bjiL57pWLWna2AbU=; 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=jwMWAGlrJ4pJF3Pz6P+APVAox/Qn/3EvTaU+hnE4B7ao56Gv/EE0XSUUxjBMfIv7n h4KYBjUOTwy64te2k564Fl83V9RL0rbfbZSUQQS6dV9yBlnN5JAf+FpglYaca1Agxg AQjv3mvxd0dX4iJpggEhx0VSkDQmNEmcknsfwcqFa8/ClPIq17LhqCoNPYysINwi47 jIqhH3kgEXxRj8ybv2fgspJPdNa4sb2nLZkBgnhz9NuwTWZNIWtzvl+H4+1bCN6m2W GShsgei9RzL6D0aeSQfccROYH3T/ENpc3RDJqcDKhY1hlc1laPQjPULvpuGrZJ2Ipt PNgvlmdxDy9Zw== Received: from localhost (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id 2084167EC6 for ; Thu, 2 Oct 2025 09:46:37 -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 bxxiCMyYC_gS for ; Thu, 2 Oct 2025 09:46:37 -0600 (MDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1759419997; bh=I6c1TUK/11KcHPf0pa2J+ANzjj4bjiL57pWLWna2AbU=; 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=jwMWAGlrJ4pJF3Pz6P+APVAox/Qn/3EvTaU+hnE4B7ao56Gv/EE0XSUUxjBMfIv7n h4KYBjUOTwy64te2k564Fl83V9RL0rbfbZSUQQS6dV9yBlnN5JAf+FpglYaca1Agxg AQjv3mvxd0dX4iJpggEhx0VSkDQmNEmcknsfwcqFa8/ClPIq17LhqCoNPYysINwi47 jIqhH3kgEXxRj8ybv2fgspJPdNa4sb2nLZkBgnhz9NuwTWZNIWtzvl+H4+1bCN6m2W GShsgei9RzL6D0aeSQfccROYH3T/ENpc3RDJqcDKhY1hlc1laPQjPULvpuGrZJ2Ipt PNgvlmdxDy9Zw== Received: from mail.u-boot.org (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id 0CE7467F15 for ; Thu, 2 Oct 2025 09:46:37 -0600 (MDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1759419994; bh=qpi7yLBS+90JjYFjVO5RGqfAoHFE9+GZswQuHlGtBoQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=w5k5Xeqa61UhDxbsR83K9bb7zqwmfXoF793e79r6kg9mSV4g4rXeJd18vV0JOqJ3j A03uarjtF2QNaPeac2zRSAVSBfvCCKoGZQisMKJjimbW4pXML2m48ZM7jutQ7Ff1uT FhhFOziQjsmoxXUmpYihLM5HjAoC9/oFyi+jNPHIaOl98wXeZp1n1yYwT+BMgCfSKz lz17PRboL4GR9MTeHN7FRUikwncWzeNGT3tIKO1Oagm1O163uOMjvgluISEilCJ/O8 a8Lo2Cd4Iw9I4sr8ggp2My8PB4E83AkLhaw05ovv5c7Gencyryvnz7RiI7iLEfDQJ0 1UeufXPthLq5A== Received: from localhost (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id 3A52267E66; Thu, 2 Oct 2025 09:46:34 -0600 (MDT) X-Virus-Scanned: Debian amavis at Received: from mail.u-boot.org ([127.0.0.1]) by localhost (mail.u-boot.org [127.0.0.1]) (amavis, port 10026) with ESMTP id W2GC3DM1v9B3; Thu, 2 Oct 2025 09:46:34 -0600 (MDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1759419990; bh=UpfE8fXGvbYFe5V6Z5UemBotxpprdKOM+ykjGp7X/Oo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=GjV5ccc77MlSfQu3fmhT8E4TQluZh+JZvInHFNK2of5xc2q+1pR+XVR10/lgeTfPx J1ZH6QF5S8UnG+KYK746N1Km2dlN8FVLt+Lw/EnZegS1XF8sThXwk7SZMZFWVlKFoy TR00xGtMMXTqTzWKcxkkF3Jt/1TuZ2LrKEgjSbH1wXTKY/85TIyND7WB9pLPvdGsr7 Zd8vuGQRowQL7mot0Kg/RskJK+HwzyPfSTHZsMHfCj2hqzAhFpoLB7awMMsATnBzyI 3lAH/3f08QES/U5wRjLG9hQudPP4iaRVgN0E0C0xPFuBnvxhEJLM7BPhAuc2yL24WV mAXmpD8YN/GbQ== Received: from u-boot.org (unknown [73.34.74.121]) by mail.u-boot.org (Postfix) with ESMTPSA id B644E67F17; Thu, 2 Oct 2025 09:46:29 -0600 (MDT) From: Simon Glass To: U-Boot Concept Date: Thu, 2 Oct 2025 09:45:45 -0600 Message-ID: <20251002154554.4129220-6-sjg@u-boot.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20251002154554.4129220-1-sjg@u-boot.org> References: <20251002154554.4129220-1-sjg@u-boot.org> MIME-Version: 1.0 Message-ID-Hash: 6XNNP565F4YPJ7IVDVC35F5BY2TOSRLO X-Message-ID-Hash: 6XNNP565F4YPJ7IVDVC35F5BY2TOSRLO 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 , Heinrich Schuchardt X-Mailman-Version: 3.3.10 Precedence: list Subject: [Concept] [PATCH v2 5/9] video: Add a write subcommand 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 This allows writing strings at particular positions on the display, using either character or pixel positions. Co-developed-by: Claude Signed-off-by: Simon Glass Suggested-by: Heinrich Schuchardt --- (no changes since v1) cmd/video.c | 62 +++++++++++++++++++++++++++++++++++++++-- doc/usage/cmd/video.rst | 45 ++++++++++++++++++++++++------ test/dm/video.c | 9 ++++++ 3 files changed, 105 insertions(+), 11 deletions(-) diff --git a/cmd/video.c b/cmd/video.c index 9f3a91959df..503433b9a63 100644 --- a/cmd/video.c +++ b/cmd/video.c @@ -47,6 +47,59 @@ static int do_video_puts(struct cmd_tbl *cmdtp, int flag, int argc, return ret ? CMD_RET_FAILURE : 0; } +static int do_video_write(struct cmd_tbl *cmdtp, int flag, int argc, + char *const argv[]) +{ + struct vidconsole_priv *priv; + bool use_pixels = false; + struct udevice *dev; + int ret, i; + + if (argc < 3) + return CMD_RET_USAGE; + + if (uclass_first_device_err(UCLASS_VIDEO_CONSOLE, &dev)) + return CMD_RET_FAILURE; + priv = dev_get_uclass_priv(dev); + + /* Check for -p flag */ + if (!strcmp(argv[1], "-p")) { + use_pixels = true; + argc--; + argv++; + } + + if (argc < 3 || !(argc % 2)) + return CMD_RET_USAGE; + + for (i = 1; i < argc; i += 2) { + uint col, row; + char *pos = argv[i]; + char *colon = strchr(pos, ':'); + + if (!colon) + return CMD_RET_USAGE; + + col = hextoul(pos, NULL); + row = hextoul(colon + 1, NULL); + + if (use_pixels) + vidconsole_set_cursor_pos(dev, col, row); + else + vidconsole_position_cursor(dev, col, row); + + ret = vidconsole_put_string(dev, argv[i + 1]); + if (ret) + return CMD_RET_FAILURE; + } + + ret = video_sync(dev->parent, false); + if (ret) + return CMD_RET_FAILURE; + + return 0; +} + U_BOOT_CMD( setcurs, 3, 1, do_video_setcursor, "set cursor position within screen", @@ -60,9 +113,12 @@ U_BOOT_CMD( ); U_BOOT_LONGHELP(video, - "setcursor - Set cursor position\n" - "video puts - Write string at current position"); + "setcursor - Set cursor position\n" + "video puts - Write string at current position\n" + "video write [-p] [: ]... - Write strings at specified positions\n" + " -p: Use pixel coordinates instead of character positions"); U_BOOT_CMD_WITH_SUBCMDS(video, "Video commands", video_help_text, U_BOOT_SUBCMD_MKENT(setcursor, 3, 1, do_video_setcursor), - U_BOOT_SUBCMD_MKENT(puts, 2, 1, do_video_puts)); + U_BOOT_SUBCMD_MKENT(puts, 2, 1, do_video_puts), + U_BOOT_SUBCMD_MKENT(write, CONFIG_SYS_MAXARGS, 1, do_video_write)); diff --git a/doc/usage/cmd/video.rst b/doc/usage/cmd/video.rst index 1e7c7f0c050..288260bd979 100644 --- a/doc/usage/cmd/video.rst +++ b/doc/usage/cmd/video.rst @@ -13,18 +13,13 @@ Synopsis video setcursor video puts + video write [: ]... Description ----------- -The video command provides access to the video-console subsystem. - -video setcursor -~~~~~~~~~~~~~~~ - - video setcursor - -Set the cursor position on the video console. +The video command provides access to the video-console subsystem. Common +arguments are as follows: col Column position in hex, with 0 being the left side. Note that this is the @@ -36,6 +31,13 @@ row text-row position, so the number of pixels per position depends on the font size. +video setcursor +~~~~~~~~~~~~~~~ + + video setcursor + +Set the cursor position on the video console. + video puts ~~~~~~~~~~ @@ -46,6 +48,24 @@ Write a string to the video console at the current cursor position. string Text string to display +video write +~~~~~~~~~~~ + + video write [-p] [: ]... + +Write one or more strings to the video console at specified positions. Each +position/string pair sets the cursor to the specified location and writes the +string. Multiple position/string pairs can be provided to write to multiple +locations in a single command. + +-p + Use pixel coordinates instead of character positions. When specified, the + col and row values are interpreted as pixel offsets and converted to + character positions based on the current font size. + +string + Text string to display at the specified position + Examples -------- @@ -61,6 +81,15 @@ Print at different positions:: => video setcursor 0 10 => video puts "Line 16" +Write text at multiple positions:: + + => video write 0:0 "Top left" 0:a "Line 10" + => video write 0:a "First column in line10" 2a:0 "Text column 42" + +Write text using pixel coordinates:: + + => video write -p 0:0 "Top left corner" a0:80 "Pixel position" + Configuration ------------- diff --git a/test/dm/video.c b/test/dm/video.c index af305e60268..598e71411f5 100644 --- a/test/dm/video.c +++ b/test/dm/video.c @@ -1102,6 +1102,15 @@ static int dm_test_video_cmd(struct unit_test_state *uts) ut_asserteq(272, video_compress_fb(uts, dev, false)); ut_assertok(video_check_copy_fb(uts, dev)); + ut_assertok(run_command( + "video write 14:6 \"Multi\" 19:7 \"Write\"", 0)); + ut_asserteq(381, video_compress_fb(uts, dev, false)); + ut_assertok(video_check_copy_fb(uts, dev)); + + ut_assertok(run_command("video write -p a3:34 \"Pixels\"", 0)); + ut_asserteq(440, video_compress_fb(uts, dev, false)); + ut_assertok(video_check_copy_fb(uts, dev)); + return 0; } DM_TEST(dm_test_video_cmd, UTF_SCAN_PDATA | UTF_SCAN_FDT); From patchwork Thu Oct 2 15:45:46 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 478 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=1759419999; bh=bvJlCwUmamlWx9kBMRaj/8JDZACuN7+PFJtLEXCh+MU=; 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=nZ/5qr3BD3SnzSmSB25K+cCdb8GK6RTNf2nNL7HV4rnq3caZRFRIZN9GEhel5bT4h 6TLgdKpk19Ck6D/I0XPMcDONB7wMtB6/UYikLXpjXChEpes04NEcLJJg3bcPIDEJ6A W0ZqiY0BtervLfikdUsWuMSYYjGoUr9g0LBsGCuYqUR2ED4cKM1Rmyuf6LUeH7oaff z+wf2Br3HolEyG10PjRgJSn4/2NFoGnJ70w/wp942T43v1XvbO4/6R0oOzcWWXpTrG EWERwTr0DeKAAb2kjiev1Wa2SZFqQTnbjcVcv5UMKJxIvmolcMohj6hjNSYgF/owhO /gwen2CmnA1eA== Received: from localhost (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id 9A92567F2A for ; Thu, 2 Oct 2025 09:46:39 -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 w52Xo6sp3n68 for ; Thu, 2 Oct 2025 09:46:39 -0600 (MDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1759419998; bh=bvJlCwUmamlWx9kBMRaj/8JDZACuN7+PFJtLEXCh+MU=; 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=LgGHR2Qk3W9/CLR0YzCVHqeLtb7w2/6PLrXoV0E7XynT86rK8C23nfBO/nOR5FWLE jqzg68LNJ7MVSddoTZxRDlZZkGk0QMNX93uQp06ajBJ7sRCQp4gYhdckpgELuvZw3y LFtzowsE8f6ixAjucJXbma0fDfR8ANRExnKyGytmB2ymXCyjtj/7uCmv0HAGTYWLyw oqiQzPN+DBWfG7qfPC4UDRDo48YwaVqtOsr9Hquzd+jn7zrhMd/2NVALmxmZwARpEX GuEmvwh9RWL3k4kPinkL1iIS6thT66+Z2CCOHXToBFhVabgb5rTa9bKDN410JF08Ws xIgqRsMhoYNkg== Received: from mail.u-boot.org (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id CDC7967F14 for ; Thu, 2 Oct 2025 09:46:38 -0600 (MDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1759419997; bh=uMlih6kobzn1qxIOL79G0Digay+Lq6OqioLNIGTNN5A=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=KMC3lfp2QI3HlLBcZ1cMwKwsgP/N3PBewnEET1njUYtZbXRYX2Jonokztz+NJh5DG zkracfP2izxLn5spiy3O8HlI8O5LuAiAmeIYWasarY611ejeRV+LdC514gv6KUzlyN 1e2ateOzSK8dPrt9OBsPYHG9xa5FOrmAcIRUkWmVmds2GnGMk2ScdfMBv82hGV2k1k D6OoL1IjnMlYykcInvgeUn2GnXB2Yi68puXFSB8lWBnlL+5jTp7fUnI0Dj4PYolF/i 5MD0qzO3OtoYM07a7CIg0TcjMG07cKMn77fp7PbCQbpNOSnPkQLm7emX3ku6t3aVRY 4af32p+NIHrMg== Received: from localhost (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id 0D98967F16; Thu, 2 Oct 2025 09:46:37 -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 EWd5i7mYYyoV; Thu, 2 Oct 2025 09:46:36 -0600 (MDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1759419994; bh=1AYip8ef3TOSCTdvf0jQquVFBVkjE+JibyhJVIEf8lo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=mJCzml/nBcRlBiEnXSPR6CEX/jZ14Veb7WcMllvBhli0yqZqpErNCozz/N4GknPJT 0pn7dLE7JqeGdClRP2QJnIqBhfcZUEOXKPOIUnh2UcWnDmaNINjMuc/O9PLGteUDS/ Goer66v7axcqHOAvWwdSyOFOOEOTkjsGIQyOdvFc3/34J/xPBF/f+2zQ/3OwqhlakO gH2c5P+HoY98xRMtXpxvzZItSoub84coPHs+yKnJsRFRXn3ltFxeGFjTpP8npDFa6E PpotXrmCCATfKR/OiuKDRQtReSB7vHBLV+CKuLWmyCeY0QM8UO6P19BfhgoJvDQRgw xbRT9fI2z7suw== Received: from u-boot.org (unknown [73.34.74.121]) by mail.u-boot.org (Postfix) with ESMTPSA id 7D71467F1A; Thu, 2 Oct 2025 09:46:34 -0600 (MDT) From: Simon Glass To: U-Boot Concept Date: Thu, 2 Oct 2025 09:45:46 -0600 Message-ID: <20251002154554.4129220-7-sjg@u-boot.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20251002154554.4129220-1-sjg@u-boot.org> References: <20251002154554.4129220-1-sjg@u-boot.org> MIME-Version: 1.0 Message-ID-Hash: IHXXCS3OIPQ2AQ3RURU3QDPJYJFSNOGI X-Message-ID-Hash: IHXXCS3OIPQ2AQ3RURU3QDPJYJFSNOGI 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 v2 6/9] video: Support a linker list of images 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 It is inconvenient to have to access graphical images as independent symbols. Create a new rule which handles any file mentioned in drivers/video/images/Makefile For each graphical image, embed in the image and create a linker-list entry for it. Co-developed-by: Claude Signed-off-by: Simon Glass --- Changes in v2: - Use Canonical copyright include/video.h | 46 +++++++++++++++++++++++++++++++++++++++++++ include/video_image.h | 13 ++++++++++++ scripts/Makefile.lib | 38 +++++++++++++++++++++++++++++++++++ 3 files changed, 97 insertions(+) create mode 100644 include/video_image.h diff --git a/include/video.h b/include/video.h index 9f891cf9d30..9985f5adcf8 100644 --- a/include/video.h +++ b/include/video.h @@ -7,7 +7,9 @@ #ifndef _VIDEO_H_ #define _VIDEO_H_ +#include #include +#include #ifdef CONFIG_SANDBOX #include #endif @@ -201,6 +203,50 @@ enum colour_idx { VID_COLOUR_COUNT }; +/** + * struct video_image - Information about an embedded image + * + * This structure holds the pointers to the start and end of an image + * that is embedded in the U-Boot binary, along with its name. + * On 64-bit: 2*8 + VIDEO_IMAGE_NAMELEN = 32 bytes + * On 32-bit: 2*4 + VIDEO_IMAGE_NAMELEN = 24 bytes + * + * @begin: Pointer to the start of the image data + * @end: Pointer to the end of the image data + * @name: Name of the image (e.g., "u_boot", "canonical"), null-terminated + */ +struct video_image { + const void *begin; + const void *end; + char name[VIDEO_IMAGE_NAMELEN]; +}; + +/** + * video_image_get() - Get the start address and size of an image + * + * @_name: Name of the image taken from filename (e.g. u_boot) + * @_sizep: Returns the size of the image in bytes + * Return: Pointer to the start of the image data + */ +#define video_image_get(_name, _sizep) ({ \ + struct video_image *__img = ll_entry_get(struct video_image, _name, \ + video_image); \ + *(_sizep) = (ulong)__img->end - (ulong)__img->begin; \ + (void *)__img->begin; \ + }) + +/** + * video_image_getptr() - Get the start address of an image + * + * @_name: Name of the image taken from filename (e.g. u_boot) + * Return: Pointer to the start of the image data + */ +#define video_image_getptr(_name) ({ \ + struct video_image *__img = ll_entry_get(struct video_image, _name, \ + video_image); \ + (void *)__img->begin; \ + }) + /** * video_index_to_colour() - convert a color code to a pixel's internal * representation diff --git a/include/video_image.h b/include/video_image.h new file mode 100644 index 00000000000..6c4370937aa --- /dev/null +++ b/include/video_image.h @@ -0,0 +1,13 @@ +/* SPDX-License-Identifier: GPL-2.0+ */ +/* + * Copyright 2025 Canonical Ltd + * Written by Simon Glass + */ + +#ifndef __VIDEO_IMAGE_H +#define __VIDEO_IMAGE_H + +/* Maximum length of an embedded image name */ +#define VIDEO_IMAGE_NAMELEN 16 + +#endif /* __VIDEO_IMAGE_H */ diff --git a/scripts/Makefile.lib b/scripts/Makefile.lib index 5abe428e752..e812327b585 100644 --- a/scripts/Makefile.lib +++ b/scripts/Makefile.lib @@ -523,6 +523,44 @@ cmd_S_splash= \ $(obj)/%_logo.S: $(src)/%_logo.bmp $(call cmd,S_splash) +# Handle image files in drivers/video/images without _logo suffix +# Generate an assembly file to wrap the image data and create a linker-list entry +quiet_cmd_S_image= IMAGE $@ +cmd_S_image= \ +( \ + echo '\#include '; \ + echo '.section .rodata.image.init,"a"'; \ + echo '.balign 16'; \ + echo '.global __image_$(*F)_begin'; \ + echo '__image_$(*F)_begin:'; \ + echo '.incbin "$<" '; \ + echo '__image_$(*F)_end:'; \ + echo '.global __image_$(*F)_end'; \ + echo '.balign 16'; \ + echo ''; \ + echo '/* Linker list entry for this image */'; \ + echo '.section __u_boot_list_2_video_image_2_$(*F), "aw"'; \ + echo '.balign 8'; \ + echo '.global _u_boot_list_2_video_image_2_$(*F)'; \ + echo '_u_boot_list_2_video_image_2_$(*F):'; \ + echo '\#ifdef __LP64__'; \ + echo '.quad __image_$(*F)_begin'; \ + echo '.quad __image_$(*F)_end'; \ + echo '.asciz "'$(*F)'"'; \ + echo '.org _u_boot_list_2_video_image_2_$(*F) + 16 + VIDEO_IMAGE_NAMELEN'; \ + echo '\#else'; \ + echo '.long __image_$(*F)_begin'; \ + echo '.long __image_$(*F)_end'; \ + echo '.asciz "'$(*F)'"'; \ + echo '.org _u_boot_list_2_video_image_2_$(*F) + 8 + VIDEO_IMAGE_NAMELEN'; \ + echo '\#endif'; \ +) > $@ + +ifneq ($(filter drivers/video/images,$(obj)),) +$(obj)/%.S: $(src)/%.bmp + $(call cmd,S_image) +endif + # Generate an assembly file to wrap the EFI 'Boot Graphics Resource Table' image quiet_cmd_S_bgrt= BGRT $@ # Modified for U-Boot From patchwork Thu Oct 2 15:45:47 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 479 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=1759420004; bh=wWwE5cAUAZlwYQweigxyUFJacqYn2bZmbMPihfHBxp8=; 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=KGMRTnz0Q1000M6LrdLZTAqVt2QQ685rtFPGAh2Yqoev5wh5rfp3pbQa0fxyeHWTE 8XUHx837GJJBm4XG0BRfVwLF1xeljYZaVaYIftJBMZeIcFUNbSz47ddab8el4zU6Ju SdER89RzNGWYesGmrQsdJNX0+ZgRw3bLBuT9CZxXYSIDHaUxyrTUFXsAjhCJMpQZyr pc8ZH95nkOINIVtCuY33kuNjX4mtuYY6TyKQHfakCOvTl8Lx//92mCSA9z4OiwV+dX 01OQPcvlp2zUfXBB2mh9SHc9/6mJRhd/ZMDzaGAINOrMETsdKX5Yv1Q39Bv1JvvEbs K56RLiGXFU6xA== Received: from localhost (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id 7360A67F1A for ; Thu, 2 Oct 2025 09:46:44 -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 Jra0MUO3h6tZ for ; Thu, 2 Oct 2025 09:46:44 -0600 (MDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1759420004; bh=wWwE5cAUAZlwYQweigxyUFJacqYn2bZmbMPihfHBxp8=; 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=KGMRTnz0Q1000M6LrdLZTAqVt2QQ685rtFPGAh2Yqoev5wh5rfp3pbQa0fxyeHWTE 8XUHx837GJJBm4XG0BRfVwLF1xeljYZaVaYIftJBMZeIcFUNbSz47ddab8el4zU6Ju SdER89RzNGWYesGmrQsdJNX0+ZgRw3bLBuT9CZxXYSIDHaUxyrTUFXsAjhCJMpQZyr pc8ZH95nkOINIVtCuY33kuNjX4mtuYY6TyKQHfakCOvTl8Lx//92mCSA9z4OiwV+dX 01OQPcvlp2zUfXBB2mh9SHc9/6mJRhd/ZMDzaGAINOrMETsdKX5Yv1Q39Bv1JvvEbs K56RLiGXFU6xA== Received: from mail.u-boot.org (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id 638CA67F14 for ; Thu, 2 Oct 2025 09:46:44 -0600 (MDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1759420002; bh=hnkfR36ENFov18f6IHj2+2BSNUxV2CexIwPcUQtuQ80=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=pWQMduR8vZyV+I4FHq3CDZB8qalmZ17V9JxRfUfXKpzX2oh/N5j2Rc4p7BOFtZlfi gpQqq63cZUtxukFOSNAts+y1XECq6O5/fKC4PXMU164VIshF8KY7fgkEs/qHiXeTEx 7wUGBswfcfPDWzhegNMUA8KwQS0H9/EHDUU6GNWjsGIAyoFP0YoFOs6BCH3tH4EJUR fgPTEtMnSOqeFbRJM3hmQH1Or4qFw7ciwC/g56RJB5k502E8Usbl+lAga9HP0rTaKR D1bMnWRcQ2VteDE8sQGa0iiI8WrXLCQfr16uxVW3/BlHG+jnvBuU14HrWHEjBZyePp cpYJ+syWssqqQ== Received: from localhost (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id F3ADD67F14; Thu, 2 Oct 2025 09:46: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 dtyLuAtX7jh5; Thu, 2 Oct 2025 09:46:41 -0600 (MDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1759419996; bh=YbEe6EBWLohszTDA8wraGFomDKJ+jdZ/V/uqpfAoQOE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=fPPkvakY3j9JFrU4SDl0cAOhJW4dJpCvHjXUmcuOuB694brBOHrnCtTFo0xU+kBNw ESiVPNY14bcaACLzc9MYu0FohTHZnF49TsQh165rlcHtvYTbjiYL5BQ3Uyr3tfAkep WQApJW5qTgHL55UzKetpGTdWvwle5vVjxZA5vaXClIpBiu/DuUsEdCnmk5LhaLR6NM A1YGOAe76lCXLHmEHAh625jTlG8eC2JOytwZzaIADESSnjR1kpunMvZsmhFBtEa4Ka gEo+zUb5iIAWl4u8xW2RcWSzGIjViMioxJ8vcvQTk/YUmxhoXX80RYQioMvCTaTaMl m2Mbo+3NcXcsQ== Received: from u-boot.org (unknown [73.34.74.121]) by mail.u-boot.org (Postfix) with ESMTPSA id 91D2067E66; Thu, 2 Oct 2025 09:46:36 -0600 (MDT) From: Simon Glass To: U-Boot Concept Date: Thu, 2 Oct 2025 09:45:47 -0600 Message-ID: <20251002154554.4129220-8-sjg@u-boot.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20251002154554.4129220-1-sjg@u-boot.org> References: <20251002154554.4129220-1-sjg@u-boot.org> MIME-Version: 1.0 Message-ID-Hash: HIT67C4AK6AG5KS36UTWPSZ44AB7PP2G X-Message-ID-Hash: HIT67C4AK6AG5KS36UTWPSZ44AB7PP2G 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 v2 7/9] video: Move the logo into the new video-images directory 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 Move u_boot_logo.bmp into drivers/video/images and include it in the build. Make use of the new video_image_get() macro to obtain the logo. Drop the old SPLASH_...() macros. Co-developed-by: Claude Signed-off-by: Simon Glass --- (no changes since v1) drivers/video/Makefile | 3 ++- drivers/video/images/Makefile | 5 +++++ .../{u_boot_logo.bmp => images/u_boot.bmp} | Bin drivers/video/video-uclass.c | 20 +++++++----------- 4 files changed, 15 insertions(+), 13 deletions(-) create mode 100644 drivers/video/images/Makefile rename drivers/video/{u_boot_logo.bmp => images/u_boot.bmp} (100%) diff --git a/drivers/video/Makefile b/drivers/video/Makefile index e0b0015606f..620f278c738 100644 --- a/drivers/video/Makefile +++ b/drivers/video/Makefile @@ -24,7 +24,6 @@ obj-$(CONFIG_$(PHASE_)PANEL) += panel-uclass.o obj-$(CONFIG_PANEL_HX8238D) += hx8238d.o obj-$(CONFIG_$(PHASE_)SIMPLE_PANEL) += simple_panel.o -obj-$(CONFIG_VIDEO_LOGO) += u_boot_logo.o obj-$(CONFIG_$(PHASE_)BMP) += bmp.o obj-y += vesa_helper.o @@ -86,3 +85,5 @@ obj-$(CONFIG_VIDEO_ZYNQMP_DPSUB) += zynqmp/ obj-y += bridge/ obj-y += sunxi/ obj-y += tegra20/ + +obj-y += images/ diff --git a/drivers/video/images/Makefile b/drivers/video/images/Makefile new file mode 100644 index 00000000000..d3aca2ee7f7 --- /dev/null +++ b/drivers/video/images/Makefile @@ -0,0 +1,5 @@ +# SPDX-License-Identifier: GPL-2.0+ +# +# Copyright 2025 Simon Glass + +obj-$(CONFIG_VIDEO_LOGO) += u_boot.o diff --git a/drivers/video/u_boot_logo.bmp b/drivers/video/images/u_boot.bmp similarity index 100% rename from drivers/video/u_boot_logo.bmp rename to drivers/video/images/u_boot.bmp diff --git a/drivers/video/video-uclass.c b/drivers/video/video-uclass.c index be014a770d0..eaf6cf9fc71 100644 --- a/drivers/video/video-uclass.c +++ b/drivers/video/video-uclass.c @@ -581,28 +581,24 @@ int video_get_ysize(struct udevice *dev) return priv->ysize; } -#define SPLASH_DECL(_name) \ - extern u8 __splash_ ## _name ## _begin[]; \ - extern u8 __splash_ ## _name ## _end[] - -#define SPLASH_START(_name) __splash_ ## _name ## _begin -#define SPLASH_END(_name) __splash_ ## _name ## _end - -SPLASH_DECL(u_boot_logo); - void *video_get_u_boot_logo(int *sizep) { + void *ptr; + int size; + + ptr = video_image_get(u_boot, &size); if (sizep) - *sizep = SPLASH_END(u_boot_logo) - SPLASH_START(u_boot_logo); + *sizep = size; - return SPLASH_START(u_boot_logo); + return ptr; } static int show_splash(struct udevice *dev) { - u8 *data = SPLASH_START(u_boot_logo); + u8 *data; int ret; + data = video_image_getptr(u_boot); ret = video_bmp_display(dev, map_to_sysmem(data), -4, 4, true); return 0; From patchwork Thu Oct 2 15:45:48 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 480 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=1759420006; bh=XFcWmtuR/MTjKo/XjTMuFwXGTezi/Je66Qmd9ty6eAE=; 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=sUuGc1TCT2cD5d2igSypu+NMUlL0B3j4OJ7IZF88tmzRMzb9NFr2J/3PCC6j7zsi3 LJudx/a7pmfCn2I3jamLNv1J+6c9lp7vdzt+zS1fXB3dJNgl1LyzKW00rm/JFQj/Ug JMfSY+MHAdFZko1kBDaUJsULOgqDOagwYUEPGR0lX8IDZ9h+x8W9QChAMXldV+LmbF 8d6X5im5P419dPdlSETn3tAaFQoCd6Nq01ylteJXMJ/5CpwKQ5fTNzkd8sah6LCqL1 afeOvk4PSUbIH+WnepcynMzaww30KZib9q3Y5BhR/bZMJWs1mpEg3a7w1k9Z1pVjLg See6pVYGhQHlQ== Received: from localhost (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id F2B1667EC6 for ; Thu, 2 Oct 2025 09:46: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 0yfjjLhW5z-c for ; Thu, 2 Oct 2025 09:46:46 -0600 (MDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1759420004; bh=XFcWmtuR/MTjKo/XjTMuFwXGTezi/Je66Qmd9ty6eAE=; 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=XiX02vYJ1HiueT7Frjl/37jPUj9sEZznZlIk3FoyvzyttwqXeC0wGrx2UUh9A49k8 6sIsvIPZgTvjBvpdGWDitNt/PECgCbMm37v4iTrvJaxozUMpBu4jfuZWw0YOADfrq6 JKSNaVWsNznFi5jNpYR4XG26fNtElJPC35axuOfnUxqdHeoDmVaZTq1zQZfa9wi8m3 zeMA+nl4dsbWm6lQ7lZnFdp4mPGQvI0+y1/v23k9+4Vq2CvOaudUI9DJcDslnLKhTZ syYik1AxGh8iUSfXcd1OgL8XqQQrD3EZ1HeyC/qhYFYsIzRTagNRNivC3lLzNapSpB SISn0ymr84Nuw== Received: from mail.u-boot.org (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id EF18267F28 for ; Thu, 2 Oct 2025 09:46:44 -0600 (MDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1759420003; bh=6lOOEbjbW5mb77XHGBtsik+x4mzTdiiqBaIvmVniQH8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Pz+M5kj97ZJMycckvWekV+MIacLfkbW/O5z2DuQrZgomOEyHjSFJ/K58z2BCS2Skx NZFe1AW0ZfEcsAhGleoj+UHzlxHLWEa+thLdCmTquwuKZlkzk7iy9ehtr2J0jin9Id V6P70YdECIvzcd6lo0H0ZDMR+QRUGCVGltb5FKlufKw2xaJs00z3zJJ1xFO9eiDqIu C1HBylHBpfuzOYV3/kJUnc/AXUyRMC6o9nCsP9paFExVTmuN4oWEHh+N2Mv9syIvqP kBeykuaxVKszs0xTqQS1WAbxki8VrNRsel91wsYgSDsfmLt03mPYZmNdUdZLxmNxKw 1oqQu5VTyPZ5g== Received: from localhost (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id 07A9667E4D; Thu, 2 Oct 2025 09:46: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 6dJoz9w8qmPu; Thu, 2 Oct 2025 09:46:42 -0600 (MDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1759420001; bh=Y0eyfZyr492i7qaULrS1E6cMqG0zikADEtsLtBBFdwk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=PDsG/0aAFmsjHc3hD5GoY3ezT539HOifmrHLEg+8Ff85bwDe2IWbvti911o/kJ5DH BU5pgveBLbHHPmQ67mQ8I+LuhBGIuVu7Y8AGMVW0FJCXpOSgNsb2vxhshI4Ew7pk5E +5xwb59TMLPW+T1Ia7L9RA2TgQPn/wu9NoV9XiHPfjfwL7pzcNV9F1by8X5uP+Pij6 ilPEkJ2skxhSjNgA88cHHDRnX1rW4vxJWILY+nEfpnP1GrPTfOcP5VXHMfR2s1ypds tDFaT0yalQVeta49zGV7Ma/qhZUQNVf7m7bsKIjM6JC7p5hKb2OQmSQWsFw2nF+1d2 meTquIYptqoRw== Received: from u-boot.org (unknown [73.34.74.121]) by mail.u-boot.org (Postfix) with ESMTPSA id 3F2CB67D8D; Thu, 2 Oct 2025 09:46:41 -0600 (MDT) From: Simon Glass To: U-Boot Concept Date: Thu, 2 Oct 2025 09:45:48 -0600 Message-ID: <20251002154554.4129220-9-sjg@u-boot.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20251002154554.4129220-1-sjg@u-boot.org> References: <20251002154554.4129220-1-sjg@u-boot.org> MIME-Version: 1.0 Message-ID-Hash: NL45AFFQD5GR5LZPGMQLAB3TETUJIVPV X-Message-ID-Hash: NL45AFFQD5GR5LZPGMQLAB3TETUJIVPV 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 v2 8/9] acpi: bgrt: Move the BGRT image into the images directory 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 Move the BGRT image to use the same video_image linker-list approach as the other embedded image. Move it into the drivers/video/images directory and rename it to 'bgrt.bmp' since we know it is an image. Drop the old bgrt Makefile rule as it is no-longer needed. Co-developed-by: Claude Signed-off-by: Simon Glass --- (no changes since v1) drivers/video/images/Makefile | 4 ++++ .../video/images/bgrt.bmp | Bin lib/acpi/Makefile | 2 -- lib/acpi/acpi_extra.c | 22 ++++-------------- scripts/Makefile.lib | 18 -------------- 5 files changed, 8 insertions(+), 38 deletions(-) rename lib/acpi/bgrt_image.bmp => drivers/video/images/bgrt.bmp (100%) diff --git a/drivers/video/images/Makefile b/drivers/video/images/Makefile index d3aca2ee7f7..9b0d85cd2c8 100644 --- a/drivers/video/images/Makefile +++ b/drivers/video/images/Makefile @@ -3,3 +3,7 @@ # Copyright 2025 Simon Glass obj-$(CONFIG_VIDEO_LOGO) += u_boot.o + +ifdef CONFIG_$(PHASE_)GENERATE_ACPI_TABLE +obj-y += bgrt.o +endif diff --git a/lib/acpi/bgrt_image.bmp b/drivers/video/images/bgrt.bmp similarity index 100% rename from lib/acpi/bgrt_image.bmp rename to drivers/video/images/bgrt.bmp diff --git a/lib/acpi/Makefile b/lib/acpi/Makefile index a4850fcc108..4b9b1ef8029 100644 --- a/lib/acpi/Makefile +++ b/lib/acpi/Makefile @@ -12,8 +12,6 @@ obj-$(CONFIG_$(PHASE_)ACPIGEN) += acpi_table.o obj-y += acpi_extra.o obj-y += acpi_writer.o -obj-y += bgrt_image.o - # With QEMU the ACPI tables come from there, not from U-Boot ifndef CONFIG_QFW_ACPI obj-y += base.o diff --git a/lib/acpi/acpi_extra.c b/lib/acpi/acpi_extra.c index 7620f953add..709f64305b5 100644 --- a/lib/acpi/acpi_extra.c +++ b/lib/acpi/acpi_extra.c @@ -13,23 +13,6 @@ #include #include -#define BGRT_DECL(_name) \ - extern u8 __bgrt_ ## _name ## _begin[]; \ - extern u8 __bgrt_ ## _name ## _end[] - -#define BGRT_START(_name) __bgrt_ ## _name ## _begin -#define BGRT_END(_name) __bgrt_ ## _name ## _end - -BGRT_DECL(image); - -static void *bgrt_get_image(int *sizep) -{ - if (sizep) - *sizep = BGRT_END(image) - BGRT_START(image); - - return BGRT_START(image); -} - int acpi_write_bgrt(struct acpi_ctx *ctx) { struct udevice *dev; @@ -42,7 +25,10 @@ int acpi_write_bgrt(struct acpi_ctx *ctx) /* If video is available, use the screen size to centre the logo */ have_video = !uclass_first_device_err(UCLASS_VIDEO, &dev); - logo = bgrt_get_image(&size); + if (!IS_ENABLED(CONFIG_VIDEO)) + return -ENOENT; + + logo = video_image_get(bgrt, &size); /* If there's no logo data, there's nothing to report */ if (!logo) diff --git a/scripts/Makefile.lib b/scripts/Makefile.lib index e812327b585..6a64760de5e 100644 --- a/scripts/Makefile.lib +++ b/scripts/Makefile.lib @@ -561,24 +561,6 @@ $(obj)/%.S: $(src)/%.bmp $(call cmd,S_image) endif -# Generate an assembly file to wrap the EFI 'Boot Graphics Resource Table' image -quiet_cmd_S_bgrt= BGRT $@ -# Modified for U-Boot -cmd_S_bgrt= \ -( \ - echo '.section .rodata.bgrt.init,"a"'; \ - echo '.balign 16'; \ - echo '.global __$(*F)_image_begin'; \ - echo '__$(*F)_image_begin:'; \ - echo '.incbin "$<" '; \ - echo '__$(*F)_image_end:'; \ - echo '.global __$(*F)_image_end'; \ - echo '.balign 16'; \ -) > $@ - -$(obj)/%_image.S: $(src)/%_image.bmp - $(call cmd,S_bgrt) - # EFI applications # A Makefile target *.efi is built as EFI application. # A Makefile target *_efi.S wraps *.efi as built-in EFI application. From patchwork Thu Oct 2 15:45:49 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 481 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=1759420010; bh=ut4bnCoJYVW+pqxw3qZA9nPvDAXYwIJUr8z2SSY8bl0=; 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=FFDCNvV6sbdXGrcAclNpegDN5QWeDg/MJmKEDyRMEnOuS+6ILJy+UUjEiP8vm/m95 8J+HzKgOu2PibOgin7GpYHf6F1osSrwOdpLSRXWMJ9KjgSFjUrAbUUChhamaMnctK1 XSMUz0jLZZJxfKcDG+HsCKgVgML3xvM+1Ex4uz0OLn0UertxTdhDgXj6kqL8v9T1iY fofASqdhUdU204BqxDInj4YDaLVnF427GHgG8hxCwycd3KZcpPF0atod96fH7aeu5i aTVC0LHTbg1hRR3SCiIk+mh8ovq3B5b936VkAmSzZSbFbJlh0x8m3CR3Rywxm0hDJB 4//ktQe9aml7A== Received: from localhost (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id C4A3667F17 for ; Thu, 2 Oct 2025 09:46: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 Q77IXCr-nLYt for ; Thu, 2 Oct 2025 09:46:50 -0600 (MDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1759420010; bh=ut4bnCoJYVW+pqxw3qZA9nPvDAXYwIJUr8z2SSY8bl0=; 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=FFDCNvV6sbdXGrcAclNpegDN5QWeDg/MJmKEDyRMEnOuS+6ILJy+UUjEiP8vm/m95 8J+HzKgOu2PibOgin7GpYHf6F1osSrwOdpLSRXWMJ9KjgSFjUrAbUUChhamaMnctK1 XSMUz0jLZZJxfKcDG+HsCKgVgML3xvM+1Ex4uz0OLn0UertxTdhDgXj6kqL8v9T1iY fofASqdhUdU204BqxDInj4YDaLVnF427GHgG8hxCwycd3KZcpPF0atod96fH7aeu5i aTVC0LHTbg1hRR3SCiIk+mh8ovq3B5b936VkAmSzZSbFbJlh0x8m3CR3Rywxm0hDJB 4//ktQe9aml7A== Received: from mail.u-boot.org (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id B111267EC6 for ; Thu, 2 Oct 2025 09:46:50 -0600 (MDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1759420009; bh=DUPmgSfbQm76Skn+qvRaAWj8qPj4fNaM+ivPFKktBZA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=EFCIvwaYdMBS4myQ1z2nxTvw9mUMTYoa8Z7KpM+VDk/NrHbLnAebLBKKUUPOkXB9B Bu5C3dezSCTvn6tTpagTeKEkYnEze3roS3IYefOKGfuUlBPoVNHYaZXf/t6mpAMKYT cp9B1ZdSKQVQm+KWY+tfSd+BOpRoFbGxvT8RDysO59bvBq+JeVjGyEsmsXv3LAKol7 F56KHZgQd4Ln9hMdNNaytfXnozKt2/yF4quB0gpLt/dppluTdYvqO8ZHEOhlUspVYq 6T4jbuHjCu0D9aTMl3ZIxuUjIvj35FizNJU8RmPt8ghwCSwOKo7z6cS3P/GPFr22GW AsT8FHso2QKZQ== Received: from localhost (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id 5803567E4D; Thu, 2 Oct 2025 09:46: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 4QkIIp_OQeP8; Thu, 2 Oct 2025 09:46:49 -0600 (MDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1759420003; bh=iq1FFXMntGaUAwdEKh2X075UiTawwAup1Shc0bXU7U8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=fVwHSJM9WWT2HOzWfPsaxOIE5DISF5W+AkHFW9oOFE/8V47kegicxxRxoiyY0OUNf 6EPAvAHnCEorX3X5TnPEe3xXERKDwNLLPj0cPX0b/5atH3zE2IwMIy428A16xOOgfQ zGZg2//gOypOJPSzX4lQQ2DBAf8pjrkrSsTeGYHQ6io91vO9cMMdPhYDVGC2L4kZ71 67yn6Gi299aCiBDaR0l1ps5ZMiAAOjWwO3z7NsnkI0xnE5IdmF/+VRn9A2SucESn0t ty9t58VXKw/Hm1QL7Mcau5NBa6+aWHecMaUh6UkRLf3x6PnQcjvkmtVbaolPpVPHwm cKJlDXsqi4Mvg== Received: from u-boot.org (unknown [73.34.74.121]) by mail.u-boot.org (Postfix) with ESMTPSA id 4FCA267D8D; Thu, 2 Oct 2025 09:46:43 -0600 (MDT) From: Simon Glass To: U-Boot Concept Date: Thu, 2 Oct 2025 09:45:49 -0600 Message-ID: <20251002154554.4129220-10-sjg@u-boot.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20251002154554.4129220-1-sjg@u-boot.org> References: <20251002154554.4129220-1-sjg@u-boot.org> MIME-Version: 1.0 Message-ID-Hash: 64KMTY3BEPCG7NT4ZRJ6TVK4ZUP5VFRW X-Message-ID-Hash: 64KMTY3BEPCG7NT4ZRJ6TVK4ZUP5VFRW 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 v2 9/9] video: Provide a command to list built-in images List-Id: Discussion and patches related to U-Boot Concept Archived-At: List-Archive: List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: From: Simon Glass Add a new 'video images' command which lists the graphical images that are compiled into U-Boot. Generally the only one is the logo. Co-developed-by: Claude Signed-off-by: Simon Glass --- (no changes since v1) cmd/video.c | 30 ++++++++++++++++++++++++++++-- doc/usage/cmd/video.rst | 21 ++++++++++++++++++++- test/dm/video.c | 16 ++++++++++++++++ 3 files changed, 64 insertions(+), 3 deletions(-) diff --git a/cmd/video.c b/cmd/video.c index 503433b9a63..4f00ffa2f77 100644 --- a/cmd/video.c +++ b/cmd/video.c @@ -8,6 +8,7 @@ #include #include +#include #include #include @@ -100,6 +101,29 @@ static int do_video_write(struct cmd_tbl *cmdtp, int flag, int argc, return 0; } +static int do_video_images(struct cmd_tbl *cmdtp, int flag, int argc, + char *const argv[]) +{ + struct video_image *image; + int count, i; + + image = ll_entry_start(struct video_image, video_image); + count = ll_entry_count(struct video_image, video_image); + + printf("%-20s %10s\n", "Name", "Size"); + printf("%-20s %10s\n", "--------------------", "----------"); + + for (i = 0; i < count; i++, image++) { + ulong size = (ulong)image->end - (ulong)image->begin; + + printf("%-20s %10lu\n", image->name, size); + } + + printf("\nTotal images: %d\n", count); + + return 0; +} + U_BOOT_CMD( setcurs, 3, 1, do_video_setcursor, "set cursor position within screen", @@ -116,9 +140,11 @@ U_BOOT_LONGHELP(video, "setcursor - Set cursor position\n" "video puts - Write string at current position\n" "video write [-p] [: ]... - Write strings at specified positions\n" - " -p: Use pixel coordinates instead of character positions"); + " -p: Use pixel coordinates instead of character positions\n" + "video images - List images compiled into U-Boot"); U_BOOT_CMD_WITH_SUBCMDS(video, "Video commands", video_help_text, U_BOOT_SUBCMD_MKENT(setcursor, 3, 1, do_video_setcursor), U_BOOT_SUBCMD_MKENT(puts, 2, 1, do_video_puts), - U_BOOT_SUBCMD_MKENT(write, CONFIG_SYS_MAXARGS, 1, do_video_write)); + U_BOOT_SUBCMD_MKENT(write, CONFIG_SYS_MAXARGS, 1, do_video_write), + U_BOOT_SUBCMD_MKENT(images, 1, 1, do_video_images)); diff --git a/doc/usage/cmd/video.rst b/doc/usage/cmd/video.rst index 288260bd979..81433e486ac 100644 --- a/doc/usage/cmd/video.rst +++ b/doc/usage/cmd/video.rst @@ -13,7 +13,8 @@ Synopsis video setcursor video puts - video write [: ]... + video write [-p] [: ]... + video images Description ----------- @@ -66,6 +67,15 @@ locations in a single command. string Text string to display at the specified position +video images +~~~~~~~~~~~~ + + video images + +List all images that are compiled into U-Boot. This shows the name and size +of each image that was built from .bmp files in the drivers/video/images +directory. + Examples -------- @@ -90,6 +100,15 @@ Write text using pixel coordinates:: => video write -p 0:0 "Top left corner" a0:80 "Pixel position" +List compiled-in images:: + + => video images + Name Size + -------------------- ---------- + u_boot 6932 + + Total images: 1 + Configuration ------------- diff --git a/test/dm/video.c b/test/dm/video.c index 598e71411f5..b1bf08a99f7 100644 --- a/test/dm/video.c +++ b/test/dm/video.c @@ -1114,3 +1114,19 @@ static int dm_test_video_cmd(struct unit_test_state *uts) return 0; } DM_TEST(dm_test_video_cmd, UTF_SCAN_PDATA | UTF_SCAN_FDT); + +/* video images command */ +static int dm_test_video_images(struct unit_test_state *uts) +{ + ut_assertok(run_command("video images", 0)); + ut_assert_nextline("Name Size"); + ut_assert_nextline("-------------------- ----------"); + ut_assert_nextline("bgrt 43926"); + ut_assert_nextline("u_boot 6932"); + ut_assert_skip_to_line(""); + ut_assert_nextline("Total images: 2"); + ut_assert_console_end(); + + return 0; +} +DM_TEST(dm_test_video_images, UTF_SCAN_PDATA | UTF_SCAN_FDT | UTF_CONSOLE);