From patchwork Fri Sep 19 20:14:08 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 343 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=1758312939; bh=Mjmd2MckedR54EDfa4gDGgvO6hVk8QrXpjeuoNcWP04=; 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=I2TPIRlct1UAC0M/yXYS2vPnmO7UXHms+gFHAUqhuJQlPa/hB9VkdEgPq0YuQWwnc XqxywfO6NBQ/hLr4FAWWl56p3smdye2fngJ7WN3R5GH6hyjkh6ELtmfPlARSqEJqWU 8394hs1o7PRDnHzX+om7azE4daTl2EaNmnLm/EqTtGDQxD7rQV6xB+b4oFsbpdMT5+ DlwWhC//F03F9MQkpLHZut127+HOx1LOWL2sVGd8v7OEUtEC6ww36qP3LpIobgmsJL pbAHCQpAGH6BLPXkOw8Jz+n4Ks32hh4KZGGOwjxgj4t0745/uKDP/oTHZJEVgLhBFe cZQBUZeet4eVA== Received: from localhost (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id EBCA267C5A for ; Fri, 19 Sep 2025 14:15: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 7BdXDGDOU-GN for ; Fri, 19 Sep 2025 14:15:39 -0600 (MDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1758312939; bh=Mjmd2MckedR54EDfa4gDGgvO6hVk8QrXpjeuoNcWP04=; 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=I2TPIRlct1UAC0M/yXYS2vPnmO7UXHms+gFHAUqhuJQlPa/hB9VkdEgPq0YuQWwnc XqxywfO6NBQ/hLr4FAWWl56p3smdye2fngJ7WN3R5GH6hyjkh6ELtmfPlARSqEJqWU 8394hs1o7PRDnHzX+om7azE4daTl2EaNmnLm/EqTtGDQxD7rQV6xB+b4oFsbpdMT5+ DlwWhC//F03F9MQkpLHZut127+HOx1LOWL2sVGd8v7OEUtEC6ww36qP3LpIobgmsJL pbAHCQpAGH6BLPXkOw8Jz+n4Ks32hh4KZGGOwjxgj4t0745/uKDP/oTHZJEVgLhBFe cZQBUZeet4eVA== Received: from mail.u-boot.org (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id DB35D67C0E for ; Fri, 19 Sep 2025 14:15:39 -0600 (MDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1758312937; bh=M78C+y+X5BDIjcRYxc30DGX77sj2QZ6fI95Qduqnq6E=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=HlooGGgI7nDuzvTkqo6qmYwBkY3mTpIs8s7HxyG6LzivYaep0ywuI/nWrMy9N7fAE z8FiQSD0uCBG4f8odYP/XJx+LNEakxaCsaccrBGtt0hUS949xW61f6UndbKWlqTPd8 mXGcBKy4Dr3tI0FiNN1mchdZRIFx5SPBxzQQ7OaHqTRih2hidLTXUVoIF0pjIKFcsD t84gyHFLQT+hnYeaENLgx3D+uNt4EFj1dOGaxWRsMugEvt32f/NBAZbXzH9/vNfJqM g6qyI/+4Xpi8Z2N93Fv1UrSFs9r5Oe7Wfw59LPm/w/Oex9VmzZcNp1+ObPts/caA1D yKuhc3XVt/vHA== Received: from localhost (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id D085F67C0E; Fri, 19 Sep 2025 14:15: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 TJq6zR-mFd0q; Fri, 19 Sep 2025 14:15:37 -0600 (MDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1758312933; bh=TB5WEeThHcXTdh28siWaIifEf8+fqGYddM3bu2JyGUQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=CvECa6EoqBpzcgdR+P1+fqWfmuOKpdd4GqSquwB9pY/SFP/k9k2ufrDTXpMaKzhjA +5GLC0jMV2fAF7UKNCrUhfoWCzZ25KQBb1h6iaPXyQ/qD87DKi2GfhvRS64zzObWzn vyRdyxhMAF2PCWt0bsZWJ0wg8GFpjcO1yRQNSPmJK6OpRLnsM2BepSGo43P/yNYHnH QFSXBPzcFQUS40iTe5c/t1P1rWFNcm/4AzTrUvF5y2h4zohouqWBKrUU78ILaW99gD 0rjDht0fYjPDMyu0/WcfotN/Cv/dxLSMyKNKijcFTh2nL/u3DkN2hWAq0uDduxsuJv C4Hksz8waRjOA== Received: from u-boot.org (unknown [73.34.74.121]) by mail.u-boot.org (Postfix) with ESMTPSA id A29E767A99; Fri, 19 Sep 2025 14:15:32 -0600 (MDT) From: Simon Glass To: U-Boot Concept Date: Fri, 19 Sep 2025 14:14:08 -0600 Message-ID: <20250919201507.4024144-2-sjg@u-boot.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20250919201507.4024144-1-sjg@u-boot.org> References: <20250919201507.4024144-1-sjg@u-boot.org> MIME-Version: 1.0 Message-ID-Hash: RWJKGLHUHNI4WQUJYQV4M7RWX5V6ZA7S X-Message-ID-Hash: RWJKGLHUHNI4WQUJYQV4M7RWX5V6ZA7S X-MailFrom: sjg@u-boot.org X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; loop; banned-address; emergency; member-moderation; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; digests; suspicious-header CC: Heinrich Schuchardt , Simon Glass X-Mailman-Version: 3.3.10 Precedence: list Subject: [Concept] [PATCH 01/42] Provide a README for Claude 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 the beginnings of a readme to help Claude do the right thing. Signed-off-by: Simon Glass --- .claude/.gitignore | 1 + .claude/README.md | 69 ++++++++++++++++++++++++++++++++++++++++++++++ .gitignore | 1 + 3 files changed, 71 insertions(+) create mode 100644 .claude/.gitignore create mode 100644 .claude/README.md diff --git a/.claude/.gitignore b/.claude/.gitignore new file mode 100644 index 00000000000..93c0f73fa41 --- /dev/null +++ b/.claude/.gitignore @@ -0,0 +1 @@ +settings.local.json diff --git a/.claude/README.md b/.claude/README.md new file mode 100644 index 00000000000..b84be8d2445 --- /dev/null +++ b/.claude/README.md @@ -0,0 +1,69 @@ +# U-Boot Build Instructions for Claude Code + +This file contains information about building U-Boot for use with Claude Code. + +## Building U-Boot + +### Using crosfw (Recommended) + +To build U-Boot for sandbox testing, use the `crosfw` command: + +```bash +# Build for sandbox +crosfw sandbox -L + +# The -L flag disables LTO (equivalent to NO_LTO=1) +# The build is silent unless there are warnings or errors +# The build is done in /tmp/b/, so /tmp/b/sandbox in this case +``` + +### Using make directly + +If you prefer to use make directly, please use O= to avoid adding build files to +the source tree: + +```bash +# Clean the build (recommended before first build) +make mrproper + +# Configure for sandbox +make sandbox_defconfig O=/tmp/ + +# Build +make -j$(nproc) O=/tmp/ +``` +## Testing + +There are aliases in ~/bin/git-alias which you can use. + +To run a sandbox test: + +```bash +rtv +# For example: rtv dm_test_video_box +# which translates to: /tmp/b/sandbox/u-boot -v -Tf -c "ut dm video_box" +# test output is silenced unless -v is given +``` + +To run using the Python suite: + +```bash +pyt +# alias for: test/py/test.py -B sandbox --build-dir /tmp/b/sandbox -k +``` + +## Notes + +- The `crosfw` tool is the preferred build method for this codebase +- Always run `make mrproper` if you encounter build issues +- The sandbox build creates a test environment for U-Boot that runs on the host system +- When using `git diff`, add `--no-ext-diff` to avoid external diff tools that may not work in this environment + +## Coding Conventions + +- For function parameters that return values (output parameters), add 'p' suffix to indicate pointer + - Example: `uint *sizep` instead of `uint *size` + - Example: `bool *visiblep` instead of `bool *visible` +- This follows U-Boot's established naming convention for output parameters +- Keep commit messages concise - focus on the key change and essential details only +- Code should be formatted to 80 columns and not have trailing spaces diff --git a/.gitignore b/.gitignore index e93c33da1bd..6b95c85b9b8 100644 --- a/.gitignore +++ b/.gitignore @@ -6,6 +6,7 @@ # Normal rules (sorted alphabetically) # .* +!.claude !.checkpatch.conf *.a *.asn1.[ch] From patchwork Fri Sep 19 20:14:09 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 344 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=1758312944; bh=IHz2vK9eh8EyeoekIXfyfwNebjS8jxKIOdpwxd6uOio=; 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=lOWjkRyiZaMTkF1wmLtqtjfLK4IHf1PpZgTFK3LLQfBhlo/v+lV9VcW6VR0132Plc Smi+Sx6BUwa3efFBEg21PVL5sjP0Y7oYj8cc81eEA5BbFNpAxBZFjeFh/hO8IiRJZf UgNuixXTs2Pq6EJx+qXjU3vH3+iq+XJTGMa9P6NhJ+rk8+K6/IxIz4DrCCdD9hLdfj fl393uY/fQd7B/WMYy0rASuKTtVW1QR19DxnDqKEdlqNZ3GQPx5o4Nh3rdBpVqQRR4 YuZ3E1/DVnW7oKJkz5arnoeVoqkZgs+8deDS5GOzFiXGiQGYad6mOwtA423dqFQo83 q4KCKGm+sy6Bg== Received: from localhost (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id 5312967BFC for ; Fri, 19 Sep 2025 14:15: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 CuWVLepcv9Wf for ; Fri, 19 Sep 2025 14:15:44 -0600 (MDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1758312944; bh=IHz2vK9eh8EyeoekIXfyfwNebjS8jxKIOdpwxd6uOio=; 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=lOWjkRyiZaMTkF1wmLtqtjfLK4IHf1PpZgTFK3LLQfBhlo/v+lV9VcW6VR0132Plc Smi+Sx6BUwa3efFBEg21PVL5sjP0Y7oYj8cc81eEA5BbFNpAxBZFjeFh/hO8IiRJZf UgNuixXTs2Pq6EJx+qXjU3vH3+iq+XJTGMa9P6NhJ+rk8+K6/IxIz4DrCCdD9hLdfj fl393uY/fQd7B/WMYy0rASuKTtVW1QR19DxnDqKEdlqNZ3GQPx5o4Nh3rdBpVqQRR4 YuZ3E1/DVnW7oKJkz5arnoeVoqkZgs+8deDS5GOzFiXGiQGYad6mOwtA423dqFQo83 q4KCKGm+sy6Bg== Received: from mail.u-boot.org (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id 3F85667C06 for ; Fri, 19 Sep 2025 14:15:44 -0600 (MDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1758312942; bh=q8QHb/FJlb55t7ZVQL1YXQJbWxJJqkDK7XYSc2OvWHA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=n52slgeXd1pYNkU/zOUWJAkDBR9Cwe6qJMhh7qM3s6mXlWiSEoGRtZQqe9SSZiR2g KhnjLwAxfonIU5uzNfD8foFzydJEhpwxnAtxrgA+AKno2rsoK9lOHdFMRytJhi88Za P8qTIbGffORTtBGugGnnUg2j5PekoG6o5TejNrkOmH2oq6M3sQQMBVbAh16OOHNHnl EQAC0iWY4f1NCa8yiLsy12ZOqQHxW7pex/GPOSe7fhpT5daqEz29YtP5bv5OxcxzuW rtDlLRgybMQMogUo9IUTMwAjrwOWpQ+ug2pqu4huIbvnt5cXRYzCUIgiUZQcwYyjGe c4gFwVWmajq5g== Received: from localhost (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id 441BB67BFC; Fri, 19 Sep 2025 14:15:42 -0600 (MDT) X-Virus-Scanned: Debian amavis at Received: from mail.u-boot.org ([127.0.0.1]) by localhost (mail.u-boot.org [127.0.0.1]) (amavis, port 10026) with ESMTP id eQE6hx86kMlW; Fri, 19 Sep 2025 14:15:42 -0600 (MDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1758312937; bh=XixsUCbldU8GBH0NdipIikK9IHUPxh94FZPNUKH7/rk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=uRCZSgSrwPTc2EKxwEYdmi3ClRLvseOQFqdks88FXdEHbaYp7hvRPC3MkziacBu9m /HzA3sijkpvd9PmWBynzZJbwWYDZTEMKUOsuPr8+b71iYZanuACHcjqi6FVYcEpC/v hnZ7/upd6kmg+pdhs6bfFXA6/bztxxahYY2r4cKNGIqM7gMbCuOBN2Yr/fZ7lxJEH4 Ml/WceJvrvvZ8U2DUJdiZHdada5Ytw5QKlSq8u+qEmcrv6/3Ua/7bDrRnE94JRelWB 7OHoS7WcLkj2QwvRE3stdlytTuV9BJwnTFEY+VUZLigf5QlOsuo7OElC7liAFDYtWT QaCXmYNElyrTw== Received: from u-boot.org (unknown [73.34.74.121]) by mail.u-boot.org (Postfix) with ESMTPSA id E563667B3B; Fri, 19 Sep 2025 14:15:36 -0600 (MDT) From: Simon Glass To: U-Boot Concept Date: Fri, 19 Sep 2025 14:14:09 -0600 Message-ID: <20250919201507.4024144-3-sjg@u-boot.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20250919201507.4024144-1-sjg@u-boot.org> References: <20250919201507.4024144-1-sjg@u-boot.org> MIME-Version: 1.0 Message-ID-Hash: UASD4SI3QAQ733DCTVV6T5CZHKVLFFDK X-Message-ID-Hash: UASD4SI3QAQ733DCTVV6T5CZHKVLFFDK X-MailFrom: sjg@u-boot.org X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; loop; banned-address; emergency; member-moderation; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; digests; suspicious-header CC: Heinrich Schuchardt , Simon Glass X-Mailman-Version: 3.3.10 Precedence: list Subject: [Concept] [PATCH 02/42] cyclic: Avoid showing messages when debugging List-Id: Discussion and patches related to U-Boot Concept Archived-At: List-Archive: List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: From: Simon Glass When using a debugger it is common to single step through functions. If one of those functions happens to be called from a cyclic function, then a warning messages is shown. When debugging the console itself, this can mess up the session. Add a Kconfig to control whether the message is shown. Disable it by default if CONFIG_CC_OPTIMIZE_FOR_DEBUG is enabled. Signed-off-by: Simon Glass --- common/Kconfig | 9 +++++++++ common/cyclic.c | 5 +++-- 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/common/Kconfig b/common/Kconfig index 55e9bcdfa2b..3bd11f44c51 100644 --- a/common/Kconfig +++ b/common/Kconfig @@ -666,6 +666,15 @@ config CYCLIC_MAX_CPU_TIME_US takes longer than this duration this function will get unregistered automatically. +config CYCLIC_WARN_LATE + bool "Warn if a cyclic function takes too long" + default y if !CC_OPTIMIZE_FOR_DEBUG + help + Show a warning on the console if a cyclic function goes over the + alotted maximum time. The message is of the form: + + cyclic_run() cyclic function took too long: x vs y max + endif # CYCLIC config EVENT diff --git a/common/cyclic.c b/common/cyclic.c index 196797fd61e..e5a2ad302af 100644 --- a/common/cyclic.c +++ b/common/cyclic.c @@ -71,8 +71,9 @@ static void cyclic_run(void) cyclic->cpu_time_us += cpu_time; /* Check if cpu-time exceeds max allowed time */ - if ((cpu_time > CONFIG_CYCLIC_MAX_CPU_TIME_US) && - (!cyclic->already_warned)) { + if (IS_ENABLED(CONFIG_CYCLIC_WARN_LATE) && + cpu_time > CONFIG_CYCLIC_MAX_CPU_TIME_US && + !cyclic->already_warned) { pr_err("cyclic function %s took too long: %lldus vs %dus max\n", cyclic->name, cpu_time, CONFIG_CYCLIC_MAX_CPU_TIME_US); From patchwork Fri Sep 19 20:14:10 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 345 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=1758312946; bh=X7fPB9lBnWNySqRZkZAppJDDjTNmrlLmFnw5PrrJM6M=; 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=S7+WmAJ8/hYcjRv2YK2y/4n7ZHeozr8woAPxpY5sFhnZ/6BZCyuMRDdIslq3/TTZY 7yIKI1Dm9++dOrE5SL5pUKWihEpGP00LqgGW1BMaYuwHKdznLP/xkfHZb8Y8Uhfy95 dD2/kGU929WvnHvgyrX1B31gCkFZINpFLAyjhxr7yHDQG5dyj6OL3Kd4WRnDyUgEgQ TSCZQDV54w/0m2s9unWt8h2tJrBR+jbxm/3QMxtJfKTPVp2A+Eux20o6ihSSIuETuU /IfnK4c5WxNOmg8+Tj5RGP8GMHteamgVvE0bknu0/Xgc/qnX8aaD3Jpbsschnu2skJ YaORnl45e9+xA== Received: from localhost (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id A5F8267BFC for ; Fri, 19 Sep 2025 14:15: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 4YY8M1fa7n4L for ; Fri, 19 Sep 2025 14:15:46 -0600 (MDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1758312944; bh=X7fPB9lBnWNySqRZkZAppJDDjTNmrlLmFnw5PrrJM6M=; 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=IeJHkgl3nKNw6PJWN/CMO/zDcfLzScCwfTioCRc7oXAi0u7c5iPM14FWp1UQwcUu7 8UBJ2GvEpiEw1QQ2meoFXkooXthZe5rgU6g0UZRc/E+Ne+jrnhg4KIpaI27xxzDpQ9 zKQVfXe/P5HI5TTLVFCk655kv5AqjHnAS4kpN9o2GjPmuwkTe08G5vA+1srzge/EzJ 0AmN3sxXFlpbj2dolkzMcykYONvfE25EQnYWFxRCpE6zMniMqMopHqlv0jtS9bAKCH IerDSaibUjBPPpcAOPyQtmmyGWMkNez0hODTTLs4Eo4bCxaClYZDN7MH+iPABsPWoj /SnNOFdtmdBAg== Received: from mail.u-boot.org (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id 9CC8967C5B for ; Fri, 19 Sep 2025 14:15:44 -0600 (MDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1758312943; bh=qQp79LUfgM4XJVt895VKN2t4hsAsPc+4uscFCT36/Gw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=hIt1N31wleb3hfcuIAWK6FWCexH/e2u55GXZFyF8oCk81jclHa57Xb+W8CvCqt+OI K3ivNaZ/PfH17As6g0ikYf/3MBHlaMMtZNNzee7wpaVcPVH6KmNJU4N/T09a+dBI0t PbCUOJ02ktEoKqdk/wsq1SDRRHtcIxm1ksk9ihLHo7Mmu1A+t9HNxPEnH34L0FExCV V4cK2ffNv9KFKbo8xVa1lrgcn6UrIrWG5zDnGfdW+CWTbHWL+Gnhcw0IhtnWIepI29 +nPsSG/fcMEpAc7QNw36ypI2qD5mGh4PU1YQ8q5m35HSWFXpwgA3wWluohv6beZNnL uLJ1gaNlyLqgA== Received: from localhost (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id 46D6A67B3B; Fri, 19 Sep 2025 14:15: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 atcEqDziqrgp; Fri, 19 Sep 2025 14:15:43 -0600 (MDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1758312941; bh=GNvKcGBmi8fvuLX5UD5m2T1buTPMYf54JNxBpOPxLWA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=uq+7ch689uEJZUPKphjrtwoXXPZC51yqlPiYK6kjolzcixFWxOvFp3y2t20uZaa1w J303u8xVlNqv2eHGiVNIwMOaAyRW9ZwuNn0LREca/UC8B+wY3HGZqmDz5274fvJ+FN io5rUOsyQDJYHUQ4SlfJWFdrsiXxSVYvF3h5Y+r0tUbdqcPnvnC7m1rrtRkJPoYrLS y0Z0gEOpcd9+fGGQd9e0d8eEbjkwRCu0X7/N8PpFKijgwv8E90SC6RgG3GctLowaQY K0v5K2yxrCaKyXyaioiyAvtc6ODabP25DPXpOku6ScdTk+TjyeEHT+qrJLpDiccNsk kU+jE+IFijnNg== Received: from u-boot.org (unknown [73.34.74.121]) by mail.u-boot.org (Postfix) with ESMTPSA id 8AA8467A99; Fri, 19 Sep 2025 14:15:41 -0600 (MDT) From: Simon Glass To: U-Boot Concept Date: Fri, 19 Sep 2025 14:14:10 -0600 Message-ID: <20250919201507.4024144-4-sjg@u-boot.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20250919201507.4024144-1-sjg@u-boot.org> References: <20250919201507.4024144-1-sjg@u-boot.org> MIME-Version: 1.0 Message-ID-Hash: 2WFLZYEG4LZHXPTOO7IYOITDS4HARDKA X-Message-ID-Hash: 2WFLZYEG4LZHXPTOO7IYOITDS4HARDKA 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 03/42] video: Correct ops check for nominal, entry save/restore 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 All of these helper functions check the wrong member. Fix them. Signed-off-by: Simon Glass Fixes: 9e55d09596a ("video: Allow obtaining the nominal size of a...") Fixes: 9899eef2cb4 ("video: Allow saving and restoring text-entry...") --- drivers/video/vidconsole-uclass.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/video/vidconsole-uclass.c b/drivers/video/vidconsole-uclass.c index a98344cf9a7..6c5338936e5 100644 --- a/drivers/video/vidconsole-uclass.c +++ b/drivers/video/vidconsole-uclass.c @@ -655,7 +655,7 @@ int vidconsole_nominal(struct udevice *dev, const char *name, uint size, struct vidconsole_ops *ops = vidconsole_get_ops(dev); int ret; - if (ops->measure) { + if (ops->nominal) { ret = ops->nominal(dev, name, size, num_chars, bbox); if (ret != -ENOSYS) return ret; @@ -675,7 +675,7 @@ int vidconsole_entry_save(struct udevice *dev, struct abuf *buf) struct vidconsole_ops *ops = vidconsole_get_ops(dev); int ret; - if (ops->measure) { + if (ops->entry_save) { ret = ops->entry_save(dev, buf); if (ret != -ENOSYS) return ret; @@ -692,7 +692,7 @@ int vidconsole_entry_restore(struct udevice *dev, struct abuf *buf) struct vidconsole_ops *ops = vidconsole_get_ops(dev); int ret; - if (ops->measure) { + if (ops->entry_restore) { ret = ops->entry_restore(dev, buf); if (ret != -ENOSYS) return ret; From patchwork Fri Sep 19 20:14:11 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 346 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=1758312950; bh=m+TvEdLN3jsYEpPj8h6t6EdVdqjSSfjdzCramcmTP1Q=; 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=Ucaa0lgx/sNEx75fFlNFU1WGNYcvZDK+Z//TO393xd5SOln/oDQXUrMQ8RusRFOyM BhWHknwXKyqeLyKP11NqBSqvG7Rw6aTUMvda4+pKQjhnlEODp8jZ1bAyZOc0YLIHJp hYTo0ToaRkgQmQ3hWKSTBHshRR3TGi1gmq67Va8F77tQ8noBuNsrvuLAoE+vCUz6gg WWupkFTPCoTIgxX7y6Fr833U5Z8ic+3rve/ppX4EzBvVV6aVfDMJaR3ZmobrogbRZa K1URzaRHYG2x6aIVR8QWpNChUqOkvkGdspjn0px3wUrhibNf4XoqvENEqilWTdtEwr XNr3TcgDA3l5A== Received: from localhost (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id 0F0DD67C5B for ; Fri, 19 Sep 2025 14:15: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 C4SaTBvUIx8V for ; Fri, 19 Sep 2025 14:15:50 -0600 (MDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1758312949; bh=m+TvEdLN3jsYEpPj8h6t6EdVdqjSSfjdzCramcmTP1Q=; 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=taDxhh5GWgbvaLQzM0ssrQwvRhWF8gI6wkd4tZ5w36eMp9mLv48TG+wfAYX/KLrff YgqRZ2yPPExbHk5aVhuoYF8EFQjJ5F8gx3+6aGicRLKHw5Bxip7Y7d3nDx8AqrTXM2 aPal56FuwhAwXza/LBlZD55Urm5Y75IyIW+bB5LxYPHkEchG0K/cdx2awxFmuxpUhm +QaN0pcCV0Odpo3PoxZCVZmndx4DLU0jns9KMXjtu6iMAcDKw74Ee6iNsAPOGxFNz6 zyxxzqWsQ9WsOCJVIwFbG1/6hLmt0gUYMNt3/gJRPK5ZrOExN2Kr3z70H6F90TP3CS bUktAfI2waMGg== Received: from mail.u-boot.org (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id F2FB667B3B for ; Fri, 19 Sep 2025 14:15:49 -0600 (MDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1758312948; bh=IS/b1Ko6RgcaOzrC4lEzvz68H4VwJOuGfuCnsxX6G3c=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=X1CET4moMGJ+B6vzwYSaYkEwnbWIBPux7EH2h2121txFGY8S8HnhGUlXGPfvh7n8u 6dyCyMly7Xbu7+c9k9o1os/VXKrPLW+P/ZJaueVDv7aMawWQo1vAQz3stRic2Z8Dqo l12Jjf50Y1xYC4gHioG5H/7eFN88YUI9gGuk7lQQl9V/OhzFJVYuGSy+1mAoKqypxx miFr6vXy/9BOO55cV79xwfVWtcPhwxRv/SVb+rv3NgsBqgj+vgSYsuL390Q0txmsXV FijVFhbbBddxQxYmBPHzvuWd/ZFVSO0FtbF2j2KPq6gHqmfUAPZpkHjK9bK0rjZS2f bsVIN5+ErsPXQ== Received: from localhost (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id DA4A667BFC; Fri, 19 Sep 2025 14:15:48 -0600 (MDT) X-Virus-Scanned: Debian amavis at Received: from mail.u-boot.org ([127.0.0.1]) by localhost (mail.u-boot.org [127.0.0.1]) (amavis, port 10026) with ESMTP id TWupUhFXs_Ks; Fri, 19 Sep 2025 14:15:48 -0600 (MDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1758312943; bh=ByRuIKzcfz3ZqqVCldw9VlNf3NZiRogiopDBI3w0Fjk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=rRVGFmor6wCmDLZoxUR7UhMrfFJ5WrcZYmXj86//xk2cVwPPpxkM4o4pXeWf9t/Lh 2DKunytLD1WqSEZU3trT79X8Sc68nghk/ERySzd4Z5rTfEdIZX1ycbkRA1S5lGlOvq T9odDQYoH6GuxmOKLBu2j0nM01svoHvM0pfmgQTdzjf50LO7ywLhXKf+juzCYNhurc 8ekfKMAYI7Xk7jap1fHnY1dVBPipzj2GqPBJuinia5CbwYiKbMHFVfxvYRXBCauADn +K0JCRyQdGPkEbVdf4fosBKcrbq9n/Mj2U4z3d/Vg/UPqf0i+MXhLs+GiTiIYGgoL/ WVyOsJrF5iWNg== Received: from u-boot.org (unknown [73.34.74.121]) by mail.u-boot.org (Postfix) with ESMTPSA id 8F5D967A99; Fri, 19 Sep 2025 14:15:43 -0600 (MDT) From: Simon Glass To: U-Boot Concept Date: Fri, 19 Sep 2025 14:14:11 -0600 Message-ID: <20250919201507.4024144-5-sjg@u-boot.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20250919201507.4024144-1-sjg@u-boot.org> References: <20250919201507.4024144-1-sjg@u-boot.org> MIME-Version: 1.0 Message-ID-Hash: HNATLF3LV2WJ4BDHSHSSMOEHRSKYHZ3A X-Message-ID-Hash: HNATLF3LV2WJ4BDHSHSSMOEHRSKYHZ3A 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 04/42] Makefile: Silence the example Rust build 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 We don't need messages printed when building. Remove them. Signed-off-by: Simon Glass --- examples/rust/Makefile | 3 --- 1 file changed, 3 deletions(-) diff --git a/examples/rust/Makefile b/examples/rust/Makefile index d9fcedea60d..d372907d585 100644 --- a/examples/rust/Makefile +++ b/examples/rust/Makefile @@ -41,8 +41,6 @@ $(OUTDIR): # Build dynamic version (links with libu-boot.so) $(OUTDIR)/demo: $(RUST_SOURCES) $(UBOOT_BUILD)/libu-boot.so | $(OUTDIR) - @echo "Building Rust demo (dynamic) with library from $(UBOOT_BUILD)" - @echo "OUTDIR=$(OUTDIR), abspath=$(OUTDIR_ABS)" @if [ ! -f "$(UBOOT_BUILD)/libu-boot.so" ]; then \ echo "No shared library at $(UBOOT_BUILD)/libu-boot.so" >&2; \ echo "Please build U-Boot: make sandbox_defconfig && make" >&2; \ @@ -54,7 +52,6 @@ $(OUTDIR)/demo: $(RUST_SOURCES) $(UBOOT_BUILD)/libu-boot.so | $(OUTDIR) # Build static version (links with libu-boot.a) $(OUTDIR)/demo_static: $(RUST_SOURCES) $(UBOOT_BUILD)/libu-boot.a | $(OUTDIR) - @echo "Building Rust demo (static) with library from $(UBOOT_BUILD)" @if [ ! -f "$(UBOOT_BUILD)/libu-boot.a" ]; then \ echo "No static library at $(UBOOT_BUILD)/libu-boot.a" >&2; \ echo "Please build U-Boot: make sandbox_defconfig && make" >&2; \ From patchwork Fri Sep 19 20:14:12 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 347 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=1758312952; bh=x+nBMuPssTVeqsvxJqCu+nSD5QHaok/5cJ8zSFycD3k=; 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=rzGX6KOTCYzp7si3iqnO9hbS9z57ehOdHfmkzI1EMqTk8McSeiMeSkAvwDgpr3iAK OCC7tm84ciojoXLyNRxCGoWTg46lwxH12oFsC25s1fnnT8tlbS50UPELtiSr6mDIRG kKUxvXe9sKTXG8S6vHJOgRERwT2iFA8tH0tgT/mD3g3fLfRoEgd6CnM8kUQFnlk5OW qX5+gGyHaqVFXbr5vhVG35v6REyuiz5EPJPx9o7RThCuTBNfW2L9FGWeSotFntLkNc gD9/gx51J/YdaaYjdxUw5cq14m3VhXCiVF0POH4gBvWVeKqHK5lzFA+a9K5PRLDTn3 58Y+maEgUByiA== Received: from localhost (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id 6AB4067A99 for ; Fri, 19 Sep 2025 14:15:52 -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 tbCTsMEGVpPm for ; Fri, 19 Sep 2025 14:15:52 -0600 (MDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1758312951; bh=x+nBMuPssTVeqsvxJqCu+nSD5QHaok/5cJ8zSFycD3k=; 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=oMzCetgckxyptsTTQ3/AkEXRzzTVTVsjhJAKRlnIKgMRbiYtSC7bm9wiZCY6umJsC LupR3yraDLMZ+rKZy/jyHwR0FIZu7eQavlF2b27uEr5lUo7rUYH9Ff4jZsptPmFQ/e jEfl2skB/6aOIk59CA0XdKEhyCb5rzeg4Shn1jk/DgCWO+ZjJ7oQkkAn24TPXJkJ4r ijlgvJkwKURkqA8+Gck4JbXl0/GeV9cpfmxBvhz4mTrKuXrJsvXKVDa2BYX7TDonJY BUGunkazUTCgrClCqgoMWu7m0TJ8KBzPj4MXO05wrHYgE7o3v/gsV/5/gATowIgFvz 5mYwcnOlAnIWw== Received: from mail.u-boot.org (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id 53D2D67B3B for ; Fri, 19 Sep 2025 14:15:51 -0600 (MDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1758312949; bh=M+p3CTjZrbNsaI1jMq+F1HwgLzdvlIY6qd/blgwjKQQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=EF9ixdQOPoVShuvY737kyNMpJS7NKPQQS8uEVl02tYOiCidJ9qhGUvTw6ie3NmMP8 OreQW+znPpxpwCJCX9I1AY/HJ/Dw9Pajs/tuI1HZV6CQq5wkgOl21JzLzI2IPpIkGM /BJgxJG6BOKj4gsPBVLEN9wjmg3WahciHYyca4hEx69M1svdFRTKR70QNHd3RgsnZi WCSN083QH95Wjn+2gfvHtnW4FeV5ecm8oy2/JnG2WfRKots1VG+uWe/4n/Rowa55Ku srBVLK7/sLEkb/F1qYAiqsd7FCaqhmZn/tDwlzP+wTtblTPiRsGPnkGSF6DlX1NUb5 yAcVzeyDZ/HYg== Received: from localhost (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id EE74B67C06; Fri, 19 Sep 2025 14:15: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 DxCEPdarZbz9; Fri, 19 Sep 2025 14:15:49 -0600 (MDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1758312949; bh=XlCbBdlqH0Wk2ceBgI/GGl+uJto/58mYWMXumSbX+ko=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=JAjrO3Wq2Tym/zki8fVByWa/TNK+sdWg4VE2woKnJh/3HJQyA+zqj/yv18llZjcbU Uio6wNlpDOWCeGTB9gkQGt/gezlpKN1BWgnNPWHp0ussmYRn8OGkOJYnL6MKAx4mZx Xl6tXJ9RoknDjx3dqz3lPTSYFtWmcPcXNs2pJF4kgGfATbBRSMk4J8uR7koDRulALp zsxnfnj/exvkBw11Kwow0XzAoytqSHiGEd8rq5Uq53i4bBoviqazixXGp90kx+/ePN Mbr8zynEcfSCGpxDbvGk1bFq8pXwqGFoWAF+8t5uzsnBbDfFGE2RHDqFrUVSGB67bl +Y6SD8o5cOLgw== Received: from u-boot.org (unknown [73.34.74.121]) by mail.u-boot.org (Postfix) with ESMTPSA id BAF7567B3B; Fri, 19 Sep 2025 14:15:48 -0600 (MDT) From: Simon Glass To: U-Boot Concept Date: Fri, 19 Sep 2025 14:14:12 -0600 Message-ID: <20250919201507.4024144-6-sjg@u-boot.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20250919201507.4024144-1-sjg@u-boot.org> References: <20250919201507.4024144-1-sjg@u-boot.org> MIME-Version: 1.0 Message-ID-Hash: E7DJZD7EEJG7D34XJPTKVIL5EK2WTPLL X-Message-ID-Hash: E7DJZD7EEJG7D34XJPTKVIL5EK2WTPLL X-MailFrom: sjg@u-boot.org X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; loop; banned-address; emergency; member-moderation; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; digests; suspicious-header CC: Heinrich Schuchardt , Simon Glass , Claude X-Mailman-Version: 3.3.10 Precedence: list Subject: [Concept] [PATCH 05/42] scripts: Fix conditional syntax for capsule ESL generation List-Id: Discussion and patches related to U-Boot Concept Archived-At: List-Archive: List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: From: Simon Glass The ifeq/else/endif conditional for capsule_esl_file generation was incorrectly placed inside the recipe, causing malformed Makefile syntax that prevented proper dependency resolution. This resulted in build failures when CONFIG_EFI_CAPSULE_AUTHENTICATE was enabled because the capsule_esl_file target could not be created from the certificate file. Move the conditional to properly wrap the rule definitions, allowing Make to correctly parse and execute the capsule ESL generation rules. Signed-off-by: Simon Glass Co-developed-by: Claude --- scripts/Makefile.lib | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/scripts/Makefile.lib b/scripts/Makefile.lib index 8300c8104ce..5abe428e752 100644 --- a/scripts/Makefile.lib +++ b/scripts/Makefile.lib @@ -409,17 +409,18 @@ capsule_esl_dtsi=.capsule_esl.dtsi quiet_cmd_capsule_esl_gen = ESL $@ cmd_capsule_esl_gen = cert-to-efi-sig-list $< $@ -$(obj)/capsule_esl_file: $(capsule_crt_file) +$(obj)/capsule_esl_file: $(srctree)/$(capsule_crt_file) ifeq ($(CONFIG_EFI_CAPSULE_CRT_FILE),"") $(error "CONFIG_EFI_CAPSULE_CRT_FILE is empty, EFI capsule authentication \ public key must be specified when CONFIG_EFI_CAPSULE_AUTHENTICATE is enabled") else + $(Q)echo "Building capsule_esl_file: $@ from $<" $(call cmd,capsule_esl_gen) endif quiet_cmd_capsule_dtsi_gen = CAPSULE $@ cmd_capsule_dtsi_gen = \ - $(shell sed "s:ESL_BIN_FILE:$(abspath $<):" $(capsule_esl_input_file) > $@) + sed "s:ESL_BIN_FILE:capsule_esl_file:" $(capsule_esl_input_file) > $@ $(obj)/$(capsule_esl_dtsi): $(obj)/capsule_esl_file $(capsule_esl_input_file) $(call cmd,capsule_dtsi_gen) From patchwork Fri Sep 19 20:14:13 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 348 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=1758312954; bh=qjpkIsM7cwzRDSQemDalt8cImFeQDSPHx8b42YPDZiw=; 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=sRE+rNt9Ajfekqo+liDVexbsUNEmqKO1KLPrqyd6yck6suIUcA3/lxuuZimZocidQ uvgIFrvi1IVzAd1Hx1I4PWcdyEEy7WIaTCvDhxi+a3ekHY7nJkjJ7k0RemxHW+IKO0 l1tHc0Plbmtpg7ZDVqP1CZ18tyTlwhspcxtnORpvt2lSGeOKoZwjXzigWAFYCpBiwZ ZJG9BABSoEm+RMIEIEckpMPFet6P2kcYOuIUXtgwSTQqriGDaPLULFtyVVqLOFXC/B ENYe8+3fGxYSwuiU7Yhh39CQrYcLQ8qJl3KjFZ6QmcEsKng519inROD/4TvzNrCw7X dH8NzhJEn7Kmw== Received: from localhost (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id A18BC67C6D for ; Fri, 19 Sep 2025 14:15:54 -0600 (MDT) X-Virus-Scanned: Debian amavis at Received: from mail.u-boot.org ([127.0.0.1]) by localhost (mail.u-boot.org [127.0.0.1]) (amavis, port 10024) with ESMTP id UJBpa29gTiv0 for ; Fri, 19 Sep 2025 14:15:54 -0600 (MDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1758312954; bh=qjpkIsM7cwzRDSQemDalt8cImFeQDSPHx8b42YPDZiw=; 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=sRE+rNt9Ajfekqo+liDVexbsUNEmqKO1KLPrqyd6yck6suIUcA3/lxuuZimZocidQ uvgIFrvi1IVzAd1Hx1I4PWcdyEEy7WIaTCvDhxi+a3ekHY7nJkjJ7k0RemxHW+IKO0 l1tHc0Plbmtpg7ZDVqP1CZ18tyTlwhspcxtnORpvt2lSGeOKoZwjXzigWAFYCpBiwZ ZJG9BABSoEm+RMIEIEckpMPFet6P2kcYOuIUXtgwSTQqriGDaPLULFtyVVqLOFXC/B ENYe8+3fGxYSwuiU7Yhh39CQrYcLQ8qJl3KjFZ6QmcEsKng519inROD/4TvzNrCw7X dH8NzhJEn7Kmw== Received: from mail.u-boot.org (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id 0C96C67C58 for ; Fri, 19 Sep 2025 14:15:54 -0600 (MDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1758312952; bh=LutC6i8f4Pv+i4s0MMl/pAimaQo4P0+6cc+ZDMaIZ1A=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=jByJrj/QNuDKXz37fcTnNFrZrv3QHL3nMzRMbTQ0JrkilWU4vbZSMer3r+hV2dByg z9J6aq5oGllaEykoPwKVGJ5nwcnJTq8h+hXQPw4j6q6eZk9WUZ26WADe/dJER/cTKR uojki1MJzZC3UPyP1kHtFWqZhZePjmsXxQZ7W3b+IM+9dfPE5vjLk1GWtPJ14hDX6X +Bw5lYJzIcVNbI8bMAy8hyj45dXuQv64meS2Dgvto2MyNbDfGS0EEsq8YHWrLQVi0A 7Z6HKTC/9UbAaOHHZJZIKpO35b/Gu1ViR5K/8UAHnyWEKt7lnLdo7w2PC3TOKAfAXP kGaGi86Lgt77A== Received: from localhost (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id 58AD367C6D; Fri, 19 Sep 2025 14:15:52 -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 xma0omgyWbhJ; Fri, 19 Sep 2025 14:15:52 -0600 (MDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1758312950; bh=g691agaAVXYD9pERJ9oFxSlRzQrj7huTlCXT1ApI6k4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=SLOCmNT0C/vCKi4l4k9k5D27ECoL0Fz7r8eTuQVRiBgX2evYQPxUgyTeJHZNRHGUZ 70tCxEXp04YkZ2kar25AgWAGpwaYKLJ+y6gnX4rxY0bidLVOPkulHkYz0a03LhGmq3 r3VHqqWWhh3nkgN7s4t4EOdP8yHlNaIdBWEHUmuXzMIoWdcGCpkn3F7PCphbx0v/VQ tdDbM5igJGwyFecF5ifukKPNF+1+7OP3J1XtZJ/U08c4/ecDr5NL6WgTd8eUfBgFWM R4y8oimDBcpVydFr+lqOzmJPe17CxlgKaZDZRDsTcyAuibC2jKtz09xB8VcWlixozM i159dhJizjXgQ== Received: from u-boot.org (unknown [73.34.74.121]) by mail.u-boot.org (Postfix) with ESMTPSA id 4820D67C71; Fri, 19 Sep 2025 14:15:50 -0600 (MDT) From: Simon Glass To: U-Boot Concept Date: Fri, 19 Sep 2025 14:14:13 -0600 Message-ID: <20250919201507.4024144-7-sjg@u-boot.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20250919201507.4024144-1-sjg@u-boot.org> References: <20250919201507.4024144-1-sjg@u-boot.org> MIME-Version: 1.0 Message-ID-Hash: LXRDEJKIBHPIATZPVPEOXOFZ7IQQQ4WP X-Message-ID-Hash: LXRDEJKIBHPIATZPVPEOXOFZ7IQQQ4WP 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 06/42] test: video: Split long strings 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 strings in this file are quite long and it is a pain to look at them within an 80-column editor. Split them. Co-developed-by: Claude Signed-off-by: Simon Glass --- test/dm/video.c | 31 +++++++++++++++++++++++++------ 1 file changed, 25 insertions(+), 6 deletions(-) diff --git a/test/dm/video.c b/test/dm/video.c index 513134dd445..a48d0c0411c 100644 --- a/test/dm/video.c +++ b/test/dm/video.c @@ -229,7 +229,8 @@ DM_TEST(dm_test_video_text_12x22, UTF_SCAN_PDATA | UTF_SCAN_FDT); static int dm_test_video_chars(struct unit_test_state *uts) { struct udevice *dev, *con; - const char *test_string = "Well\b\b\b\bxhe is\r \n\ta very \amodest \bman\n\t\tand Has much to\b\bto be modest about."; + const char *test_string = "Well\b\b\b\bxhe is\r \n\ta very \amodest " + "\bman\n\t\tand Has much to\b\bto be modest about."; ut_assertok(select_vidconsole(uts, "vidconsole0")); ut_assertok(video_get_nologo(uts, &dev)); @@ -581,7 +582,13 @@ DM_TEST(dm_test_video_comp_bmp8, UTF_SCAN_PDATA | UTF_SCAN_FDT); static int dm_test_video_truetype(struct unit_test_state *uts) { struct udevice *dev, *con; - const char *test_string = "Criticism may not be agreeable, but it is necessary. It fulfils the same function as pain in the human body. It calls attention to an unhealthy state of things. Some see private enterprise as a predatory target to be shot, others as a cow to be milked, but few are those who see it as a sturdy horse pulling the wagon. The \aprice OF\b\bof greatness\n\tis responsibility.\n\nBye"; + const char *test_string = "Criticism may not be agreeable, but it " + "is necessary. It fulfils the same function as pain in the " + "human body. It calls attention to an unhealthy state of " + "things. Some see private enterprise as a predatory target to " + "be shot, others as a cow to be milked, but few are those who " + "see it as a sturdy horse pulling the wagon. The \aprice " + "OF\b\bof greatness\n\tis responsibility.\n\nBye"; ut_assertok(video_get_nologo(uts, &dev)); ut_assertok(uclass_get_device(UCLASS_VIDEO_CONSOLE, 0, &con)); @@ -599,7 +606,13 @@ static int dm_test_video_truetype_scroll(struct unit_test_state *uts) { struct sandbox_sdl_plat *plat; struct udevice *dev, *con; - const char *test_string = "Criticism may not be agreeable, but it is necessary. It fulfils the same function as pain in the human body. It calls attention to an unhealthy state of things. Some see private enterprise as a predatory target to be shot, others as a cow to be milked, but few are those who see it as a sturdy horse pulling the wagon. The \aprice OF\b\bof greatness\n\tis responsibility.\n\nBye"; + const char *test_string = "Criticism may not be agreeable, but it " + "is necessary. It fulfils the same function as pain in the " + "human body. It calls attention to an unhealthy state of " + "things. Some see private enterprise as a predatory target to " + "be shot, others as a cow to be milked, but few are those who " + "see it as a sturdy horse pulling the wagon. The \aprice " + "OF\b\bof greatness\n\tis responsibility.\n\nBye"; ut_assertok(uclass_find_device(UCLASS_VIDEO, 0, &dev)); ut_assert(!device_active(dev)); @@ -621,7 +634,11 @@ static int dm_test_video_truetype_bs(struct unit_test_state *uts) { struct sandbox_sdl_plat *plat; struct udevice *dev, *con; - const char *test_string = "...Criticism may or may\b\b\b\b\b\bnot be agreeable, but seldom it is necessary\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\bit is necessary. It fulfils the same function as pain in the human body. It calls attention to an unhealthy state of things."; + const char *test_string = "...Criticism may or may\b\b\b\b\b\bnot be " + "agreeable, but seldom it is necessary\b\b\b\b\b\b\b\b\b\b\b\b" + "\b\b\b\b\b\b\b\b\b\bit is necessary. It fulfils the same " + "function as pain in the human body. It calls attention to an " + "unhealthy state of things."; ut_assertok(uclass_find_device(UCLASS_VIDEO, 0, &dev)); ut_assert(!device_active(dev)); @@ -645,7 +662,8 @@ static int dm_test_video_copy(struct unit_test_state *uts) struct video_uc_plat *uc_plat; struct udevice *dev, *con; struct video_priv *priv; - const char *test_string = "\n\tCriticism may not be agreeable, but it is necessary.\t"; + const char *test_string = "\n\tCriticism may not be agreeable, but it " + "is necessary.\t"; ulong addr; if (!IS_ENABLED(CONFIG_VIDEO_COPY)) @@ -710,7 +728,8 @@ static int dm_test_video_damage(struct unit_test_state *uts) struct video_priv *priv; const char *test_string_1 = "Criticism may not be agreeable, "; const char *test_string_2 = "but it is necessary."; - const char *test_string_3 = "It fulfils the same function as pain in the human body."; + const char *test_string_3 = "It fulfils the same function as pain in " + "the human body."; if (!IS_ENABLED(CONFIG_VIDEO_DAMAGE)) return -EAGAIN; From patchwork Fri Sep 19 20:14:14 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 349 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=1758312958; bh=AjS4TYFsVNNUMdi973HwIZTycyslvm0njOHfPEAKnFI=; 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=Z9YYasesh6aNAcPshZZTahBW6AZAEi/tH9kBV3z30jRC2vakwPb83JHYZVOYx/8d2 CJSqeAlDdt2rFF83jPjVTUy6dha5oc2gZJstjVR7DsP23bUc7WgZbwwDlakRbcxQYE YbL63/RZX+T3FKkYaxMzt/X/RvORcfVaG/BVoxSo4iLIHNiPCI5ttWFuFfUtfAnxvs CWPzvmeS0YTa9t1TZjaH+TFhuSyT+KUqf5q0hnERvhROyacRi5UW6APJ52FNtGf9/V xDb+05qYjH0tw1QjcmvjrDk6yRIdSHoT/yaKYz2n5J3a7QJxhhkiw/F8H8lERUJeZV VPAh2lz1Rq3Zg== Received: from localhost (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id 7878667C6D for ; Fri, 19 Sep 2025 14:15:58 -0600 (MDT) X-Virus-Scanned: Debian amavis at Received: from mail.u-boot.org ([127.0.0.1]) by localhost (mail.u-boot.org [127.0.0.1]) (amavis, port 10024) with ESMTP id RnWYv_FtItlr for ; Fri, 19 Sep 2025 14:15:58 -0600 (MDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1758312958; bh=AjS4TYFsVNNUMdi973HwIZTycyslvm0njOHfPEAKnFI=; 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=Z9YYasesh6aNAcPshZZTahBW6AZAEi/tH9kBV3z30jRC2vakwPb83JHYZVOYx/8d2 CJSqeAlDdt2rFF83jPjVTUy6dha5oc2gZJstjVR7DsP23bUc7WgZbwwDlakRbcxQYE YbL63/RZX+T3FKkYaxMzt/X/RvORcfVaG/BVoxSo4iLIHNiPCI5ttWFuFfUtfAnxvs CWPzvmeS0YTa9t1TZjaH+TFhuSyT+KUqf5q0hnERvhROyacRi5UW6APJ52FNtGf9/V xDb+05qYjH0tw1QjcmvjrDk6yRIdSHoT/yaKYz2n5J3a7QJxhhkiw/F8H8lERUJeZV VPAh2lz1Rq3Zg== Received: from mail.u-boot.org (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id 68A7F67C5A for ; Fri, 19 Sep 2025 14:15:58 -0600 (MDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1758312956; bh=seUNZUNyDPWJiSOObOOxbMXbT8Gq8m+O61zIhjSpc3c=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=RiMXTY0N27ZkUP7gxF7yCQMApD8pD4ytoJlcvJuR1z72Qc+2I4hQus67cZpVu+g3M Yc45ZzLbMExYjJNbGuvw5OC82Qm9pjFA3TO5Q7hb6qe6SVQ+f0Nxbm3KQHQN5HpXMQ 4mm2DpmY4l4QJzbbXoXw+NwFLnhjtMvz5D4uvg+gkCOrFpFr3NWqudDiz5j2iuBPA8 7ZdeKqEudp689JYx8qIfaL7oBq4kNgs31fSpAS1tfrdrPQuJNi/j432NKBA7LZ752b SfHUK8GywTNT5pk9+OAoGKIYDeW4J3Hlu1EaDj/gXaax/9C3cnb7v1YqQME4z07XGc jTuL73GKvW2RA== Received: from localhost (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id D885667B3B; Fri, 19 Sep 2025 14:15:56 -0600 (MDT) X-Virus-Scanned: Debian amavis at Received: from mail.u-boot.org ([127.0.0.1]) by localhost (mail.u-boot.org [127.0.0.1]) (amavis, port 10026) with ESMTP id SSMvFb4IgZrR; Fri, 19 Sep 2025 14:15:56 -0600 (MDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1758312951; bh=hplBAEtkL+8dxMwLU394hemq4cncyv10Y25Pd4yfFv0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=HaY/bNMs3ssCN64OQboSLcjOZwVz9CBFdDigXe4HOtZCSBF3l11gaLRplmRIQT3ub suXgrpkZ/eLcPZvnZvPWoY352H2AuQITVY/HWodvvWbV4rTUiDhnHW/gMchFPnVGs3 0LqU0z7dlxb/3OMm6wJLyhUBgQdcmOI8MXxqFAnhaEJqXx1jkh00xWuMyF5G+wUOEJ 1fFkGlGW+Ui76BwtFFmmg8h/VAS8bzfu/ZDZoQPyfjQelPZ+vAuuypJEXGvDKO68Qw wVUA4JOuHZwcc7y67Zq1+PkhFvNN5QiDsbSCcC2mHggulDI8VHA10QQmHoYFbJGgHN /itfawFArZFZw== Received: from u-boot.org (unknown [73.34.74.121]) by mail.u-boot.org (Postfix) with ESMTPSA id 5B5A467BFC; Fri, 19 Sep 2025 14:15:51 -0600 (MDT) From: Simon Glass To: U-Boot Concept Date: Fri, 19 Sep 2025 14:14:14 -0600 Message-ID: <20250919201507.4024144-8-sjg@u-boot.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20250919201507.4024144-1-sjg@u-boot.org> References: <20250919201507.4024144-1-sjg@u-boot.org> MIME-Version: 1.0 Message-ID-Hash: IFHN6ONZBHVQAI6DLCUY6TKP4DPQQVXJ X-Message-ID-Hash: IFHN6ONZBHVQAI6DLCUY6TKP4DPQQVXJ 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 07/42] video: Provide an option to enable the cursor List-Id: Discussion and patches related to U-Boot Concept Archived-At: List-Archive: List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: From: Simon Glass The video cursor is always enabled at present, but it is only used for expo. Put it behind an option, to reduce code size for platforms which do use video but don't want a cursor. Move the existing set_cursor_visible() method behind this option, for the normal console. For the truetype console, the fonts and extra rendering dwarf the code-size saving, so include the cursor there always. Once the cursor is enabled for the CLI, this will produce code-size savings. Signed-off-by: Simon Glass --- drivers/video/Kconfig | 8 ++++++++ drivers/video/console_normal.c | 7 +++++-- drivers/video/vidconsole-uclass.c | 2 ++ include/video_console.h | 9 +++++++++ 4 files changed, 24 insertions(+), 2 deletions(-) diff --git a/drivers/video/Kconfig b/drivers/video/Kconfig index 6e1577ae687..446ce51fe27 100644 --- a/drivers/video/Kconfig +++ b/drivers/video/Kconfig @@ -68,6 +68,14 @@ config BACKLIGHT This provides backlight uclass driver that enables basic panel backlight support. +config CURSOR + bool "Show a cursor on the console" + default y + help + Show a cursor on the video console when entering commands. This is + a simple vertical bar drawn before the character at the current + position. The cursor makes it easy to see the current input position. + config VIDEO_PCI_DEFAULT_FB_SIZE hex "Default framebuffer size to use if no drivers request it" default 0x1000000 if X86 diff --git a/drivers/video/console_normal.c b/drivers/video/console_normal.c index 07db613ac53..a39b04bd73c 100644 --- a/drivers/video/console_normal.c +++ b/drivers/video/console_normal.c @@ -105,8 +105,9 @@ static int console_putc_xy(struct udevice *dev, uint x_frac, uint y, int cp) return VID_TO_POS(fontdata->width); } -static int console_set_cursor_visible(struct udevice *dev, bool visible, - uint x, uint y, uint index) +static int __maybe_unused console_set_cursor_visible(struct udevice *dev, + bool visible, uint x, + uint y, uint index) { struct vidconsole_priv *vc_priv = dev_get_uclass_priv(dev); struct udevice *vid = dev->parent; @@ -140,7 +141,9 @@ struct vidconsole_ops console_ops = { .get_font_size = console_simple_get_font_size, .get_font = console_simple_get_font, .select_font = console_simple_select_font, +#ifdef CONFIG_CURSOR .set_cursor_visible = console_set_cursor_visible, +#endif }; U_BOOT_DRIVER(vidconsole_normal) = { diff --git a/drivers/video/vidconsole-uclass.c b/drivers/video/vidconsole-uclass.c index 6c5338936e5..f53d55e81b7 100644 --- a/drivers/video/vidconsole-uclass.c +++ b/drivers/video/vidconsole-uclass.c @@ -701,6 +701,7 @@ int vidconsole_entry_restore(struct udevice *dev, struct abuf *buf) return 0; } +#ifdef CONFIG_CURSOR int vidconsole_set_cursor_visible(struct udevice *dev, bool visible, uint x, uint y, uint index) { @@ -715,6 +716,7 @@ int vidconsole_set_cursor_visible(struct udevice *dev, bool visible, return 0; } +#endif void vidconsole_push_colour(struct udevice *dev, enum colour_idx fg, enum colour_idx bg, struct vidconsole_colour *old) diff --git a/include/video_console.h b/include/video_console.h index 8f3f58f3aa9..d3c65a08331 100644 --- a/include/video_console.h +++ b/include/video_console.h @@ -404,6 +404,7 @@ int vidconsole_entry_save(struct udevice *dev, struct abuf *buf); */ int vidconsole_entry_restore(struct udevice *dev, struct abuf *buf); +#ifdef CONFIG_CURSOR /** * vidconsole_set_cursor_visible() - Show or hide the cursor * @@ -418,6 +419,14 @@ int vidconsole_entry_restore(struct udevice *dev, struct abuf *buf); */ int vidconsole_set_cursor_visible(struct udevice *dev, bool visible, uint x, uint y, uint index); +#else +static inline int vidconsole_set_cursor_visible(struct udevice *dev, + bool visible, uint x, uint y, + uint index) +{ + return 0; +} +#endif /* CONFIG_CURSOR */ /** * vidconsole_push_colour() - Temporarily change the font colour From patchwork Fri Sep 19 20:14:15 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 350 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=1758312960; bh=tSwWusP+8owLmpJqCnOMXGtpmpmXXp1XErb5OUrZAGQ=; 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=Rj8uXMlUNVDjPuA9xM3ujpyaGLQYJpPk9VtGEjWFGfYUJtyVha9rmMJsw542KuEWW dFPkuQ8Fq5zBr40ly8GGB46eGRUYj9SuHkq7eVq5lcVIjXzeET9DzbA28on0QRWWxh o06QLswhzMlKJJe4wHM+JmEA/AnEVzwVSgfqel65ikU0ONDbwkZqTokgmb0QoqLmWj 89XyRVw+wgqwZUNvKw6KC+mYk8DPSSO7/mA9Ut1ZdZr/TMbee3FXw+Wg+LicpPR915 6WC2kk5yWfe9UQSs31CDWFCEyu18QpQvcEl6bgnx8tVp5ncLzySYz1bdIEbJhzp5EE 6CWoXKVU2u0wg== Received: from localhost (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id DD92267A99 for ; Fri, 19 Sep 2025 14:16: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 1WDvfuqAJhFp for ; Fri, 19 Sep 2025 14:16:00 -0600 (MDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1758312959; bh=tSwWusP+8owLmpJqCnOMXGtpmpmXXp1XErb5OUrZAGQ=; 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=ISDZblCv2YwIJeLmzcGhBG9LY/6HY4ZbFzGncowXqM4v72TeT84LywETW8/P0LlM2 p0v8k3Nv2n+HFAADD/s+TvTNBztIRqW2CQNJQprGPFvFCR3FmiaVmEfJcJNvUstagL Ufxiqwhoo7Ugw5/UV3EC0Q1/m+H3kxhbOKLlbaWKZQ0Z6YtrG2kliQcNvULDMJ+fuj tvuB5rxTccPtWMKajYyzKCRsFGmdPC4BUD4JHgQRkPC5sZogffwd4pyJhb7fHiwc40 HVNXCEjakE+a9UPw/RYAAvHUWNZNr8MAIHC8WZS8FmozjRp6ReJBAXyyraxRfPTcf1 OXzhvIm0KKwSQ== Received: from mail.u-boot.org (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id BB13167C59 for ; Fri, 19 Sep 2025 14:15:59 -0600 (MDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1758312957; bh=ijzJTWhRD4aF7mAIGO107kndWoSsMbWU+CeBEI96hOc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=QCKqmhZ4rxIndboJuimWadQvChW26cQaeNSzggYUUONQh5229UChuydOpJbNy08Gl DbC5aco4/CrrqFI7Cl7k7CBZlj5k0SmCC2kIWkZKHBgGRGXcpq6sKcZYJFgoqI5EaL 5slZ/2V+VIrlH9r9Zd4U2j2Hf9Stqnra6R4457RrRkuVQsRJC3CIigljhZ7ZB346ZQ tnn3LykRnv5RTIQxqSaMsjf7Vn8cKICywptOJmiZvbCfWyoQewVq5Xx6akeJnLttfw 9uc5/PlBvop+P5/B3fYoN9qGBLEn6EbARj2wr1XPIGMnAZfzdvASvocGBBF+qT7aj6 oAgIN5Agu0iKw== Received: from localhost (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id C3BA867A99; Fri, 19 Sep 2025 14:15: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 DgRwY_FY9ghk; Fri, 19 Sep 2025 14:15:57 -0600 (MDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1758312956; bh=dF+m9w0ra+eRim/bh0GdkZnmSAj7JOmWMLAW4sf+RQA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=gtxEoKG8RsjQWkFukIPe4Nam1AXuJEqxszyIU1idMBX+4hyFkmizieQrOGh3wpLzN W33xxVkhilCs1res4A0+g6U2PU5PeGv68O4hQ/rH3mTrEPAZmnFUYDlZHFnUCgsBwb h7MwfpKs3ZYHPTHKF61sughIU58tjLOGDccu2RAi9Bp87C5LvhgCps9VHdDbTpSEIS yonLhCwDEk+hJovEOaTVwLPR9tgpSTGBjTv9ZcItlOHU4bpkJDRHbprak5BW3Ap+SU lwTn/McGDBOHitvekLya+DagdPHGycEmFx5XOh5scbyecRiA+PdpJ7bvshW8yV4i9u 5N8PvzsKPKX6g== Received: from u-boot.org (unknown [73.34.74.121]) by mail.u-boot.org (Postfix) with ESMTPSA id 0993667C0E; Fri, 19 Sep 2025 14:15:55 -0600 (MDT) From: Simon Glass To: U-Boot Concept Date: Fri, 19 Sep 2025 14:14:15 -0600 Message-ID: <20250919201507.4024144-9-sjg@u-boot.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20250919201507.4024144-1-sjg@u-boot.org> References: <20250919201507.4024144-1-sjg@u-boot.org> MIME-Version: 1.0 Message-ID-Hash: OHY7HW4BHTCKNLDABZ4SQTSMAXFHVIJW X-Message-ID-Hash: OHY7HW4BHTCKNLDABZ4SQTSMAXFHVIJW 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 08/42] snow: link: Disable the cursor 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 These boards enable EXPO. Disable the cursor so we can get build coverage on this combination. Signed-off-by: Simon Glass --- configs/chromebook_link_defconfig | 1 + configs/snow_defconfig | 1 + 2 files changed, 2 insertions(+) diff --git a/configs/chromebook_link_defconfig b/configs/chromebook_link_defconfig index 05d81f516fc..a0c368b0142 100644 --- a/configs/chromebook_link_defconfig +++ b/configs/chromebook_link_defconfig @@ -77,6 +77,7 @@ CONFIG_TPM_TIS_LPC=y # CONFIG_TPM_V2 is not set CONFIG_USB_STORAGE=y CONFIG_USB_KEYBOARD=y +# CONFIG_CURSOR is not set CONFIG_VIDEO_COPY=y CONFIG_FRAMEBUFFER_SET_VESA_MODE=y CONFIG_FRAMEBUFFER_VESA_MODE_11A=y diff --git a/configs/snow_defconfig b/configs/snow_defconfig index 27698f5ef36..32db5f192fe 100644 --- a/configs/snow_defconfig +++ b/configs/snow_defconfig @@ -97,6 +97,7 @@ CONFIG_USB_EHCI_HCD=y CONFIG_USB_HOST_ETHER=y CONFIG_USB_ETHER_ASIX88179=y CONFIG_VIDEO=y +# CONFIG_CURSOR is not set # CONFIG_VIDEO_BPP8 is not set CONFIG_VIDCONSOLE_AS_LCD=y CONFIG_DISPLAY=y From patchwork Fri Sep 19 20:14:16 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 351 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=1758312963; bh=Uw8zJaZ6p06sAipoBXxM/n8Y0lJIOGyW06cf3WGmqT0=; 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=v7F4GApW7g9hrOhs8j3oYXrxceamRMjDRBHVDTjwHafm8XBBUq9+vMAwyRxSlLJ+y xCnPhaYiWAhZhft2B286qkvlYFa8d7Cc/6DEzzswNpgC7e8U2GATdBJRgkG6OcGAba 0mA667B+OOccwQD1EOiF/71q0jX9TBb5kOqxXK4PvUKrsZXzvFGqlsV0CdEyhVIRxA 4yRYSHROiTX/FU5ZBVNgNt7Hx6rVexx0XJe9bRw6WCKwJcOpWPHCVMXs8A6Ozl7Vve kF91IX/T2Gqo/CWdY88GX6kfDFgSeFy9jMX2RAxz80h3cPlA+meWk+BdUMx2nnfSeD iX7rsfHtezgpQ== Received: from localhost (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id 3999B67C70 for ; Fri, 19 Sep 2025 14:16:03 -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 Xvqn556jCDPd for ; Fri, 19 Sep 2025 14:16:03 -0600 (MDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1758312962; bh=Uw8zJaZ6p06sAipoBXxM/n8Y0lJIOGyW06cf3WGmqT0=; 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=ahvSp8FAgi9X57PRHfdbBHP1wjWkfMyPUZI7uRbBu1m7d1rUKqRNGLrnaa09YZHFH 8jI28+u3jbqVZqMO6MRWzPSq9ffT6TG2x3e/+WIctMY35QCKMv5AgOrcjpsa4Wy7A9 U01P3wu58L8SvmSZPUcmI8dAFB3RTfk5+15PinASCus6E62V6efYVSzmRzHI/5NyNY ZZPNcQdx9TXspx35JIT7NrH/O4nF76UH/ckv9StT/obWKFZzxg/jTyuTL4hJB0Omkg m+Kpjh2c4wc+onDreSpOJPjwAtUy1zD0CEfqhiGBZMJ4BV0eW5NGWs7O8QV+9/roYN RdGcDdw8jh9Vg== Received: from mail.u-boot.org (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id 1BFDD67B3B for ; Fri, 19 Sep 2025 14:16:02 -0600 (MDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1758312960; bh=oEwIc+swvxhvUpNt0PS6sEekoIJ+L9yQEw0w7N9okvU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Chzj4aJa1nEO/tdbierL2J0S+8MlsjQwsvAn62tATLxIiZSDSiKMVVVdg/hTmdykQ 0rwn/crbW0WVzqX+/ejhosSOkbFb5ccG6KDtTdhcSqNUs48pNOqWUCCLO01A0Rlg2V SZqt5yHvQi724WQVsQfLK9BcFEHR4PfrmIKlde80kvvJGDrMCQDkJAy+Gn4d6EB8x5 5oU+g8A9gcuG3wLoezKmR8jSm7Rk4j37V9nPl8pkWZcgCOc3p74XTb6jE44jPqfjwP sxVq6Q/f92+GKKnnP48psRqNqKPd1TTp7DGqJNRoi6ZEtF0Y38zuZKnM6AqBu68p4T SVbexzfgn556w== Received: from localhost (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id C234C67C75; Fri, 19 Sep 2025 14:16: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 10026) with ESMTP id cnjGd6-tvc_2; Fri, 19 Sep 2025 14:16:00 -0600 (MDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1758312958; bh=lttb+dZCH2/largQQFAmMfR8OFYz0C8i55bRxUDdcik=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=hach2Zjwh8qET/D4375+JywasCGtmJZgKsniQ3OBafkljaoB5JRxOIq4J2nFukJw7 cEarbKOm3Ce7kMcpuhhJ/nc/oi1hTErwLauRiIn87jWUWQVO84a80bZPd20BAaJaNM xE6oAkK/6264N4QnRZIJtS9hRHzIcAK9eqoadA5ZSHvdzlSs+hvR1vSWQVENx6/Ed5 OI1D/Vr2zya95dp1W7J2iCqR0/1AkuRjxCRCqsJulirVP4rXHaoi/gGvRrL06cE1BL cp7qicNGknwrK6Rp6dIKo/RPnEEdW7ltbKzNWDhOeBZsTSbxDlp4BQ4McFL8PYp+vd oIA7DmIvABDrA== Received: from u-boot.org (unknown [73.34.74.121]) by mail.u-boot.org (Postfix) with ESMTPSA id 14E8B67C0E; Fri, 19 Sep 2025 14:15:58 -0600 (MDT) From: Simon Glass To: U-Boot Concept Date: Fri, 19 Sep 2025 14:14:16 -0600 Message-ID: <20250919201507.4024144-10-sjg@u-boot.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20250919201507.4024144-1-sjg@u-boot.org> References: <20250919201507.4024144-1-sjg@u-boot.org> MIME-Version: 1.0 Message-ID-Hash: O7FSTLDM7SXVQTIVHBWI5PVXIZCNO6OS X-Message-ID-Hash: O7FSTLDM7SXVQTIVHBWI5PVXIZCNO6OS X-MailFrom: sjg@u-boot.org X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; loop; banned-address; emergency; member-moderation; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; digests; suspicious-header CC: Heinrich Schuchardt , Simon Glass , Claude X-Mailman-Version: 3.3.10 Precedence: list Subject: [Concept] [PATCH 09/42] video: console: Put fixed-font rendering into a shared file 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 fixed-font, character-rendering from console_normal.c into a shared function in console_core.c. This will allow truetype to use the fixed fonts as well as its own. Co-developed-by: Claude --- drivers/video/console_core.c | 33 ++++++++++++++++++++++++ drivers/video/console_normal.c | 39 ++++++----------------------- drivers/video/vidconsole_internal.h | 24 ++++++++++++++++++ 3 files changed, 64 insertions(+), 32 deletions(-) diff --git a/drivers/video/console_core.c b/drivers/video/console_core.c index 939363653f6..4b75a5b6e12 100644 --- a/drivers/video/console_core.c +++ b/drivers/video/console_core.c @@ -228,6 +228,39 @@ int console_simple_get_font(struct udevice *dev, int seq, struct vidfont_info *i return info->name ? 0 : -ENOENT; } +int console_fixed_putc_xy(struct udevice *dev, uint x_frac, uint y, int cp, + struct video_fontdata *fontdata) +{ + struct vidconsole_priv *vc_priv = dev_get_uclass_priv(dev); + struct udevice *vid = dev->parent; + struct video_priv *vid_priv = dev_get_uclass_priv(vid); + int pbytes = VNBYTES(vid_priv->bpix); + int x, linenum, ret; + void *start, *line; + u8 ch = console_utf_to_cp437(cp); + uchar *pfont = fontdata->video_fontdata + + ch * fontdata->char_pixel_bytes; + + if (x_frac + VID_TO_POS(vc_priv->x_charsize) > vc_priv->xsize_frac) + return -EAGAIN; + linenum = y; + x = VID_TO_PIXEL(x_frac); + start = vid_priv->fb + linenum * vid_priv->line_length + x * pbytes; + line = start; + + ret = fill_char_vertically(pfont, &line, vid_priv, fontdata, NORMAL_DIRECTION); + if (ret) + return ret; + + video_damage(dev->parent, + x, + y, + fontdata->width, + fontdata->height); + + return VID_TO_POS(fontdata->width); +} + int console_simple_select_font(struct udevice *dev, const char *name, uint size) { struct video_fontdata *font; diff --git a/drivers/video/console_normal.c b/drivers/video/console_normal.c index a39b04bd73c..9509f81f40f 100644 --- a/drivers/video/console_normal.c +++ b/drivers/video/console_normal.c @@ -68,41 +68,11 @@ static int console_move_rows(struct udevice *dev, uint rowdst, return 0; } -static int console_putc_xy(struct udevice *dev, uint x_frac, uint y, int cp) +int console_normal_putc_xy(struct udevice *dev, uint x_frac, uint y, int cp) { - struct vidconsole_priv *vc_priv = dev_get_uclass_priv(dev); - struct udevice *vid = dev->parent; - struct video_priv *vid_priv = dev_get_uclass_priv(vid); struct console_simple_priv *priv = dev_get_priv(dev); - struct video_fontdata *fontdata = priv->fontdata; - int pbytes = VNBYTES(vid_priv->bpix); - int x, linenum, ret; - void *start, *line; - u8 ch = console_utf_to_cp437(cp); - uchar *pfont = fontdata->video_fontdata + - ch * fontdata->char_pixel_bytes; - - if (x_frac + VID_TO_POS(vc_priv->x_charsize) > vc_priv->xsize_frac) - return -EAGAIN; - linenum = y; - x = VID_TO_PIXEL(x_frac); - start = vid_priv->fb + linenum * vid_priv->line_length + x * pbytes; - line = start; - if (x_frac + VID_TO_POS(vc_priv->x_charsize) > vc_priv->xsize_frac) - return -EAGAIN; - - ret = fill_char_vertically(pfont, &line, vid_priv, fontdata, NORMAL_DIRECTION); - if (ret) - return ret; - - video_damage(dev->parent, - x, - y, - fontdata->width, - fontdata->height); - - return VID_TO_POS(fontdata->width); + return console_fixed_putc_xy(dev, x_frac, y, cp, priv->fontdata); } static int __maybe_unused console_set_cursor_visible(struct udevice *dev, @@ -134,6 +104,11 @@ static int __maybe_unused console_set_cursor_visible(struct udevice *dev, return 0; } +static int console_putc_xy(struct udevice *dev, uint x_frac, uint y, int cp) +{ + return console_normal_putc_xy(dev, x_frac, y, cp); +} + struct vidconsole_ops console_ops = { .putc_xy = console_putc_xy, .move_rows = console_move_rows, diff --git a/drivers/video/vidconsole_internal.h b/drivers/video/vidconsole_internal.h index bb0277ee451..af2cca8791c 100644 --- a/drivers/video/vidconsole_internal.h +++ b/drivers/video/vidconsole_internal.h @@ -146,6 +146,30 @@ int console_simple_get_font(struct udevice *dev, int seq, struct vidfont_info *i **/ int console_simple_select_font(struct udevice *dev, const char *name, uint size); +/** + * Normal console putc_xy function that can be called by other console drivers + * + * @param dev console device + * @param x_frac fractional X position + * @param y Y position in pixels + * @param cp Unicode code point + * @returns width in fractional pixels, or -ve on error + */ +int console_normal_putc_xy(struct udevice *dev, uint x_frac, uint y, int cp); + +/** + * Fixed font putc_xy function that can be called with explicit font data + * + * @param dev console device + * @param x_frac fractional X position + * @param y Y position in pixels + * @param cp Unicode code point + * @param fontdata font data to use for rendering + * @returns width in fractional pixels, or -ve on error + */ +int console_fixed_putc_xy(struct udevice *dev, uint x_frac, uint y, int cp, + struct video_fontdata *fontdata); + /** * Internal function to convert Unicode code points to code page 437. * Used by video consoles using bitmap fonts. From patchwork Fri Sep 19 20:14:17 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 352 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=1758312963; bh=wLOtmHVq04BngI0gTYs10RvP9MxUumbyvLCwkHg+38M=; 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=wlyAuIilgmuYETDwnuvlWZstgiXFBYUWHdrJZHunpyxHoRTqUGJDuuXXGcQJK8ZdB JmhNf8KnFYse8EZPHIIhL2RkxasMrUyLBUSTyvF4NeSstLawts9odlJrRJxfVZZElx JhymjPtVMwUb/DYOge0sRW5MRr0SLalvcGAuBuNr0TH8/inklf5km/cxbBMZKVR2Jp 9tkw99o+IPPbwtRB/LfKs49rWa39INlpzx8Art3v47CsN/rwOO9naJiB/hxfVF6+BM +Hvp3U/h01m5vauAHFGRzfx4SXMX9SUbhIsRbU+OwX5uvhA1dkzyyHHUVbhmUZBArl TLE5btiII6XTQ== Received: from localhost (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id ACA0867C6D for ; Fri, 19 Sep 2025 14:16:03 -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 zOhNnTU7Qy7z for ; Fri, 19 Sep 2025 14:16:03 -0600 (MDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1758312962; bh=wLOtmHVq04BngI0gTYs10RvP9MxUumbyvLCwkHg+38M=; 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=kLcR9TOc4b82XCQNelOTwhr0ET9tmYd0mO5RBmCS9ONn+YoU53EblytcK3oRhiAUV cOdDIJwEMmimUpyncClATU9ZAf47yTJitf0LLTHDgV2dVixcdrO4MxYBFHgIHyOehL vsheNUVnsql9Cy8xoOFQxKV+hxPg55T9MKQLNOzl4QDKQsE33QroGDxFYV3cVX9Kwa iojb05oCWGyxaFso2oJXuRwU3YzgwNyKbLFh8zlZy8d1YjcvWBJTVEJXqOK17K5D+B lv4LC6an8Q4zCumWMEJSPIJiVsmTCLJg14yWfWZXGQnSzXospxQT6s6zfJOxsCGse2 /BlL1ahx+f8pg== Received: from mail.u-boot.org (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id 73FCD67C78 for ; Fri, 19 Sep 2025 14:16:02 -0600 (MDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1758312960; bh=cCJF1N9JQBH5Dkt0YSM3mtZygSC1EJwYqF1tP47kNJg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=CqiY7I+yDMrEm/5I7MFHYSzCnhL4esUfBOk/9Sw0alBRGamQVzG2cz7JrXiLVES12 mzZO6AEwbh7aqzpmp1WOV7ros6fvWFInSdIW9u6aruKRyFVBuUvcy2/mrvIc6qtz2D 8JZtiqResSdb7pc8KZ6BzJTd3mi/Nl8wpAp5pEkTT87T+DmvXdjaUEHSTSeeTpVUVD Sq22VEEgLyMsQbs4gPlyjHkkYCOyFLrajBL7FXW+2FdLc2xy5Mn668q7L8cXiYOWel qE6yRi0o/YbcgdkKtkGfqsNbWSFaXkjxb5oqrUeY9k31cIDhtCx8CP0DroWMSQ3SH/ IkrTX7deqjTqw== Received: from localhost (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id CA3F267C0E; Fri, 19 Sep 2025 14:16: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 10026) with ESMTP id 3xQOaw-Kq9Zb; Fri, 19 Sep 2025 14:16:00 -0600 (MDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1758312959; bh=ndAfkYXXXi++azbWI1d+gbsBJ/CbOCAD5Jmzw/mtCaA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=lNRkdutkqF673fJ/Pt615F2EllhPKvZUDrOWyIr7FnJcgZUVIHIKYDPjbvfs7TRE2 GQdCp8h1qCjTSJsxaxD1fEHFpi6X/PK3JM3ZJexEOw7sZaOfArjhKDXEIrcs58PfBu fTrXiWx+nCaetwixzaMPGzyRAxqVnurZTZCjfRZOs/soxI9V/w6cSFS2VaaSHyqtT2 YNpHXgdGvNaVITTDNffbVh6qgyzuLKXo/5GJtuRYuGJ0Iv82aaYqFvAFCQdOXxYWHK N6eRyNMziBWZf4U1QPE6xUSd+MgaeE8L408erKj/gFKO/SPCw7TsYV81WNdlL6rLVh Md6CLGTcvKTNA== Received: from u-boot.org (unknown [73.34.74.121]) by mail.u-boot.org (Postfix) with ESMTPSA id 1AD9D67B3B; Fri, 19 Sep 2025 14:15:59 -0600 (MDT) From: Simon Glass To: U-Boot Concept Date: Fri, 19 Sep 2025 14:14:17 -0600 Message-ID: <20250919201507.4024144-11-sjg@u-boot.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20250919201507.4024144-1-sjg@u-boot.org> References: <20250919201507.4024144-1-sjg@u-boot.org> MIME-Version: 1.0 Message-ID-Hash: YWGQIADQLUOJNTDA76M47JTWGHUABXO5 X-Message-ID-Hash: YWGQIADQLUOJNTDA76M47JTWGHUABXO5 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 10/42] video: truetype: Rename the FONT_ENTRY() macro 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 Rename this macro in preparation for allowing truetype to use bitmap fonts. This avoids a conflict with FONT_ENTRY() in video_font.h Signed-off-by: Simon Glass --- drivers/video/console_truetype.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/drivers/video/console_truetype.c b/drivers/video/console_truetype.c index f185552261c..a17519282fc 100644 --- a/drivers/video/console_truetype.c +++ b/drivers/video/console_truetype.c @@ -520,7 +520,7 @@ struct font_info { extern u8 __ttf_ ## _name ## _begin[]; \ extern u8 __ttf_ ## _name ## _end[]; -#define FONT_ENTRY(_name) { \ +#define TT_FONT_ENTRY(_name) { \ .name = #_name, \ .begin = __ttf_ ## _name ## _begin, \ .end = __ttf_ ## _name ## _end, \ @@ -535,22 +535,22 @@ FONT_DECL(ubuntu_bold); static struct font_info font_table[] = { #ifdef CONFIG_CONSOLE_TRUETYPE_NIMBUS - FONT_ENTRY(nimbus_sans_l_regular), + TT_FONT_ENTRY(nimbus_sans_l_regular), #endif #ifdef CONFIG_CONSOLE_TRUETYPE_ANKACODER - FONT_ENTRY(ankacoder_c75_r), + TT_FONT_ENTRY(ankacoder_c75_r), #endif #ifdef CONFIG_CONSOLE_TRUETYPE_RUFSCRIPT - FONT_ENTRY(rufscript010), + TT_FONT_ENTRY(rufscript010), #endif #ifdef CONFIG_CONSOLE_TRUETYPE_CANTORAONE - FONT_ENTRY(cantoraone_regular), + TT_FONT_ENTRY(cantoraone_regular), #endif #ifdef CONFIG_CONSOLE_TRUETYPE_UBUNTU_LIGHT - FONT_ENTRY(ubuntu_light), + TT_FONT_ENTRY(ubuntu_light), #endif #ifdef CONFIG_CONSOLE_TRUETYPE_UBUNTU_BOLD - FONT_ENTRY(ubuntu_bold), + TT_FONT_ENTRY(ubuntu_bold), #endif {} /* sentinel */ }; From patchwork Fri Sep 19 20:14:18 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 353 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=1758312964; bh=frPN94HaGdFUnJoD4h/YTO8XTTss0aDWDH5DbZTS5Hc=; 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=e78gAiQA7NjMTvp+C5mgirH87nD+HUAkwfK+pCplBYalL40VtSEeU8pUSwKXzLA1/ OKX7s8T+3hG/MR9sRGcRKhQp41PjJ/MRRHra7EDAYzUOPEg5j5sPUhQOqJtz6yHvEV 78a2G5yKYvc+rTKz56LKYFWK5x+WcMrudhdHJi5Ia2ZuHTQ7ThSV6WrF8N0qjn9xmD 81vNoeaFTu9QY6HZ2r2IwqW2ka9RZ8t1k3PdLABY34JjoNgQ4q7tBLbVFn3c4wRP7B 9TF0QPzkiMRo5AQ53LHIFgIYz3FEd6kUALL6U0ubikhiN9Q5EIVtGGQCK+UPyCFTA1 pA+EMXrpHfpaA== Received: from localhost (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id 68D5467C6D for ; Fri, 19 Sep 2025 14:16: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 yQh7LTxJmtyM for ; Fri, 19 Sep 2025 14:16:04 -0600 (MDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1758312964; bh=frPN94HaGdFUnJoD4h/YTO8XTTss0aDWDH5DbZTS5Hc=; 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=e78gAiQA7NjMTvp+C5mgirH87nD+HUAkwfK+pCplBYalL40VtSEeU8pUSwKXzLA1/ OKX7s8T+3hG/MR9sRGcRKhQp41PjJ/MRRHra7EDAYzUOPEg5j5sPUhQOqJtz6yHvEV 78a2G5yKYvc+rTKz56LKYFWK5x+WcMrudhdHJi5Ia2ZuHTQ7ThSV6WrF8N0qjn9xmD 81vNoeaFTu9QY6HZ2r2IwqW2ka9RZ8t1k3PdLABY34JjoNgQ4q7tBLbVFn3c4wRP7B 9TF0QPzkiMRo5AQ53LHIFgIYz3FEd6kUALL6U0ubikhiN9Q5EIVtGGQCK+UPyCFTA1 pA+EMXrpHfpaA== Received: from mail.u-boot.org (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id 5195067B3B for ; Fri, 19 Sep 2025 14:16:04 -0600 (MDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1758312963; bh=gMRcV5S4gtzom6d+UeyYydv0z7LsiifIQ1MadROF3Ng=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=JmXoCzpVCw0lrCfAyWgLnl86/dF1YqG6Tt8BuFs9+I69aaiEZ+hzPDlJ47Y4bAAfz Lib3ewYgBLRn6aw/9Ti/ullCIMK1P2l+YI7ViIsDLGfO1P6S5QXn3JsSVKd19wyHCA eGBQzeT/HurHknFpnQ3dMyOwZHh80ITtQ5Tq1Zhjyo8hVEA7/FKTpL2YLlYhqNvnwp J86YanjB2aE/qreegzvwP1JcNlBBc92WJjB+CndQh7vY0Vznstevs0LETlC2FOQwjD yEOvnX2EM5ZWb28KqvA9liGeB6q24gI4OXRDlYZkg1ORIyqVTQAGvyzdBzoPc8iF7l 8C1tAJEzjA0kQ== Received: from localhost (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id 2679B67C7B; Fri, 19 Sep 2025 14:16:03 -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 UrKBNHKu3GWg; Fri, 19 Sep 2025 14:16:03 -0600 (MDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1758312960; bh=R8Cjfx9YRMVli3zU61qsHF7acQTNfUadD8e03+CAZEo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ZNdPDHXiTbq8ZmXvk6K3nhJUnjyqdVJj2mAruTLmZwMMgYLz9k5aJ9hbuG8LYIoFR UxhipOQWnXKRGiGKZItXCK4IRA/UnPrkh5r/TzGckNXbO8T7KEmaSD/OfwnieMUKJ4 nnLSd17WuLnub9ec5fxh2ZTkfXBiqsy+kHsqg7IcxPOlN3GS5DMw2z5Gn0AtJdNPEy ukIx1z5SkRfvHuveH1Ib8NT+lgHaJNYaTdZLNFi2bJLiGOayJ8yMaKvMK7IRESUuBI MdZFwLWm5A868pugl+rvy1+vjFq42x6TopCnTfcfvKA2VLVLnwBYiP7sPvXZjtXxS/ T0/FoY+JUnA+g== Received: from u-boot.org (unknown [73.34.74.121]) by mail.u-boot.org (Postfix) with ESMTPSA id E82F567C70; Fri, 19 Sep 2025 14:15:59 -0600 (MDT) From: Simon Glass To: U-Boot Concept Date: Fri, 19 Sep 2025 14:14:18 -0600 Message-ID: <20250919201507.4024144-12-sjg@u-boot.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20250919201507.4024144-1-sjg@u-boot.org> References: <20250919201507.4024144-1-sjg@u-boot.org> MIME-Version: 1.0 Message-ID-Hash: 22W2WJWSFR2UZHPT4GGWABYK6IZXKO7Q X-Message-ID-Hash: 22W2WJWSFR2UZHPT4GGWABYK6IZXKO7Q 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 11/42] video: Move setting of the bitmap font into uclass List-Id: Discussion and patches related to U-Boot Concept Archived-At: List-Archive: List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: From: Simon Glass Most of this function deals with uclass data, so move it into the uclass. This will allow truetype to use it too. Signed-off-by: Simon Glass --- drivers/video/console_core.c | 18 +----------------- drivers/video/vidconsole-uclass.c | 24 ++++++++++++++++++++++++ include/video_console.h | 10 ++++++++++ 3 files changed, 35 insertions(+), 17 deletions(-) diff --git a/drivers/video/console_core.c b/drivers/video/console_core.c index 4b75a5b6e12..aec51dc809d 100644 --- a/drivers/video/console_core.c +++ b/drivers/video/console_core.c @@ -21,25 +21,9 @@ static int console_set_font(struct udevice *dev, struct video_fontdata *fontdata) { struct console_simple_priv *priv = dev_get_priv(dev); - struct vidconsole_priv *vc_priv = dev_get_uclass_priv(dev); - struct video_priv *vid_priv = dev_get_uclass_priv(dev->parent); - - debug("console_simple: setting %s font\n", fontdata->name); - debug("width: %d\n", fontdata->width); - debug("byte width: %d\n", fontdata->byte_width); - debug("height: %d\n", fontdata->height); priv->fontdata = fontdata; - vc_priv->x_charsize = fontdata->width; - vc_priv->y_charsize = fontdata->height; - if (vid_priv->rot % 2) { - vc_priv->cols = vid_priv->ysize / fontdata->width; - vc_priv->rows = vid_priv->xsize / fontdata->height; - vc_priv->xsize_frac = VID_TO_POS(vid_priv->ysize); - } else { - vc_priv->cols = vid_priv->xsize / fontdata->width; - vc_priv->rows = vid_priv->ysize / fontdata->height; - } + vidconsole_set_bitmap_font(dev, fontdata); return 0; } diff --git a/drivers/video/vidconsole-uclass.c b/drivers/video/vidconsole-uclass.c index f53d55e81b7..b5f0b79bcf6 100644 --- a/drivers/video/vidconsole-uclass.c +++ b/drivers/video/vidconsole-uclass.c @@ -812,3 +812,27 @@ void vidconsole_set_quiet(struct udevice *dev, bool quiet) priv->quiet = quiet; } + +void vidconsole_set_bitmap_font(struct udevice *dev, + struct video_fontdata *fontdata) +{ + struct vidconsole_priv *vc_priv = dev_get_uclass_priv(dev); + struct video_priv *vid_priv = dev_get_uclass_priv(dev->parent); + + log_debug("console_simple: setting %s font\n", fontdata->name); + log_debug("width: %d\n", fontdata->width); + log_debug("byte width: %d\n", fontdata->byte_width); + log_debug("height: %d\n", fontdata->height); + + vc_priv->x_charsize = fontdata->width; + vc_priv->y_charsize = fontdata->height; + if (vid_priv->rot % 2) { + vc_priv->cols = vid_priv->ysize / fontdata->width; + vc_priv->rows = vid_priv->xsize / fontdata->height; + vc_priv->xsize_frac = VID_TO_POS(vid_priv->ysize); + } else { + vc_priv->cols = vid_priv->xsize / fontdata->width; + vc_priv->rows = vid_priv->ysize / fontdata->height; + /* xsize_frac is set in vidconsole_pre_probe() */ + } +} diff --git a/include/video_console.h b/include/video_console.h index d3c65a08331..8cd1ccacb0f 100644 --- a/include/video_console.h +++ b/include/video_console.h @@ -10,6 +10,7 @@ #include struct abuf; +struct video_fontdata; struct video_priv; #define VID_FRAC_DIV 256 @@ -603,4 +604,13 @@ int vidconsole_get_font_size(struct udevice *dev, const char **name, uint *sizep */ void vidconsole_set_quiet(struct udevice *dev, bool quiet); +/** + * vidconsole_set_bitmap_font() - prepare vidconsole for chosen bitmap font + * + * @dev vidconsole device + * @fontdata pointer to font data struct + */ +void vidconsole_set_bitmap_font(struct udevice *dev, + struct video_fontdata *fontdata); + #endif From patchwork Fri Sep 19 20:14:19 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 354 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=1758312967; bh=P4cFNFv1ln+Hze0BWys1Ym9o1XQKDxNWAYuaDZb41LQ=; 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=lu/y1/DXcQYsfCABbhoFN2AgzVVa9UQQU7SgQyphdTGeOiYkwWaCMa5lZEaMLMXw3 0rEe3soLIpgO0tRFG+Aq8y7/6hNJv0GSqbIypeTyooFgG9xzEcC/TtaIeAjCnWZj6j Nr6qD1VKETkzbg0JFfqlYmfCYbp18BPM3fwWoL97k57029UIgkKTJ9PVeHD4RMLuEe VvshHkfUj0d66bhMG+GgYbmo2qQUWodnGF+0/btq+A4ba3Viiw1yKxexuHAX2mmDip KVx+TeQYy7OTlRmMx5PCYGGRTyu/9A9BkcWJdpU+pBcq+455kq0XoaRqM5v4Kyj1Rj gKJVYcWqe6EAw== Received: from localhost (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id BE60067C6C for ; Fri, 19 Sep 2025 14:16: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 7FNmfR2mTY8T for ; Fri, 19 Sep 2025 14:16:07 -0600 (MDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1758312967; bh=P4cFNFv1ln+Hze0BWys1Ym9o1XQKDxNWAYuaDZb41LQ=; 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=lu/y1/DXcQYsfCABbhoFN2AgzVVa9UQQU7SgQyphdTGeOiYkwWaCMa5lZEaMLMXw3 0rEe3soLIpgO0tRFG+Aq8y7/6hNJv0GSqbIypeTyooFgG9xzEcC/TtaIeAjCnWZj6j Nr6qD1VKETkzbg0JFfqlYmfCYbp18BPM3fwWoL97k57029UIgkKTJ9PVeHD4RMLuEe VvshHkfUj0d66bhMG+GgYbmo2qQUWodnGF+0/btq+A4ba3Viiw1yKxexuHAX2mmDip KVx+TeQYy7OTlRmMx5PCYGGRTyu/9A9BkcWJdpU+pBcq+455kq0XoaRqM5v4Kyj1Rj gKJVYcWqe6EAw== Received: from mail.u-boot.org (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id A560267C0E for ; Fri, 19 Sep 2025 14:16:07 -0600 (MDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1758312965; bh=7V/1y7yN6nW20yCRXYnSwiOlI3DF837GAShHHifPyDI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=wJ1XGUwwHNrq3JNLnAEBiMbA5vx68XVtPMaCVnLgHpqqpXgYyy5LkHQjove8gwfZg ykrfMCm3S0MP1JXxqCLY9yOukmTKcModTyIVn1liOPFGapsxDWCcHkM+ST+1WVIcnn pAMSr6J6pE84FdpI6RxHNbVgxA3U4PoXuUTsVTa2wnp5ejBnFdtJRkuZaR+SPK52gG oWijPWEbv9IghlnV2VZW2eI7xp+4gfXnkEyqAkhUHIrviBHbnMbi+gkEmccti5UPGa 3IS7t2+ic3fFLz5WGH/rbvm3ZnBIHe+xFdSWwHk2ra6TkGnX3WW4duAq8XKIpgVa/t /+5b05GZnP4KA== Received: from localhost (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id C214E67B3B; Fri, 19 Sep 2025 14:16: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 10026) with ESMTP id uC2xK_aj-aiq; Fri, 19 Sep 2025 14:16:05 -0600 (MDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1758312961; bh=Bczi8MQe52dULp7Zkr9NAr8d9OpYF5D0woQ+XzHQgWM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=m+2l3+b66vz44yEuw9WtVpNhJ0CpRO2E8gqKSTgJEiHel0A1A9qH4JhpEeSHpEG2s AIXnlI1ctBtIDgaQSWbm+AER6L3DRjawnI8PVqkT4Cg2LSzLmFueXtEuYfJ49w13lT BqEM701F1HkcQwhubpf489v1cS+gMZWROIjgJWTczUFQJBkiTYYFrVhOxQlEYSFWt2 ogUv7OCu9rvosqKGw9Ug9JaHdhAhg3n4CrVoO3CRCikBHJLz4vnRhFSCaXWMCeO1I/ CYFeFlughbKBXHpW9UO0/VBpE1o7Gw6N4laSI2j/omtQWM079dOxwnMv4ogAo2N5ze HL1dY35StqTEg== Received: from u-boot.org (unknown [73.34.74.121]) by mail.u-boot.org (Postfix) with ESMTPSA id BFAF167C72; Fri, 19 Sep 2025 14:16:00 -0600 (MDT) From: Simon Glass To: U-Boot Concept Date: Fri, 19 Sep 2025 14:14:19 -0600 Message-ID: <20250919201507.4024144-13-sjg@u-boot.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20250919201507.4024144-1-sjg@u-boot.org> References: <20250919201507.4024144-1-sjg@u-boot.org> MIME-Version: 1.0 Message-ID-Hash: GULJQRJRSEQYKK54NSHEZLVATL4G5DEK X-Message-ID-Hash: GULJQRJRSEQYKK54NSHEZLVATL4G5DEK X-MailFrom: sjg@u-boot.org X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; loop; banned-address; emergency; member-moderation; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; digests; suspicious-header CC: Heinrich Schuchardt , Simon Glass , Claude X-Mailman-Version: 3.3.10 Precedence: list Subject: [Concept] [PATCH 12/42] video: Allow selection of bitmap fonts in truetype 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 sometimes useful to use a bitmap font for the console even when truetype fonts are available. As a starting point, pull in the font table and provide information about font sizes. Allow selection of a bitmap font by name, as well as listing available bitmap fonts. Co-developed-by: Claude Signed-off-by: Simon Glass --- drivers/video/console_truetype.c | 64 ++++++++++++++++++++++++++++++-- test/cmd/font.c | 8 +++- 2 files changed, 67 insertions(+), 5 deletions(-) diff --git a/drivers/video/console_truetype.c b/drivers/video/console_truetype.c index a17519282fc..eb9e7f55d68 100644 --- a/drivers/video/console_truetype.c +++ b/drivers/video/console_truetype.c @@ -12,6 +12,7 @@ #include #include #include +#include /* Functions needed by stb_truetype.h */ static int tt_floor(double val) @@ -169,6 +170,7 @@ struct console_tt_metrics { * last character. We record enough characters to go back to the * start of the current command line. * @pos_ptr: Current position in the position history + * @cur_fontdata: Current fixed font data (NULL if using TrueType) */ struct console_tt_priv { struct console_tt_metrics *cur_met; @@ -176,6 +178,7 @@ struct console_tt_priv { int num_metrics; struct pos_info pos[POS_HISTORY_SIZE]; int pos_ptr; + struct video_fontdata *cur_fontdata; }; /** @@ -595,9 +598,19 @@ int console_truetype_get_font(struct udevice *dev, int seq, struct vidfont_info *info) { struct font_info *tab; + struct video_fontdata *fontdata; int i; - for (i = 0, tab = font_table; tab->begin; tab++, i++) { + /* List fixed fonts first */ + for (i = 0, fontdata = fonts; fontdata->name; fontdata++, i++) { + if (i == seq) { + info->name = fontdata->name; + return 0; + } + } + + /* then list TrueType fonts */ + for (tab = font_table; tab->begin; tab++, i++) { if (i == seq && font_valid(tab)) { info->name = tab->name; return 0; @@ -671,6 +684,27 @@ static struct console_tt_metrics *find_metrics(struct udevice *dev, return NULL; } +/** + * set_bitmap_font() - Set up console to use a fixed font + * + * @dev: Console device + * @fontdata: Fixed font data to use + * Return: 0 if OK, -ve on error + */ +static void set_bitmap_font(struct udevice *dev, + struct video_fontdata *fontdata) +{ + struct vidconsole_priv *vc_priv = dev_get_uclass_priv(dev); + struct console_tt_priv *priv = dev_get_priv(dev); + + priv->cur_fontdata = fontdata; + priv->cur_met = NULL; + + vidconsole_set_bitmap_font(dev, fontdata); + + vc_priv->tab_width_frac = VID_TO_POS(fontdata->width) * 8 / 2; +} + static void select_metrics(struct udevice *dev, struct console_tt_metrics *met) { struct vidconsole_priv *vc_priv = dev_get_uclass_priv(dev); @@ -734,9 +768,24 @@ static int get_metrics(struct udevice *dev, const char *name, uint size, static int truetype_select_font(struct udevice *dev, const char *name, uint size) { + struct console_tt_priv *priv = dev_get_priv(dev); struct console_tt_metrics *met; + struct video_fontdata *fontdata; int ret; + /* Check if this is a request for a fixed font */ + if (name) { + for (fontdata = fonts; fontdata->name; fontdata++) { + if (!strcmp(name, fontdata->name)) { + /* Switch to fixed-font mode */ + set_bitmap_font(dev, fontdata); + return 0; + } + } + } + + /* Continue with TrueType font selection */ + priv->cur_fontdata = NULL; ret = get_metrics(dev, name, size, &met); if (ret) return log_msg_ret("sel", ret); @@ -1036,11 +1085,18 @@ static int truetype_set_cursor_visible(struct udevice *dev, bool visible, const char *console_truetype_get_font_size(struct udevice *dev, uint *sizep) { struct console_tt_priv *priv = dev_get_priv(dev); - struct console_tt_metrics *met = priv->cur_met; - *sizep = met->font_size; + if (priv->cur_fontdata) { + /* Using fixed font */ + *sizep = priv->cur_fontdata->height; + return priv->cur_fontdata->name; + } else { + /* Using TrueType font */ + struct console_tt_metrics *met = priv->cur_met; - return met->font_name; + *sizep = met->font_size; + return met->font_name; + } } static int console_truetype_probe(struct udevice *dev) diff --git a/test/cmd/font.c b/test/cmd/font.c index 7ae648d7395..b2610ddef8d 100644 --- a/test/cmd/font.c +++ b/test/cmd/font.c @@ -26,6 +26,10 @@ static int font_test_base(struct unit_test_state *uts) ut_assertok(uclass_first_device_err(UCLASS_VIDEO_CONSOLE, &dev)); ut_assertok(run_command("font list", 0)); + if (IS_ENABLED(CONFIG_VIDEO_FONT_8X16)) + ut_assert_nextline("8x16"); + if (IS_ENABLED(CONFIG_VIDEO_FONT_SUN12X22)) + ut_assert_nextline("12x22"); if (IS_ENABLED(CONFIG_CONSOLE_TRUETYPE_NIMBUS)) ut_assert_nextline("nimbus_sans_l_regular"); if (IS_ENABLED(CONFIG_CONSOLE_TRUETYPE_ANKACODER)) @@ -37,8 +41,10 @@ static int font_test_base(struct unit_test_state *uts) ut_assertok(vidconsole_get_font_size(dev, &name, &size)); if (IS_ENABLED(CONFIG_CONSOLE_TRUETYPE_ANKACODER)) ut_asserteq_str("ankacoder_c75_r", name); - else + else if (IS_ENABLED(CONFIG_CONSOLE_TRUETYPE_NIMBUS)) ut_asserteq_str("nimbus_sans_l_regular", name); + else + ut_asserteq_str("8x16", name); ut_asserteq(CONFIG_CONSOLE_TRUETYPE_SIZE, size); if (!IS_ENABLED(CONFIG_CONSOLE_TRUETYPE_CANTORAONE)) From patchwork Fri Sep 19 20:14:20 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 355 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=1758312969; bh=MS1yyXcYpj8kl1GEa/z0yVvtkV6adbHJwBjBYEFnpmM=; 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=EE7dhcrexrtuFblcsDqerx99e1zDiigfdNEeYigCQU2Sjrd0i3C+nC69YOLcHCquL XSuAunB/10TQiZmAe58RcE1/0hdrpFRqedDCB+chNA7WUpM7T7l2w2r/JsiphBxlew 7EQcdO9l1XDGkhzj096FLda6ZjgyWdPVN04bkKBm+k7DlGW1PnZVYfpqCXdkm8WM3s fhktuezIKYzvwdV7Zqaa2KO3oaPLW+N+xA2HCIwihPironHpgRM3J3gxXY6FhoYaa8 YmlxYRlImD9BOVHc/W0TTDkuLTCzc19G0Qc1Tw0nfE/ocNnZ8buPWUocy4+KChin9Z uK0RtfqXze3LA== Received: from localhost (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id 2F64167C5A for ; Fri, 19 Sep 2025 14:16: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 10024) with ESMTP id nJhXhMj7JxpG for ; Fri, 19 Sep 2025 14:16:09 -0600 (MDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1758312969; bh=MS1yyXcYpj8kl1GEa/z0yVvtkV6adbHJwBjBYEFnpmM=; 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=EE7dhcrexrtuFblcsDqerx99e1zDiigfdNEeYigCQU2Sjrd0i3C+nC69YOLcHCquL XSuAunB/10TQiZmAe58RcE1/0hdrpFRqedDCB+chNA7WUpM7T7l2w2r/JsiphBxlew 7EQcdO9l1XDGkhzj096FLda6ZjgyWdPVN04bkKBm+k7DlGW1PnZVYfpqCXdkm8WM3s fhktuezIKYzvwdV7Zqaa2KO3oaPLW+N+xA2HCIwihPironHpgRM3J3gxXY6FhoYaa8 YmlxYRlImD9BOVHc/W0TTDkuLTCzc19G0Qc1Tw0nfE/ocNnZ8buPWUocy4+KChin9Z uK0RtfqXze3LA== Received: from mail.u-boot.org (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id 14AF967C10 for ; Fri, 19 Sep 2025 14:16:09 -0600 (MDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1758312967; bh=drQMYPPhinZa3JrSk+cZ9WfBZ8zzvAKIWOPMGDOeLdo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=lXJeYDWUJReyG/NJQJr0jffXQbybZWr+RsrJ3dBNxMA90zGTkyREKla5fAH5YA512 2+yml9WkAGjGeLJ0kWSrlnbr5PI8mg2cwnX2C/Ab0Yvzgf6OVOk7HTDaw8RzZXS774 gL1RuPTjdryfPXYWYpYC7bs8jVGE4ZdHLKobpIhbPK21zxgV/i050WsRw5MVx/peEL h0julJStb3dk2dcOx9jl0YjeijBCKCLx5zMxmSeKFwwdInjSnCUQ1Ndv3fO+c0cOg6 +uD/IfYB+0eZ4YCrLywHAq6JXUzlOYz0NK4+AAFRErlu9gUaluP10ZCiwXdS47SJrp XZLVcVF6egZoA== Received: from localhost (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id 792FE67B3B; Fri, 19 Sep 2025 14:16: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 10026) with ESMTP id wdiGCKiCinyX; Fri, 19 Sep 2025 14:16:07 -0600 (MDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1758312965; bh=9K4YyjENxWbqmcG3VB+QYZtx1OLSYBWRr8kcPDu1xOM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=tzix+u7JWnL39WChIFJGi3MMLrKHeiiWDu6f553aju/S5BafxwA+0A0UEg2Hw868I 5XRWkoAllxo+IFkEzVi5i0MmJmYYcqP7aJBnUeAfftvSTN1O/47xZ0Ia61YY47mNxc NwUTIlNtL9QoIk9Ui9rCKNBtpA4TNzfpb5jsgTvN3wgQNjWFSt2mdWc1VP3+3TsZOm RWyTxOlOohht1Yiso95fWT+/E7K87AtMnO6WD2sW6dbAAzB3JFFTfqUv+xSnml0d4O AVoO0ApR+qlhK9uSPWRKi3XCP9Mp6IIUN0am/fx3uH29ftu+BiZrNliwfHzJBM9UaY kBU8d3cWaPB9w== Received: from u-boot.org (unknown [73.34.74.121]) by mail.u-boot.org (Postfix) with ESMTPSA id 6C6EE67A99; Fri, 19 Sep 2025 14:16:05 -0600 (MDT) From: Simon Glass To: U-Boot Concept Date: Fri, 19 Sep 2025 14:14:20 -0600 Message-ID: <20250919201507.4024144-14-sjg@u-boot.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20250919201507.4024144-1-sjg@u-boot.org> References: <20250919201507.4024144-1-sjg@u-boot.org> MIME-Version: 1.0 Message-ID-Hash: ARIWEQP736BVNWCFNEDZ7CMXVP672O4V X-Message-ID-Hash: ARIWEQP736BVNWCFNEDZ7CMXVP672O4V 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 13/42] video: truetype: Handle rendering of bitmap fonts 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 Complete the support for this feature by dealing with rendering, the moving to a particular row/column and scrolling. Provide a simple test to check that things look right. Allow omitting the font name to request the default font. Fix an errant tab nearby. Co-developed-by: Claude Signed-off-by: Simon Glass --- cmd/font.c | 3 --- doc/usage/cmd/font.rst | 16 ++++++++++-- drivers/video/console_truetype.c | 37 +++++++++++++++++++------- drivers/video/vidconsole-uclass.c | 1 + test/cmd/font.c | 7 +++-- test/dm/video.c | 43 ++++++++++++++++++++++++++++++- 6 files changed, 89 insertions(+), 18 deletions(-) diff --git a/cmd/font.c b/cmd/font.c index 36e41203654..384751e787a 100644 --- a/cmd/font.c +++ b/cmd/font.c @@ -31,9 +31,6 @@ static int do_font_select(struct cmd_tbl *cmdtp, int flag, int argc, uint size = 0; int ret; - if (argc < 2) - return CMD_RET_USAGE; - if (uclass_first_device_err(UCLASS_VIDEO_CONSOLE, &dev)) return CMD_RET_FAILURE; name = argv[1]; diff --git a/doc/usage/cmd/font.rst b/doc/usage/cmd/font.rst index 44a04f5d075..6e313e70c7a 100644 --- a/doc/usage/cmd/font.rst +++ b/doc/usage/cmd/font.rst @@ -12,7 +12,7 @@ Synopsis :: font list - font select [] + font select [ []] font size [] Description @@ -25,11 +25,13 @@ font list ~~~~~~~~~ This lists the available fonts, using the name of the font file in the build. +Any enabled bitmap fonts are listed as well. font select ~~~~~~~~~~~ -This selects a new font and optionally changes the size. +This selects a new font and optionally changes the size. If the name is not +provided, the default font is used. font size ~~~~~~~~~ @@ -50,6 +52,16 @@ Examples => font select cantoraone_regular 20 => +This shows an example of selecting a bitmap font Truetype is active:: + + => font list + 8x16 + 12x22 + nimbus_sans_l_regular + cantoraone_regular + => font sel 8x16 + + Configuration ------------- diff --git a/drivers/video/console_truetype.c b/drivers/video/console_truetype.c index eb9e7f55d68..43274bb8f66 100644 --- a/drivers/video/console_truetype.c +++ b/drivers/video/console_truetype.c @@ -13,6 +13,7 @@ #include #include #include +#include "vidconsole_internal.h" /* Functions needed by stb_truetype.h */ static int tt_floor(double val) @@ -197,11 +198,17 @@ static int console_truetype_set_row(struct udevice *dev, uint row, int clr) struct video_priv *vid_priv = dev_get_uclass_priv(dev->parent); struct vidconsole_priv *vc_priv = dev_get_uclass_priv(dev); struct console_tt_priv *priv = dev_get_priv(dev); - struct console_tt_metrics *met = priv->cur_met; void *end, *line; + int font_height; + + /* Get font height from current font type */ + if (priv->cur_fontdata) + font_height = priv->cur_fontdata->height; + else + font_height = priv->cur_met->font_size; - line = vid_priv->fb + row * met->font_size * vid_priv->line_length; - end = line + met->font_size * vid_priv->line_length; + line = vid_priv->fb + row * font_height * vid_priv->line_length; + end = line + font_height * vid_priv->line_length; switch (vid_priv->bpix) { case VIDEO_BPP8: { @@ -250,17 +257,22 @@ static int console_truetype_move_rows(struct udevice *dev, uint rowdst, struct video_priv *vid_priv = dev_get_uclass_priv(dev->parent); struct vidconsole_priv *vc_priv = dev_get_uclass_priv(dev); struct console_tt_priv *priv = dev_get_priv(dev); - struct console_tt_metrics *met = priv->cur_met; void *dst; void *src; - int i, diff; + int i, diff, font_height; - dst = vid_priv->fb + rowdst * met->font_size * vid_priv->line_length; - src = vid_priv->fb + rowsrc * met->font_size * vid_priv->line_length; - memmove(dst, src, met->font_size * vid_priv->line_length * count); + /* Get font height from current font type */ + if (priv->cur_fontdata) + font_height = priv->cur_fontdata->height; + else + font_height = priv->cur_met->font_size; + + dst = vid_priv->fb + rowdst * font_height * vid_priv->line_length; + src = vid_priv->fb + rowsrc * font_height * vid_priv->line_length; + memmove(dst, src, font_height * vid_priv->line_length * count); /* Scroll up our position history */ - diff = (rowsrc - rowdst) * met->font_size; + diff = (rowsrc - rowdst) * font_height; for (i = 0; i < priv->pos_ptr; i++) priv->pos[i].ypos -= diff; @@ -281,7 +293,7 @@ static int console_truetype_putc_xy(struct udevice *dev, uint x, uint y, struct video_priv *vid_priv = dev_get_uclass_priv(vid); struct console_tt_priv *priv = dev_get_priv(dev); struct console_tt_metrics *met = priv->cur_met; - stbtt_fontinfo *font = &met->font; + stbtt_fontinfo *font; int width, height, xoff, yoff; double xpos, x_shift; int lsb; @@ -292,7 +304,12 @@ static int console_truetype_putc_xy(struct udevice *dev, uint x, uint y, void *start, *end, *line; int row, kern; + /* Use fixed font if selected */ + if (priv->cur_fontdata) + return console_fixed_putc_xy(dev, x, y, cp, priv->cur_fontdata); + /* First get some basic metrics about this character */ + font = &met->font; stbtt_GetCodepointHMetrics(font, cp, &advance, &lsb); /* diff --git a/drivers/video/vidconsole-uclass.c b/drivers/video/vidconsole-uclass.c index b5f0b79bcf6..cb7212e9730 100644 --- a/drivers/video/vidconsole-uclass.c +++ b/drivers/video/vidconsole-uclass.c @@ -835,4 +835,5 @@ void vidconsole_set_bitmap_font(struct udevice *dev, vc_priv->rows = vid_priv->ysize / fontdata->height; /* xsize_frac is set in vidconsole_pre_probe() */ } + vc_priv->xstart_frac = 0; } diff --git a/test/cmd/font.c b/test/cmd/font.c index b2610ddef8d..ce694fef7e4 100644 --- a/test/cmd/font.c +++ b/test/cmd/font.c @@ -82,9 +82,12 @@ static int font_test_base(struct unit_test_state *uts) ut_assert_nextline("30"); ut_assertok(ut_check_console_end(uts)); + ut_assertok(run_command("font select", 0)); + ut_assertok(ut_check_console_end(uts)); + ut_assertok(vidconsole_get_font_size(dev, &name, &size)); - ut_asserteq_str("cantoraone_regular", name); - ut_asserteq(30, size); + ut_asserteq_str("nimbus_sans_l_regular", name); + ut_asserteq(CONFIG_CONSOLE_TRUETYPE_SIZE, size); return 0; } diff --git a/test/dm/video.c b/test/dm/video.c index a48d0c0411c..3ec12956909 100644 --- a/test/dm/video.c +++ b/test/dm/video.c @@ -944,7 +944,7 @@ static int dm_test_video_box(struct unit_test_state *uts) video_draw_box(dev, 500, 100, 600, 200, 20, video_index_to_colour(priv, VID_LIGHT_RED), false); ut_asserteq(133, video_compress_fb(uts, dev, false)); - + /* test filled boxes */ video_draw_box(dev, 150, 250, 200, 300, 0, video_index_to_colour(priv, VID_GREEN), true); @@ -956,3 +956,44 @@ static int dm_test_video_box(struct unit_test_state *uts) return 0; } DM_TEST(dm_test_video_box, UTF_SCAN_FDT); + +/* font switching between TrueType and bitmap fonts */ +static int dm_test_video_font_switch(struct unit_test_state *uts) +{ + struct udevice *dev, *con; + const char *truetype_text = + "This is a long line of text written with TrueType font that " + "should wrap to multiple lines to test the multi-line " + "functionality properly. This is the second part of TrueType " + "text that should also be long enough to wrap and test the " + "line handling."; + const char *bitmap_text = + "Now this is bitmap font text that spans multiple lines and " + "should be rendered with the standard 8x16 bitmap font instead " + "of TrueType. More of the line of-bitmap text for testing " + "purposes."; + const char *final_truetype_text = + "Finally back to TrueType font for this concluding multi-line " + "text that demonstrates the font switching functionality " + "working correctly.\nFinal line of TrueType text to complete " + "the test.\n"; + + ut_assertok(video_get_nologo(uts, &dev)); + ut_assertok(uclass_get_device(UCLASS_VIDEO_CONSOLE, 0, &con)); + + /* Start with TrueType font and write multi-line text */ + vidconsole_put_string(con, truetype_text); + + /* Switch to bitmap font */ + ut_assertok(vidconsole_select_font(con, "8x16", 0)); + vidconsole_put_string(con, bitmap_text); + + /* Switch back to TrueType font */ + ut_assertok(vidconsole_select_font(con, NULL, 0)); + vidconsole_put_string(con, final_truetype_text); + + ut_asserteq(14892, video_compress_fb(uts, dev, false)); + + return 0; +} +DM_TEST(dm_test_video_font_switch, UTF_SCAN_PDATA | UTF_SCAN_FDT); From patchwork Fri Sep 19 20:14:21 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 356 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=1758312974; bh=XhthwO5S9iOujYeWYlTpZ0R8XLtdpQh9vs4nK96IwZk=; 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=FR1KdnITEN4gsbeFBKo5F15nHDTUrmPjoCa/YmKWvDZH4I0PvzR5yJkD8tDD90yme 8kEXA9N9RQg15paiDTyoof/KfVfoPt3Jzjs8zIhn9tmNquyTHVWPOdtl8zNVwQL4W5 w6nTInxUZVpJfrWKGI1NxU0JXggqSiAOBV9xtYDk7jYl6G1OQAu4v3cwoIffFzgvX2 cq0Mzue1SZAc5c49fGPT1oq3QfPuK85Rfx/QBoCuM5b7kSjtDpWhNaURnczJADvgeR /xQ0T25/ABnIpIExz/5Zyy7A5HbtJKGan9Qe2unyA8wLO+WqI6egDiKTnisXOeJd5d x1U9NMDfJcQRA== Received: from localhost (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id 800AF67C6C for ; Fri, 19 Sep 2025 14:16:14 -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 q28uhLOgdG6T for ; Fri, 19 Sep 2025 14:16:14 -0600 (MDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1758312974; bh=XhthwO5S9iOujYeWYlTpZ0R8XLtdpQh9vs4nK96IwZk=; 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=FR1KdnITEN4gsbeFBKo5F15nHDTUrmPjoCa/YmKWvDZH4I0PvzR5yJkD8tDD90yme 8kEXA9N9RQg15paiDTyoof/KfVfoPt3Jzjs8zIhn9tmNquyTHVWPOdtl8zNVwQL4W5 w6nTInxUZVpJfrWKGI1NxU0JXggqSiAOBV9xtYDk7jYl6G1OQAu4v3cwoIffFzgvX2 cq0Mzue1SZAc5c49fGPT1oq3QfPuK85Rfx/QBoCuM5b7kSjtDpWhNaURnczJADvgeR /xQ0T25/ABnIpIExz/5Zyy7A5HbtJKGan9Qe2unyA8wLO+WqI6egDiKTnisXOeJd5d x1U9NMDfJcQRA== Received: from mail.u-boot.org (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id 6FD0D67C5A for ; Fri, 19 Sep 2025 14:16:14 -0600 (MDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1758312972; bh=Mg/QJUlhMkuXrMo1tgJuK4/HA5uYc0NKiTPUuXz0ESU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=kPAgD4W3cFVsOAwyUzMRRwYA8xTDRvO+A+QSgyN1+1nVYorMeEcc9TzHyxgo4Tu/U HnFwbkfqbnUcF5jPWhNQvO3IVxQ6W1Kb0IjnTce2yEKjdnqltBQsGT1fkJYfjAckqC ng2q1pvKVd0LRVdBDhec4z+qBCGMvDXvXFg/8/O1l4MzKcsZPF5jmQL6izlMQxZ3pS tftoOZRCZgHcp5mRfSEJ7qFGyx7Nvt1zJbYFmKCw3uopU5K5bnVAglxNORvRmfBUKN zhEGnR8GHQ5+Q1ABhf4f3xevqEOqnHY4pkw8C365W73PKIItEe3s6nxDGRvibpqMNN YVmeUvkqxogmw== Received: from localhost (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id 2E4A267B3B; Fri, 19 Sep 2025 14:16: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 10026) with ESMTP id hW3x08uOcD4c; Fri, 19 Sep 2025 14:16:12 -0600 (MDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1758312968; bh=ou+6j8srHawFFHNvqZMgduxOHa4X5R4L8iV5ye9gnPI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=iijX82+vpHnuV+AuRm5lRXuLkl7Ap+hwvA4BOwMVz+On/lo4cHwhCcWYuqAdcdkDg EQdMa0DZ4lOlnbgGgbhQ0GwS+e1VZDESGfPFMnr3eMEwafymYmS8VSGYjmGtIvboRj nWP/ujlc+9f5IFowysbSGz+mTn6c69cUePjMLPQ7e5JY3p3Q3WJ7GXJn3EHt2DJs8+ lXtCXiHQJbvg07czpevnWN3+3/cnNjuxm3qWdfyY9U8SagKWYUwIhBFxjbWtsgwDPQ 9qVBd4im1vM66yq1msh8zsBqOkYnxnTHbLYHzNNpfRdtkre4DWSbMjjcS6otBabtMA InkLXWwPlymnw== Received: from u-boot.org (unknown [73.34.74.121]) by mail.u-boot.org (Postfix) with ESMTPSA id BE2DD67C5B; Fri, 19 Sep 2025 14:16:07 -0600 (MDT) From: Simon Glass To: U-Boot Concept Date: Fri, 19 Sep 2025 14:14:21 -0600 Message-ID: <20250919201507.4024144-15-sjg@u-boot.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20250919201507.4024144-1-sjg@u-boot.org> References: <20250919201507.4024144-1-sjg@u-boot.org> MIME-Version: 1.0 Message-ID-Hash: X66LSSKBOWGNGDRU5GN6WYDV4UG3BYSS X-Message-ID-Hash: X66LSSKBOWGNGDRU5GN6WYDV4UG3BYSS 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 14/42] video: truetype: Use common cursor-drawing code 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 Update truetype_set_cursor_visible() to use the existing shared draw_cursor_vertically() function instead of duplicating cursor-drawing itself. This corrects a problem where met is accessed for fixed-width fonts, for which it doesn't exist. Co-developed-by: Claude Signed-off-by: Simon Glass --- drivers/video/console_truetype.c | 82 +++++--------------------------- 1 file changed, 11 insertions(+), 71 deletions(-) diff --git a/drivers/video/console_truetype.c b/drivers/video/console_truetype.c index 43274bb8f66..fb7f70a4b2a 100644 --- a/drivers/video/console_truetype.c +++ b/drivers/video/console_truetype.c @@ -1000,10 +1000,8 @@ static int truetype_set_cursor_visible(struct udevice *dev, bool visible, struct udevice *vid = dev->parent; struct video_priv *vid_priv = dev_get_uclass_priv(vid); struct console_tt_priv *priv = dev_get_priv(dev); - struct console_tt_metrics *met = priv->cur_met; - uint row, width, height, xoff; - void *start, *line; - uint out, val; + void *line; + uint height; if (xpl_phase() <= PHASE_SPL) return -ENOSYS; @@ -1022,79 +1020,21 @@ static int truetype_set_cursor_visible(struct udevice *dev, bool visible, x = VID_TO_PIXEL(vc_priv->xcur_frac); y = vc_priv->ycur; - height = met->font_size; - xoff = 0; - val = vid_priv->colour_bg ? 0 : 255; - width = VIDCONSOLE_CURSOR_WIDTH; + /* Get font height from current font type */ + if (priv->cur_fontdata) + height = priv->cur_fontdata->height; + else + height = priv->cur_met->font_size; /* Figure out where to write the cursor in the frame buffer */ - start = vid_priv->fb + y * vid_priv->line_length + + line = vid_priv->fb + y * vid_priv->line_length + x * VNBYTES(vid_priv->bpix); - line = start; - - /* draw a vertical bar in the correct position */ - for (row = 0; row < height; row++) { - switch (vid_priv->bpix) { - case VIDEO_BPP8: - if (IS_ENABLED(CONFIG_VIDEO_BPP8)) { - u8 *dst = line + xoff; - int i; - - out = val; - for (i = 0; i < width; i++) { - if (vid_priv->colour_fg) - *dst++ |= out; - else - *dst++ &= out; - } - } - break; - case VIDEO_BPP16: { - u16 *dst = (u16 *)line + xoff; - int i; - if (IS_ENABLED(CONFIG_VIDEO_BPP16)) { - for (i = 0; i < width; i++) { - out = val >> 3 | - (val >> 2) << 5 | - (val >> 3) << 11; - if (vid_priv->colour_fg) - *dst++ |= out; - else - *dst++ &= out; - } - } - break; - } - case VIDEO_BPP32: { - u32 *dst = (u32 *)line + xoff; - int i; - - if (IS_ENABLED(CONFIG_VIDEO_BPP32)) { - for (i = 0; i < width; i++) { - int out; - - if (vid_priv->format == VIDEO_X2R10G10B10) - out = val << 2 | val << 12 | val << 22; - else - out = val | val << 8 | val << 16; - if (vid_priv->colour_fg) - *dst++ |= out; - else - *dst++ &= out; - } - } - break; - } - default: - return -ENOSYS; - } - - line += vid_priv->line_length; - } + /* Use the shared cursor drawing function */ + draw_cursor_vertically(&line, vid_priv, height, NORMAL_DIRECTION); - video_damage(dev->parent, x, y, width, height); + video_damage(dev->parent, x, y, VIDCONSOLE_CURSOR_WIDTH, height); return video_sync(vid, true); } From patchwork Fri Sep 19 20:14:22 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 357 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=1758312976; bh=zYlUP5JMEgConsanLnwPnG3xfBYvM3RDCBTtpegT0Hc=; 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=pucGpEGhcHPgNauKW780iqO7o99sLS0TUgnow0xJSxZ66DaVFDpQ0lmddT1ZUBzki M5pqOTw2LoYlNleSQTwKvdx8GnYTB52iBzSB+KodcdG1jG+N8RubwxO49Qrx9uhCrk YdX7wJ9IoXVXFkOUDbXlhPtslhqzdK4FqdpBhRBtEG/6NIAAu7tgvkThORqm7XfN1T Zjkdf7IGzJx7cPUqEn1PmR4B5qDGVR496vLv+HVkWxFTxHAeGxw5xKoNuER8fJ+P7w 5uPaiElW+SbnFPFW4fEe3T+MaBdaG5ek7iLZMwsHudJWKRHi6NRL95Lv+Qne/UDuax V4ADvMDz4bGsg== Received: from localhost (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id D18CF67C72 for ; Fri, 19 Sep 2025 14:16:16 -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 DAyDIOkqpJIW for ; Fri, 19 Sep 2025 14:16:16 -0600 (MDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1758312975; bh=zYlUP5JMEgConsanLnwPnG3xfBYvM3RDCBTtpegT0Hc=; 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=s/2/54ZpC8mNILw/RzjXfmd9kICYpNqjqTMWfLAAl6ER5f+ysOQYfURFr619Eq3Ky S7ZbsjUzAjy3FnNon63oMjlGvuukCYB7epoX3cp1be6aYqPW3Be+aW+DrSQ8w65YvV +S7xvIJpY6Ioncm3CTCeMFpCEVtyvecRpZQ2Wg4kqa+nxrZghnQLwPVVmpTGFY1ey0 CWsn++to3djlFG0IAchSiAa47OVMSD2Trg1zsEbc+DLCzYfdf7DPFzDxY+wHSpMubI 0qdCvN85w7RAz1F9BFui1sPQ5/zbeB4lDfyYs1Iv9edjleYza65pCqA3pgwyx5ZrK+ 5JH6qUGVUwpvA== Received: from mail.u-boot.org (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id D60AF67B3B for ; Fri, 19 Sep 2025 14:16:15 -0600 (MDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1758312974; bh=vfHRO+xroOK1vUP8VFSjADO+0HKFQCPwBEFUyD06zCM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=L1aXS/rnv4pEj7D+xAqqHqGkYB6vI4ePL+8nH/sWZ1s73dVDPfo/APdfpf8Tv7hl4 Gy3c3EiKW6KaUNxgPdDxeqNtL0NUD1BgjkwYB98LwYHF5fBzTeyK9DuM+OLrzK01u8 InDK24ddnRalzIImO+rIUJUdHEieWtcENVawm+kjtrLg4lpSO5q+q9neW2ukkZ9GDb Zoimc6vlCSOb/IM/exFVwu0cT31o+gFgNoXjpdoI699VHOkSeVJ6srceKVtNeJC9BK Y6eoeGY1DRROQMNpcB4Kcj1om4GRsFKvlviLSHOe01BQJc4PzDfs3z2nCgXMN8lUM+ l7jA2Kg2lr3LQ== Received: from localhost (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id 2CC6C67B3B; Fri, 19 Sep 2025 14:16:14 -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 R0HWBf_vVG50; Fri, 19 Sep 2025 14:16:14 -0600 (MDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1758312972; bh=WcZWzNsxzRHuiyNrg/TLPAfXBxo577JlFDXTfADN3MY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=AQB5SiuZKOHXgIauxzegtIAPDVtQHXnE3+Ncpml3z0cBcVTYO7+YlrD+Y+VocNgWL 2SWq8Mf35ZNZliTLkoDTOWmzydeICn7CyonBrLucfyHeua+WE2wOtO3xNSWJ6onTb3 7VzK3/TPaSDfgnUj4dQSq3dO2D9/x0UBV5XTAB6PquF0BSkQpAa3g25Z4lTxXttjNv HYOVL02cQUQcRFkRSIfyikFgJKrV/dJqrhPwB2wNeh3Gcc2A7/DVMqDOteEwewIkKA zBpRsdx7JUN3/ySN98mcMfQzQ6ofgmh+oE54yDPvnliyaC6nYs2PEefn8bIulNVhcT 7EXrK+D1GX2hg== Received: from u-boot.org (unknown [73.34.74.121]) by mail.u-boot.org (Postfix) with ESMTPSA id 76BC267A99; Fri, 19 Sep 2025 14:16:12 -0600 (MDT) From: Simon Glass To: U-Boot Concept Date: Fri, 19 Sep 2025 14:14:22 -0600 Message-ID: <20250919201507.4024144-16-sjg@u-boot.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20250919201507.4024144-1-sjg@u-boot.org> References: <20250919201507.4024144-1-sjg@u-boot.org> MIME-Version: 1.0 Message-ID-Hash: HHARKRUA73YWKOBDTB7ANRRLXPHW4MHP X-Message-ID-Hash: HHARKRUA73YWKOBDTB7ANRRLXPHW4MHP 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 15/42] video: Correct cursor handling when the the left side 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 There is normally a prompt which prevents the cursor ever being on the far left. However we should check for this to avoid a potential crash. Add a check for x being at least 0 in console_set_cursor_visible() Signed-off-by: Simon Glass --- drivers/video/console_normal.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/drivers/video/console_normal.c b/drivers/video/console_normal.c index 9509f81f40f..68d47eb8da6 100644 --- a/drivers/video/console_normal.c +++ b/drivers/video/console_normal.c @@ -92,11 +92,12 @@ static int __maybe_unused console_set_cursor_visible(struct udevice *dev, return -ENOSYS; x += index * fontdata->width; - start = vid_priv->fb + y * vid_priv->line_length + x * pbytes; /* place the cursor 1 pixel before the start of the next char */ - x -= 1; + if (x > 0) + x -= 1; + start = vid_priv->fb + y * vid_priv->line_length + x * pbytes; line = start; draw_cursor_vertically(&line, vid_priv, vc_priv->y_charsize, NORMAL_DIRECTION); From patchwork Fri Sep 19 20:14:23 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 358 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=1758312981; bh=2DY11E2mwbnHt99EYA6004OAqYlTnUvK6d3326bFi7w=; 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=F2ZpfuHEeaR26Z2318YWyLzhSigDx7b/NxHIhikXXjHAsExrroIZKPEdZuiu/c040 V08bP8FNWvqdiwbXNbclnOtSd/4b84o6xc/ZYPNptgD2T7UjfEgie3xt1iRKO4VrH3 DZzrw7wS0fpqC1xvqWZoDyIkn4j+FBbulTnruluLb4r6esJTwbZwt1sDfFwKN5gqHc IsKwYMu7HWKfbLT2wzAJ59Ia2PMjPpBJ6TdRNo/OovftPmIRmEcPWcrb0AbgMiEEJT A1Y060AlsWEqanniTSE0cn3WVjzZtPWTJd0P8F9zcIlTdMcnmmJ61ebzxno9xilrkm uZDgfU2J3Z4QA== Received: from localhost (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id 591C667C6C for ; Fri, 19 Sep 2025 14:16:21 -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 IKaqLih9xl_B for ; Fri, 19 Sep 2025 14:16:21 -0600 (MDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1758312981; bh=2DY11E2mwbnHt99EYA6004OAqYlTnUvK6d3326bFi7w=; 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=F2ZpfuHEeaR26Z2318YWyLzhSigDx7b/NxHIhikXXjHAsExrroIZKPEdZuiu/c040 V08bP8FNWvqdiwbXNbclnOtSd/4b84o6xc/ZYPNptgD2T7UjfEgie3xt1iRKO4VrH3 DZzrw7wS0fpqC1xvqWZoDyIkn4j+FBbulTnruluLb4r6esJTwbZwt1sDfFwKN5gqHc IsKwYMu7HWKfbLT2wzAJ59Ia2PMjPpBJ6TdRNo/OovftPmIRmEcPWcrb0AbgMiEEJT A1Y060AlsWEqanniTSE0cn3WVjzZtPWTJd0P8F9zcIlTdMcnmmJ61ebzxno9xilrkm uZDgfU2J3Z4QA== Received: from mail.u-boot.org (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id 47E0767C5A for ; Fri, 19 Sep 2025 14:16:21 -0600 (MDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1758312979; bh=bxrErlVQ3+mwxU7aF5ozJpDb1LEAtD3YAX4ri6TyESc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=JaYvMq/FHZbbZpZkQlaed7qmZMK8AKeJbK8XceOtbDz7s0Qi+OtRerRQrmwl71ClP bk0JDnx+aDW2RcTwJ5rh71gPwz6xf3/OaV2AsLDmEOTVLaf8QDs1VcwPOGBsFCwjdW OpTlSTTgcvBsgTDBNMmGJjjwhmWaVqdmokmWvgg59bG/TyeV7IClmMzuu1IZapiz4B lecYzrsqSRDlJvRF4ldg3zrZvW9skyOwSFsMMVJ0a17rQDHFaoUpptF/rmIzvBk+Sc zF9QBC5+T9xcStBvBztH3l9m74SgmhGA/oycwWdl+mFHPr+Z9TLUcIWrjOtyv5zwk0 FOtqWuZ/yxwJQ== Received: from localhost (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id 15A1967B3B; Fri, 19 Sep 2025 14:16: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 10026) with ESMTP id vnaPEreKf0UY; Fri, 19 Sep 2025 14:16:19 -0600 (MDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1758312974; bh=XR9nBwY4fsnzVT1O8mn0nYoBibAK72N+a5DbulgfMa8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=FuASbl/qaAvLIAtpjNLosGkV4tEJdCx0mcoDcA9hklznXXAm2NUJtzfBIxV+WVPLo D8naWW6rVlCAWze1NrGjQCaY9/nEjdoZj2BuwNyb4f8nBDxR+LOSD/1L1PQrPQ2h50 9vlMd16PGY1cfubcYZiByvSQMs8UyQANBGF3f6HU20cYF3ZqzjmHRReIwcLjUGjjgR OoIEbVt1IRgMt7n15xl+AzcvQLTRX1rAXm+UaDRjL3ZaIhTSpBZfcSO/4Q7GaTCQcH M82rqs/A1YgrrCuOspuIcHEVHqgfpEHz7zaB7uOSOxi5E9EGH67RMnCQJOd/WLv0Ga UrJuR2KXdmEqQ== Received: from u-boot.org (unknown [73.34.74.121]) by mail.u-boot.org (Postfix) with ESMTPSA id 6D9CA67C58; Fri, 19 Sep 2025 14:16:14 -0600 (MDT) From: Simon Glass To: U-Boot Concept Date: Fri, 19 Sep 2025 14:14:23 -0600 Message-ID: <20250919201507.4024144-17-sjg@u-boot.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20250919201507.4024144-1-sjg@u-boot.org> References: <20250919201507.4024144-1-sjg@u-boot.org> MIME-Version: 1.0 Message-ID-Hash: BZGDFLDOMFPIC2P5QY2JGOH4VRUCXZNJ X-Message-ID-Hash: BZGDFLDOMFPIC2P5QY2JGOH4VRUCXZNJ 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 16/42] video: Convert to use uclass_id_foreach_dev() 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 Convert a few functions in the video uclass to use the new uclass_id_foreach_dev() macro. Signed-off-by: Simon Glass --- drivers/video/video-uclass.c | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) diff --git a/drivers/video/video-uclass.c b/drivers/video/video-uclass.c index 324817aa5ce..cd5c8dd8fad 100644 --- a/drivers/video/video-uclass.c +++ b/drivers/video/video-uclass.c @@ -127,15 +127,14 @@ static ulong alloc_fb(struct udevice *dev, ulong *addrp) int video_reserve(ulong *addrp) { struct udevice *dev; + struct uclass *uc; ulong size; if (IS_ENABLED(CONFIG_SPL_VIDEO_HANDOFF) && xpl_phase() == PHASE_BOARD_F) return 0; gd->video_top = *addrp; - for (uclass_find_first_device(UCLASS_VIDEO, &dev); - dev; - uclass_find_next_device(&dev)) { + uclass_id_foreach_dev(UCLASS_VIDEO, dev, uc) { size = alloc_fb(dev, addrp); debug("%s: Reserving %lx bytes at %lx for video device '%s'\n", __func__, size, *addrp, dev->name); @@ -539,11 +538,10 @@ int video_sync(struct udevice *vid, bool force) void video_sync_all(void) { struct udevice *dev; + struct uclass *uc; int ret; - for (uclass_find_first_device(UCLASS_VIDEO, &dev); - dev; - uclass_find_next_device(&dev)) { + uclass_id_foreach_dev(UCLASS_VIDEO, dev, uc) { if (device_active(dev)) { ret = video_sync(dev, true); if (ret) @@ -555,14 +553,13 @@ void video_sync_all(void) bool video_is_active(void) { struct udevice *dev; + struct uclass *uc; /* Assume video to be active if SPL passed video hand-off to U-boot */ if (IS_ENABLED(CONFIG_SPL_VIDEO_HANDOFF) && xpl_phase() > PHASE_SPL) return true; - for (uclass_find_first_device(UCLASS_VIDEO, &dev); - dev; - uclass_find_next_device(&dev)) { + uclass_id_foreach_dev(UCLASS_VIDEO, dev, uc) { if (device_active(dev)) return true; } From patchwork Fri Sep 19 20:14:24 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 359 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=1758312983; bh=w9ETM4OIAk3ZmFM1cYsjQJwmXPQWFsie8/vcUGfHXLk=; 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=WPenNMNSOwg0VRsz3N4aUKCSPK3foaqR9JVJBxtsqvqZ7Ty9wWhscRK9vIfu9emzm L4i9vM86F9wbuTRhWfRZb6yxouUgRa26LNWunz1KSy6z7QHuP8DmY0UL4i8BEbA1Jt m85HWSyPj8TSt6G6oSG3vgWBTNc93SaPYhihLDUI0FYTYTMjRNQzdrt19zTSi6cKUA hlxhxjRAyjVA/YumrjA+F4rhUydVBeiNcoenb31+R/JeClpdVE6gWMSh46QyIgC/U2 15ZkP3mzQbqQ+AKJxz4MoFmMA3MDLRQzYbj3hO4jkz7LZwOSdKHpXBD+RSEJON2K0B JEWJPxJn++OlQ== Received: from localhost (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id 1549C67C6C for ; Fri, 19 Sep 2025 14:16:23 -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 BSjcBnHSmN3k for ; Fri, 19 Sep 2025 14:16:23 -0600 (MDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1758312982; bh=w9ETM4OIAk3ZmFM1cYsjQJwmXPQWFsie8/vcUGfHXLk=; 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=su1ivgAjsowymm1lJF0ELrBln253o+OPTiT66K98HBcWMW3n65YuZaV0D6ghQ1m/H UOGKShh7uBa67+9FP/7JltHDuwi1OD/OVgZxPkMChLJRbHPcCDZfVudn4RkrUH0Jy/ dukZYFvtWa9Lb+NUyh29coPYJ1atVsuwDnOIdr3P8B7vTmaoa9tLCoN9nNZ2AFiIR1 FQqljIR3E+RC7M7BZkccxtJMQsobj7CSMPXx7ah5w6+r4ABxA53oVcCy3/oNZH/6ml UPtlMYJx5eyJXPX0CHIzM0YqF9ZJKb/xLJJzKhMaJvy6Kqd1S2bJ6LrizP5sdhvS0a 1RHWNc7jr0y3w== Received: from mail.u-boot.org (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id F1F5367C58 for ; Fri, 19 Sep 2025 14:16:22 -0600 (MDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1758312980; bh=5871fXo8lakSzbOuVDqY3FJecRzi74cWMJHm+dFb4BU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=W4DSMXXwzyTkZJTz72ESQZpAQfK0SfhGrxYpwJoX35o+3UXT7g8uYftHnAGcfGhgw 1wvQr8f1F7P9FLHXG8JguhSnv02vjhiRhhFKzORGqh/rtvZUtQVOMOta2M3ljYhfbi X8x5xf9BJ4o1Uyhwl4IUA8I6e5b7saWlEnul8jEJVuOXZ5IL/xtAH51jutc+QURusm /3zFyKWNs+dLp9NaGVKKvSEfXKRBFb9IiurCad8sVp8YeKDHKaPnUce96mA8gxeaL3 7fbBBoNMS4VeM1ATYnDSxiZewmxeMKqxHoPN88u9qmjqrdj+v+yV79UegUPOHp5iIo onjPKAUNX99+Q== Received: from localhost (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id D6A8567B3B; Fri, 19 Sep 2025 14:16: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 10026) with ESMTP id l1YFBf2uan5j; Fri, 19 Sep 2025 14:16:20 -0600 (MDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1758312979; bh=U0ZulDJEi08Z5TTuJQv1JSZO7Goo5B7F8SelNUQAX+I=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=bwzIARw0LfCsYCc9NbciRmmHrCvSX5uVwoyJSyDT5hiOx5UguipoITV8UjCOD2Lvv Ej/Ty9zNU4Dl5whzUW6xFOxmUVVi4XAuO3rvuO2lT9g7GHAyByaZFnru5FaWvbutSr 5exlf8hcK7MmEWkxX+Ijdu6T9XpSlSGfjQEcApdWYzQEXTOMqdfPbScHFLCYEsykGb nrWOzi3Uq2HZcemTTzkyoL3Aj5siQNEB1FUTYGD3tByd7KlJcc/mTtjN7PmgFqElaH clOeDWti+3414qHdYKDMxmqZ5N1IIqdQip+fqEOO6cUcxyWV+2dc46bMoMpR9KQXmi QSq9cWzojPISw== Received: from u-boot.org (unknown [73.34.74.121]) by mail.u-boot.org (Postfix) with ESMTPSA id 11EB067A99; Fri, 19 Sep 2025 14:16:19 -0600 (MDT) From: Simon Glass To: U-Boot Concept Date: Fri, 19 Sep 2025 14:14:24 -0600 Message-ID: <20250919201507.4024144-18-sjg@u-boot.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20250919201507.4024144-1-sjg@u-boot.org> References: <20250919201507.4024144-1-sjg@u-boot.org> MIME-Version: 1.0 Message-ID-Hash: VVGF36PVW73NCQTTW5R472APQBKIJHYP X-Message-ID-Hash: VVGF36PVW73NCQTTW5R472APQBKIJHYP 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 17/42] video: Provide an idle function for the console 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 way to tell the console that the machine is idle. This will be used (later) to show the cursor. Call the video console sync after that, so that any updates are shown. Keep the video_sync_all() for the case where CONFIG_CURSOR is not enabled, to reduce code size. Signed-off-by: Simon Glass --- drivers/video/vidconsole-uclass.c | 4 ++++ drivers/video/video-uclass.c | 15 ++++++++++++++- include/video_console.h | 7 +++++++ 3 files changed, 25 insertions(+), 1 deletion(-) diff --git a/drivers/video/vidconsole-uclass.c b/drivers/video/vidconsole-uclass.c index cb7212e9730..46fd355c05f 100644 --- a/drivers/video/vidconsole-uclass.c +++ b/drivers/video/vidconsole-uclass.c @@ -837,3 +837,7 @@ void vidconsole_set_bitmap_font(struct udevice *dev, } vc_priv->xstart_frac = 0; } + +void vidconsole_idle(struct udevice *dev) +{ +} diff --git a/drivers/video/video-uclass.c b/drivers/video/video-uclass.c index cd5c8dd8fad..be014a770d0 100644 --- a/drivers/video/video-uclass.c +++ b/drivers/video/video-uclass.c @@ -621,7 +621,20 @@ int video_default_font_height(struct udevice *dev) static void video_idle(struct cyclic_info *cyc) { - video_sync_all(); + if (CONFIG_IS_ENABLED(CURSOR)) { + struct udevice *cons; + struct uclass *uc; + + /* Handle cursor display for each video console */ + uclass_id_foreach_dev(UCLASS_VIDEO_CONSOLE, cons, uc) { + if (device_active(cons)) { + vidconsole_idle(cons); + video_sync(cons->parent, true); + } + } + } else { + video_sync_all(); + } } void video_set_white_on_black(struct udevice *dev, bool white_on_black) diff --git a/include/video_console.h b/include/video_console.h index 8cd1ccacb0f..842ead8d6a1 100644 --- a/include/video_console.h +++ b/include/video_console.h @@ -613,4 +613,11 @@ void vidconsole_set_quiet(struct udevice *dev, bool quiet); void vidconsole_set_bitmap_font(struct udevice *dev, struct video_fontdata *fontdata); +/* + * vidconsole_idle() - Handle periodic cursor display during idle time + * + * @dev: vidconsole device + */ +void vidconsole_idle(struct udevice *dev); + #endif From patchwork Fri Sep 19 20:14:25 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 360 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=1758312987; bh=NOQj4VFNfTTUsukAJesr8IqyogXSnR1wlRaYf5fyEPQ=; 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=U4vZhE3jYLHt0yltSKjfHXJTaFjDAC2wNIm4Rq/9+8UCk17R74zYPNdtvYMPlGFTC vTui8ZLp04KCdyjq+ELXC+T3AyQCc29uxwGOUYGXV8bHkA6yOT+0B8mHnbZOCUjag+ VGgvbGXVQIJVzqBnbo6hJrHAe9aYu96qguQ/SIVu0X77945pDnyxA4eG9L0gYmNizl scHakUnYmFXOXedon4cGqIK3P9Zw1MIrZfyNFT0K/cdRwvBMm1AIEo/DInZ/oT6eF7 mrWGOaLOLIGOUZN35KrdojkvxIJrmfay+t0Z3DpeZzYcNEl1ldmNLPrNxsAdmqwdUK yZOKpUQ1yMeJg== Received: from localhost (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id 6E53967C5B for ; Fri, 19 Sep 2025 14:16: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 Zyh779AMtOMj for ; Fri, 19 Sep 2025 14:16:27 -0600 (MDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1758312987; bh=NOQj4VFNfTTUsukAJesr8IqyogXSnR1wlRaYf5fyEPQ=; 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=U4vZhE3jYLHt0yltSKjfHXJTaFjDAC2wNIm4Rq/9+8UCk17R74zYPNdtvYMPlGFTC vTui8ZLp04KCdyjq+ELXC+T3AyQCc29uxwGOUYGXV8bHkA6yOT+0B8mHnbZOCUjag+ VGgvbGXVQIJVzqBnbo6hJrHAe9aYu96qguQ/SIVu0X77945pDnyxA4eG9L0gYmNizl scHakUnYmFXOXedon4cGqIK3P9Zw1MIrZfyNFT0K/cdRwvBMm1AIEo/DInZ/oT6eF7 mrWGOaLOLIGOUZN35KrdojkvxIJrmfay+t0Z3DpeZzYcNEl1ldmNLPrNxsAdmqwdUK yZOKpUQ1yMeJg== Received: from mail.u-boot.org (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id 5E3D567C0E for ; Fri, 19 Sep 2025 14:16:27 -0600 (MDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1758312985; bh=niEPNAq30k+Dx8HkewBfxM0oeXtVx9Q6GRM8UN4CfZE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=aWWfnIkHbrs7iNSczw5z0p7IpBq1zzFb4xfQWiohWjGaSDITIF858WzLVBowT8GCR dPp9cWG4eKziXiqFDBWMjuN7A+RjWG3qGQHq+FqXgQRJjZhm9/WmFPG//qGs9KSP2/ UTWh0PV5xE5zZlp5hDVbDD7BIL+laIq71XW8qn6uk4TBxyZa4TeH6s9S6j2mYY6G8+ FsXl/LOnlz2GxidLTIWqlBPDCbJMmMCYmY7YqAVTl7FSij+GIvCr0XwBmO02rfyx4y Tbq+3JboTC+fKx8TAFDgClXKTxWxA2f86XbYX+udwHLicv0U2Y5xZ7XlGn9N2x6tQ0 wHSv9RzK+YwqQ== Received: from localhost (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id 8592167B55; Fri, 19 Sep 2025 14:16:25 -0600 (MDT) X-Virus-Scanned: Debian amavis at Received: from mail.u-boot.org ([127.0.0.1]) by localhost (mail.u-boot.org [127.0.0.1]) (amavis, port 10026) with ESMTP id KHshzicGBlQq; Fri, 19 Sep 2025 14:16:25 -0600 (MDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1758312981; bh=IOcWa51u1ktTWzknzHb9AA9L3/IKjc8E8HGwm7us39M=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=EL8s2A16rXu97UU6v9yLV+n48TNEzDZr0CEZ6x6k+DoORLOPufQFENnhyw/UTyOWM 3+feZU1G2i+j0AE6rC+iuPZJZRBk6N31b2TQ8MiVMmXh7dIinqhHvWDKc1UsINlUWK S0vT9ge0/5jqJSHEt9nMUGJ2O6LfdFSAJC2G70wvs09guxCtlK1SXKayVME5aMkKjt G5cz5az/rLiUwUG2qpIbvrcP12eSc1bMTiI2MVoEH5Dp8qx3ZIaJev5HWGtsssEjJs WytkEP5AQpqqRARS7OgJcNvUSBRKJzzk1L4dIG/AoWOFpHbcx2MAIOIcSLZvGmKf2j veh8YOHrq5AOQ== Received: from u-boot.org (unknown [73.34.74.121]) by mail.u-boot.org (Postfix) with ESMTPSA id 293CD67A99; Fri, 19 Sep 2025 14:16:21 -0600 (MDT) From: Simon Glass To: U-Boot Concept Date: Fri, 19 Sep 2025 14:14:25 -0600 Message-ID: <20250919201507.4024144-19-sjg@u-boot.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20250919201507.4024144-1-sjg@u-boot.org> References: <20250919201507.4024144-1-sjg@u-boot.org> MIME-Version: 1.0 Message-ID-Hash: WTRPVMFZM4NSXDIXLE6JWV2WGG4I7N56 X-Message-ID-Hash: WTRPVMFZM4NSXDIXLE6JWV2WGG4I7N56 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 18/42] video: Provide state for the cursor 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 We need to keep track of various things with the cursor, so create a separate struct within the console. Add some Signed-off-by: Simon Glass --- include/video_console.h | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/include/video_console.h b/include/video_console.h index 842ead8d6a1..ba34bb8e19f 100644 --- a/include/video_console.h +++ b/include/video_console.h @@ -23,6 +23,28 @@ enum { VIDCONSOLE_CURSOR_WIDTH = 2, }; +/** + * struct vidconsole_cursor - cursor state for a video console + * + * The cursor is set up and maintained by the vidconsole. It is a simple + * vertical bar of width VIDCONSOLE_CURSOR_WIDTH shown in the foreground colour. + * + * @visible: cursor is currently visible + * @x: cursor left X position in pixels + * @y: cursor top Y position in pixels + * @height: height of cursor in pixels + * @index: cursor index within the CLI or field being edited + */ +struct vidconsole_cursor { + bool visible; + + /* filled in by get_cursor_info(): */ + uint x; + uint y; + uint height; + uint index; +}; + /** * struct vidconsole_priv - uclass-private data about a console device * @@ -55,6 +77,7 @@ enum { * @escape_buf: Buffer to accumulate escape sequence * @utf8_buf: Buffer to accumulate UTF-8 byte sequence * @quiet: Suppress all output from stdio + * @curs: Cursor state and management */ struct vidconsole_priv { struct stdio_dev sdev; @@ -80,6 +103,7 @@ struct vidconsole_priv { char escape_buf[32]; char utf8_buf[5]; bool quiet; + struct vidconsole_cursor curs; }; /** From patchwork Fri Sep 19 20:14:26 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 361 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=1758312991; bh=oVrwAsombae6NCOHBsRbKr8N4GtmjVxLa6lVSE8RFgA=; 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=DgLii/XcLB5qnlrw8/jMwxEXGIDUE9K9/9hvmyD6zcBiM4fDe8wtjDcOMmGNXGMTN s/T2wkrv9RIUj5EZl9nzSMIeHh4ZGu99bQkJOpZr7wYEXMIoLVVmZpaPjh9eD8hKwd jaLvQzQ4nT/JX9g3mN4VA5OQJtC81Gkk5KvsCewjxYfAZ1swseJh7o03GBGZZiw5h9 fs0EJzbA6jgWZ6GKkVFRVBfCtxiDKZdrar7rfqWpjMir40HwNDk98ZYju/c4neWHut p2QOd6/rRIsm46anfPUMvUSsvoMd2N35a/+Q0OZba8NC/cJhyYSNk1LKWWTCg7Jqqm TzAq7yI/waZQw== Received: from localhost (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id C957A67C5B for ; Fri, 19 Sep 2025 14:16:31 -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 tfQFzaArFIl4 for ; Fri, 19 Sep 2025 14:16:31 -0600 (MDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1758312991; bh=oVrwAsombae6NCOHBsRbKr8N4GtmjVxLa6lVSE8RFgA=; 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=DgLii/XcLB5qnlrw8/jMwxEXGIDUE9K9/9hvmyD6zcBiM4fDe8wtjDcOMmGNXGMTN s/T2wkrv9RIUj5EZl9nzSMIeHh4ZGu99bQkJOpZr7wYEXMIoLVVmZpaPjh9eD8hKwd jaLvQzQ4nT/JX9g3mN4VA5OQJtC81Gkk5KvsCewjxYfAZ1swseJh7o03GBGZZiw5h9 fs0EJzbA6jgWZ6GKkVFRVBfCtxiDKZdrar7rfqWpjMir40HwNDk98ZYju/c4neWHut p2QOd6/rRIsm46anfPUMvUSsvoMd2N35a/+Q0OZba8NC/cJhyYSNk1LKWWTCg7Jqqm TzAq7yI/waZQw== Received: from mail.u-boot.org (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id B8F7A67BB6 for ; Fri, 19 Sep 2025 14:16:31 -0600 (MDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1758312989; bh=A2eLhe2XttH+PEvs3tgLS27TL0LWb346T4QtTBiDrAE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=KmAHBbS43eL36E5q59RSGszW5SrEeVhrB6pCFoMc727PBD6eoIyYOwwNqi65m3M6Z jWwkVTAMfPf1oK0H4544W+nwg9vXqowagXr6734KEFntpgQPTwGnHbJ1HW5BO9jGAh zYFb7oFDr/w+xnv/ytxPxsg5TfNhR8AeBGf4jD8x213XVOjrTurwMJ0GJvNXR90zL+ zJAs/rxYKCd/HWoSnKMVwnI3yCysuToTKu4OfsMPf+VtQOk1ur44yICGaf8uDDSw5Y tfgBNvBWPWCQQZ+dQCYwU9BL+2FPae2d+CCQ4eI6yAmzdnUHs/vfBnzKm1fqcv2G/r GiOo1iIomvyrQ== Received: from localhost (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id C5DD467BB6; Fri, 19 Sep 2025 14:16: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 10026) with ESMTP id 7hFgpzDO3-YC; Fri, 19 Sep 2025 14:16:29 -0600 (MDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1758312986; bh=Sxj5ZK5Pv8te8oJarveBcFUNAdtXbsfa7G9TKQgnlHE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ksMgqXezMiV0SuhGKT7ygOSUT6j4LDCYRhCmZKmuOODqaWTSipac/l8JzBjoupz1B enXEInYL8GOmdyYpLD2ZMp8Tj5cS59c6tnxHdHQ7mC96j98onrXo5ezG5o0mekKQMM yQoxOMUrTuoOJK28SN73n7MqjjGdsQh8ELQZQ7Ar6wFaAjL4/V/Nlyf3AkuhSEIS74 KVNgRUqany1engVMp2aKhQNl3bVJ4r1uMIt3D+1qirS4TfhZB3c94jT4ew2WDGrbyH gJz1AhJkO998a1Tmrg3HmS47TAbihzpqI9RNuaOxfah0EvhgKsHV/BvTtqrqWSkAmb MQSYzP8jbel1w== Received: from u-boot.org (unknown [73.34.74.121]) by mail.u-boot.org (Postfix) with ESMTPSA id CDD7967A99; Fri, 19 Sep 2025 14:16:25 -0600 (MDT) From: Simon Glass To: U-Boot Concept Date: Fri, 19 Sep 2025 14:14:26 -0600 Message-ID: <20250919201507.4024144-20-sjg@u-boot.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20250919201507.4024144-1-sjg@u-boot.org> References: <20250919201507.4024144-1-sjg@u-boot.org> MIME-Version: 1.0 Message-ID-Hash: KEVS2MQIFTDA3RALURAJ43NK5GLKWDO6 X-Message-ID-Hash: KEVS2MQIFTDA3RALURAJ43NK5GLKWDO6 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 19/42] video: Rename draw_cursor_vertically() to cursor_show() 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 For now the cursor is always vertical, so part of this name is redundant. Rename it to cursor_show(), which is what it does. We will eventually have a cursor_hide() to match it. Signed-off-by: Simon Glass --- drivers/video/console_core.c | 5 +++-- drivers/video/console_normal.c | 3 +-- drivers/video/console_truetype.c | 2 +- drivers/video/vidconsole_internal.h | 6 +++--- 4 files changed, 8 insertions(+), 8 deletions(-) diff --git a/drivers/video/console_core.c b/drivers/video/console_core.c index aec51dc809d..36e7f81dc0a 100644 --- a/drivers/video/console_core.c +++ b/drivers/video/console_core.c @@ -160,8 +160,8 @@ int fill_char_horizontally(uchar *pfont, void **line, struct video_priv *vid_pri return ret; } -int draw_cursor_vertically(void **line, struct video_priv *vid_priv, - uint height, bool direction) +int cursor_show(void **line, struct video_priv *vid_priv, uint height, + bool direction) { int step, line_step, pbytes, ret; uint value; @@ -188,6 +188,7 @@ int draw_cursor_vertically(void **line, struct video_priv *vid_priv, fill_pixel_and_goto_next(&dst, value, pbytes, step); *line += line_step; } + return ret; } diff --git a/drivers/video/console_normal.c b/drivers/video/console_normal.c index 68d47eb8da6..3865870dcd5 100644 --- a/drivers/video/console_normal.c +++ b/drivers/video/console_normal.c @@ -99,8 +99,7 @@ static int __maybe_unused console_set_cursor_visible(struct udevice *dev, start = vid_priv->fb + y * vid_priv->line_length + x * pbytes; line = start; - draw_cursor_vertically(&line, vid_priv, vc_priv->y_charsize, - NORMAL_DIRECTION); + cursor_show(&line, vid_priv, vc_priv->y_charsize, NORMAL_DIRECTION); return 0; } diff --git a/drivers/video/console_truetype.c b/drivers/video/console_truetype.c index fb7f70a4b2a..babab5eb2c3 100644 --- a/drivers/video/console_truetype.c +++ b/drivers/video/console_truetype.c @@ -1032,7 +1032,7 @@ static int truetype_set_cursor_visible(struct udevice *dev, bool visible, x * VNBYTES(vid_priv->bpix); /* Use the shared cursor drawing function */ - draw_cursor_vertically(&line, vid_priv, height, NORMAL_DIRECTION); + cursor_show(&line, vid_priv, height, NORMAL_DIRECTION); video_damage(dev->parent, x, y, VIDCONSOLE_CURSOR_WIDTH, height); diff --git a/drivers/video/vidconsole_internal.h b/drivers/video/vidconsole_internal.h index af2cca8791c..02b73296292 100644 --- a/drivers/video/vidconsole_internal.h +++ b/drivers/video/vidconsole_internal.h @@ -96,7 +96,7 @@ int fill_char_horizontally(uchar *pfont, void **line, struct video_priv *vid_pri struct video_fontdata *fontdata, bool direction); /** - * draw_cursor_vertically() - Draw a simple vertical cursor + * cursor_show() - Draw a simple vertical cursor * * @line: pointer to framebuffer buffer: upper left cursor corner * @vid_priv: driver private data @@ -116,8 +116,8 @@ int fill_char_horizontally(uchar *pfont, void **line, struct video_priv *vid_pri * * Return: 0, if success, or else error code. */ -int draw_cursor_vertically(void **line, struct video_priv *vid_priv, - uint height, bool direction); +int cursor_show(void **line, struct video_priv *vid_priv, uint height, + bool direction); /** * console probe function. From patchwork Fri Sep 19 20:14:27 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 362 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=1758312997; bh=C5SOXqp3yQv8WIvO47efV/FeFx7HjhvgfJ9cALPsOxU=; 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=dBcJOc0usdn18dkerBxk49D7m0mxRxrWVogchDZkcz2r/aF7P5jnLbzG9HwzzP3cl itrsUwFFLFcb3RF65KGZlXOoCXd3zVgR+Ze2GV28/1dbjoXOwR7RJR5ae67IzzCgiK EGMbKA8ww/wsDBicHhkihQ6tXw4U2hzz92MUzYYIWA9nIRnX8I31hYh9PsAkbQTzFm WmDo0FbkAL+T2BJkXAosz4CWLROWd8bVHbX1bD5slM2nGy/RvbgrGCCbSIgshmGdfL YlMkKYolUD/c1lNCfP++9sWVgkcfaOnfX2Cqxz9GBeDfaHTN43BjbiIiEXdtjxT8aS 5cLBIPVR0dPgQ== Received: from localhost (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id 2FC2767C5B for ; Fri, 19 Sep 2025 14:16: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 Dz6_uSy0CJJd for ; Fri, 19 Sep 2025 14:16:37 -0600 (MDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1758312997; bh=C5SOXqp3yQv8WIvO47efV/FeFx7HjhvgfJ9cALPsOxU=; 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=dBcJOc0usdn18dkerBxk49D7m0mxRxrWVogchDZkcz2r/aF7P5jnLbzG9HwzzP3cl itrsUwFFLFcb3RF65KGZlXOoCXd3zVgR+Ze2GV28/1dbjoXOwR7RJR5ae67IzzCgiK EGMbKA8ww/wsDBicHhkihQ6tXw4U2hzz92MUzYYIWA9nIRnX8I31hYh9PsAkbQTzFm WmDo0FbkAL+T2BJkXAosz4CWLROWd8bVHbX1bD5slM2nGy/RvbgrGCCbSIgshmGdfL YlMkKYolUD/c1lNCfP++9sWVgkcfaOnfX2Cqxz9GBeDfaHTN43BjbiIiEXdtjxT8aS 5cLBIPVR0dPgQ== Received: from mail.u-boot.org (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id 1F42267BB6 for ; Fri, 19 Sep 2025 14:16:37 -0600 (MDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1758312994; bh=N/RVMIx6JnJryjvrNVrzFRFXDuHzj4rameTkCSgLRow=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=DFPfgb0mgI6mLr22Zitfnthw09ceBWHYpL9AM+dt8ytPR9lb2sYCDcGSZ1EJVI9rv k3LQ3QjfhvVFsUn8V80XC6ByQLntAPh27DV5an821e8T8Wn0MAQorE1HJ9ajEcUw5y LXlDL14fTsWN6AD5Tkti1i4n9kxMHrujTe6H/Eo2Vzct5Dz1/QzFOI80MHOLHt5BQi oIdmDJEpgG7JkghQLN0sCy2EgVNKkqz4+X3TrFDeziweLoCJ9Ps9SiKW/wHMDAJEyF F3wj68xPpc9eQCfT6DBqF79HKVWhoH5RVX2qL+gqOkzEbnKSH6mTJP8VmnSAYzrJMJ WndStTJSoKdHg== Received: from localhost (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id 24CB367BB6; Fri, 19 Sep 2025 14:16: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 B7ivktfYziGy; Fri, 19 Sep 2025 14:16:34 -0600 (MDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1758312988; bh=5Ac1ALTj0gKvEXOLmXoxk/HdC9Bdzob7g0jxEpZEthc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=HWGxZ+rYJResGfaRBKwjKW9NNOpkrXhkmmmGcSox88oSK1JJHwYkiZkdejJBltC2U khca1OQyrYoHimljU/kIpQ1LR85lE4pNa02rTnceZp/Fj8kCTbKoqHxlubZGj0gDml HY2x9gDMhFdX97CsOBdXhVJdKHxWWsSUAje8WWxNkmtivIGMBSG8sZ1DJBYVHFbcvt ifp3iXXKn+VL7Op5K9ruQTF24Qu3larBjQhkQ9anEeds/MEOh5YPZtg7cVEWH3Okfq yq7dW7ufias3fMyLPTJS8N0PKXF/Yne+X9+fgwjXE1iutuezLtIHjDkOKl0EdDozA2 nE1xjuGyGi3Ug== Received: from u-boot.org (unknown [73.34.74.121]) by mail.u-boot.org (Postfix) with ESMTPSA id E15BF67B3B; Fri, 19 Sep 2025 14:16:27 -0600 (MDT) From: Simon Glass To: U-Boot Concept Date: Fri, 19 Sep 2025 14:14:27 -0600 Message-ID: <20250919201507.4024144-21-sjg@u-boot.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20250919201507.4024144-1-sjg@u-boot.org> References: <20250919201507.4024144-1-sjg@u-boot.org> MIME-Version: 1.0 Message-ID-Hash: ZXYXGLGHPTYD4SIOD75OH3YJT2YGKZA7 X-Message-ID-Hash: ZXYXGLGHPTYD4SIOD75OH3YJT2YGKZA7 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 20/42] video: Update cursor_show() to take a simple pointer List-Id: Discussion and patches related to U-Boot Concept Archived-At: List-Archive: List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: From: Simon Glass We don't need to pass a pointer to a pointer, so just pass a normal pointer. This is simpler to understand. Signed-off-by: Simon Glass --- drivers/video/console_core.c | 6 +++--- drivers/video/console_normal.c | 5 ++--- drivers/video/console_truetype.c | 2 +- drivers/video/vidconsole_internal.h | 2 +- 4 files changed, 7 insertions(+), 8 deletions(-) diff --git a/drivers/video/console_core.c b/drivers/video/console_core.c index 36e7f81dc0a..575d0bfe2b8 100644 --- a/drivers/video/console_core.c +++ b/drivers/video/console_core.c @@ -160,7 +160,7 @@ int fill_char_horizontally(uchar *pfont, void **line, struct video_priv *vid_pri return ret; } -int cursor_show(void **line, struct video_priv *vid_priv, uint height, +int cursor_show(void *line, struct video_priv *vid_priv, uint height, bool direction) { int step, line_step, pbytes, ret; @@ -183,10 +183,10 @@ int cursor_show(void **line, struct video_priv *vid_priv, uint height, value = vid_priv->colour_fg; for (int row = 0; row < height; row++) { - dst = *line; + dst = line; for (int col = 0; col < VIDCONSOLE_CURSOR_WIDTH; col++) fill_pixel_and_goto_next(&dst, value, pbytes, step); - *line += line_step; + line += line_step; } return ret; diff --git a/drivers/video/console_normal.c b/drivers/video/console_normal.c index 3865870dcd5..315d3daa5ce 100644 --- a/drivers/video/console_normal.c +++ b/drivers/video/console_normal.c @@ -85,7 +85,7 @@ static int __maybe_unused console_set_cursor_visible(struct udevice *dev, struct console_simple_priv *priv = dev_get_priv(dev); struct video_fontdata *fontdata = priv->fontdata; int pbytes = VNBYTES(vid_priv->bpix); - void *start, *line; + void *start; /* for now, this is not used outside expo */ if (!IS_ENABLED(CONFIG_EXPO)) @@ -98,8 +98,7 @@ static int __maybe_unused console_set_cursor_visible(struct udevice *dev, x -= 1; start = vid_priv->fb + y * vid_priv->line_length + x * pbytes; - line = start; - cursor_show(&line, vid_priv, vc_priv->y_charsize, NORMAL_DIRECTION); + cursor_show(start, vid_priv, vc_priv->y_charsize, NORMAL_DIRECTION); return 0; } diff --git a/drivers/video/console_truetype.c b/drivers/video/console_truetype.c index babab5eb2c3..eedc285903b 100644 --- a/drivers/video/console_truetype.c +++ b/drivers/video/console_truetype.c @@ -1032,7 +1032,7 @@ static int truetype_set_cursor_visible(struct udevice *dev, bool visible, x * VNBYTES(vid_priv->bpix); /* Use the shared cursor drawing function */ - cursor_show(&line, vid_priv, height, NORMAL_DIRECTION); + cursor_show(line, vid_priv, height, NORMAL_DIRECTION); video_damage(dev->parent, x, y, VIDCONSOLE_CURSOR_WIDTH, height); diff --git a/drivers/video/vidconsole_internal.h b/drivers/video/vidconsole_internal.h index 02b73296292..0654a8f98e6 100644 --- a/drivers/video/vidconsole_internal.h +++ b/drivers/video/vidconsole_internal.h @@ -116,7 +116,7 @@ int fill_char_horizontally(uchar *pfont, void **line, struct video_priv *vid_pri * * Return: 0, if success, or else error code. */ -int cursor_show(void **line, struct video_priv *vid_priv, uint height, +int cursor_show(void *line, struct video_priv *vid_priv, uint height, bool direction); /** From patchwork Fri Sep 19 20:14:28 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 363 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=1758312999; bh=YCE/y4iXP+/iSRQgmkw3Gi2b1wmn51YpKHBVAVkHNTk=; 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=M1NeULrN9Thi4rrFy54HDM1Ux4S+0KDsrXmrkWEniMRAANV1G5MtlZIcsJpQwyle7 70t5bS+8sBf3JJiC4il7D5oywJysNteT2vBppr/IUomBKyFitX+ArxB9C8RftR1moo SxPmvd01wfHP4t231W0Nl8RExgAssRFz13dePLzK85mIAw+fyjOa18yLG3n3wy1BkH YbXKNd0N96sBiS03ZvbQ1hTg0Q7pttBhqz4m+zTz3t9mOsHggZQVis7Ty1KJSK1X63 FvmytO6W3fBoqIEEwcCuL/0L4EbyYKJOQ5sTrXS+CNs2PcRmpWDpsJvYygpYX/8/Bd TeQQG+e6BgDaw== Received: from localhost (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id 8305867C5B for ; Fri, 19 Sep 2025 14:16: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 Xc970FDAHGLB for ; Fri, 19 Sep 2025 14:16:39 -0600 (MDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1758312997; bh=YCE/y4iXP+/iSRQgmkw3Gi2b1wmn51YpKHBVAVkHNTk=; 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=rTdN+bx3uORtJgc8NR3Rs6tZ5WO1Yv8z9AFqUs2WlsKyfhLoBu13lnVvdpTBwJmPC BMf7QfLNktVbWDIc4MA/f7MLtJhlAINMuBDPzn6V9vZyNj4WnD+yptH1QKhxlreeVp qDYE3AxZavfZSI/AeCGOcaBX5hnWvLtq2NpSTYjcI7tta7ji7JivWh0k4x14EyQAPW 4W4ySZ+79yqr2b94irAIl4eUlSVO4jootCnDXJ7ZyayLL12GHL+P8HoS0UJTdke8sT 4rns6e/aH6zcc5HBzxLolNl5S3krj4RjfCOeUvkA+pRwnyFJyS9KDg6cudJLjjCcZP kq/Gii6z1xU1A== Received: from mail.u-boot.org (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id 774F167BB6 for ; Fri, 19 Sep 2025 14:16:37 -0600 (MDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1758312994; bh=MGvCbHctLq4RgU+JLHOdBXkvEZmwDPfSeU1nweP+kcQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=mbNt63jpaBvPwA8eLCwcZOpV8JAntWJykeyJJK5HFdQGH4P8kfESRAZEXkVBeZtsK IcyDALQg+KpRkgK5EZ7H+l2p+076+aeKkhfzpjTCRMf6HR0QFiMF0SA4HyclAffuZY pKJ0G94MXxUf3zthXcwI9AZF9vyLNXzFoJmk6yTtvBxqlkT3/5+mIIaeRS/3a5Z/bD EoDRkggboUMpECUkQxKdOgiTstyTGzTodbtz4tihGe7UyPisvDxiti8FEzGiUs/paH P8qH3vqL+ireIzPthEpW9P2z5x8Ilz0b+hp6CSz/W3/FfmDu/pfq3He+Ftm6tchNyF mKGCgHoMBa5uw== Received: from localhost (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id 5D3F167B3B; Fri, 19 Sep 2025 14:16: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 5mDoGvjxjhCs; Fri, 19 Sep 2025 14:16:34 -0600 (MDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1758312992; bh=zVzCdpym2G1+1NmPS+eaMKlYbB7TxUFha5wdTn9JgVE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ZYE5s2R+s4/f2N1WLInMa8rBhG6m4glMTUyfSq9CPX75FczCv0KzC9rdi77cZbokB yeVwTJpKlKODfyu1R/8PEI1RPcBWETVq7dDmSUWavpiCbjXR0w/CPKYoU1Lks05Etr 6mnEz9iUcoJV1i93Up231GNqLU5f8UpaYg8CiPLow6j80OgidEiXFd5ASPo8jSJ+28 M/2n4mmptHHU2w9a3ed2rNzcFrWeigczSecvslAgQeef4tU/KP7LvDtyex2FLYfTDk 9HU2vAa2PKmYq+fva+kgmFqiSPSRh9KM19J6177zM2iPqAZxzZ1pu8WnUQ2jmnQXkt udxifD2h1B2Qg== Received: from u-boot.org (unknown [73.34.74.121]) by mail.u-boot.org (Postfix) with ESMTPSA id 84F4D67A99; Fri, 19 Sep 2025 14:16:32 -0600 (MDT) From: Simon Glass To: U-Boot Concept Date: Fri, 19 Sep 2025 14:14:28 -0600 Message-ID: <20250919201507.4024144-22-sjg@u-boot.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20250919201507.4024144-1-sjg@u-boot.org> References: <20250919201507.4024144-1-sjg@u-boot.org> MIME-Version: 1.0 Message-ID-Hash: 4NBQNKJVN263ACCDQWNLQTOYVFWYF6JK X-Message-ID-Hash: 4NBQNKJVN263ACCDQWNLQTOYVFWYF6JK 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 21/42] video: Move cursor drawing into the uclass List-Id: Discussion and patches related to U-Boot Concept Archived-At: List-Archive: List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: From: Simon Glass Rather than having the truetype driver draw the cursor, make it just return the information needed to draw the cursor. This will make it possible for the normal console to support a cursor too. Add a check for the cursor being entirely within the framebuffer. Signed-off-by: Simon Glass --- drivers/video/console_core.c | 14 +++++--- drivers/video/console_normal.c | 18 ++++++---- drivers/video/console_truetype.c | 42 ++++++++++-------------- drivers/video/vidconsole-uclass.c | 51 +++++++++++++++++++++++++---- drivers/video/vidconsole_internal.h | 14 +++++--- include/video_console.h | 29 +++++++++++++--- 6 files changed, 119 insertions(+), 49 deletions(-) diff --git a/drivers/video/console_core.c b/drivers/video/console_core.c index 575d0bfe2b8..6db42e63ea9 100644 --- a/drivers/video/console_core.c +++ b/drivers/video/console_core.c @@ -160,12 +160,12 @@ int fill_char_horizontally(uchar *pfont, void **line, struct video_priv *vid_pri return ret; } -int cursor_show(void *line, struct video_priv *vid_priv, uint height, +int cursor_show(struct vidconsole_cursor *curs, struct video_priv *vid_priv, bool direction) { int step, line_step, pbytes, ret; + void *line, *dst; uint value; - void *dst; ret = check_bpix_support(vid_priv->bpix); if (ret) @@ -180,16 +180,22 @@ int cursor_show(void *line, struct video_priv *vid_priv, uint height, line_step = vid_priv->line_length; } + /* Figure out where to write the cursor in the frame buffer */ + line = vid_priv->fb + curs->y * vid_priv->line_length + + curs->x * VNBYTES(vid_priv->bpix); + value = vid_priv->colour_fg; - for (int row = 0; row < height; row++) { + for (int row = 0; row < curs->height; row++) { dst = line; + for (int col = 0; col < VIDCONSOLE_CURSOR_WIDTH; col++) fill_pixel_and_goto_next(&dst, value, pbytes, step); + line += line_step; } - return ret; + return 0; } int console_probe(struct udevice *dev) diff --git a/drivers/video/console_normal.c b/drivers/video/console_normal.c index 315d3daa5ce..ad7eb4661a4 100644 --- a/drivers/video/console_normal.c +++ b/drivers/video/console_normal.c @@ -75,17 +75,18 @@ int console_normal_putc_xy(struct udevice *dev, uint x_frac, uint y, int cp) return console_fixed_putc_xy(dev, x_frac, y, cp, priv->fontdata); } -static int __maybe_unused console_set_cursor_visible(struct udevice *dev, - bool visible, uint x, - uint y, uint index) +static __maybe_unused int console_get_cursor_info(struct udevice *dev, + bool visible, uint x, uint y, + uint index) { struct vidconsole_priv *vc_priv = dev_get_uclass_priv(dev); struct udevice *vid = dev->parent; struct video_priv *vid_priv = dev_get_uclass_priv(vid); struct console_simple_priv *priv = dev_get_priv(dev); struct video_fontdata *fontdata = priv->fontdata; + struct vidconsole_cursor *curs = &vc_priv->curs; int pbytes = VNBYTES(vid_priv->bpix); - void *start; + void *start, *line; /* for now, this is not used outside expo */ if (!IS_ENABLED(CONFIG_EXPO)) @@ -98,7 +99,12 @@ static int __maybe_unused console_set_cursor_visible(struct udevice *dev, x -= 1; start = vid_priv->fb + y * vid_priv->line_length + x * pbytes; - cursor_show(start, vid_priv, vc_priv->y_charsize, NORMAL_DIRECTION); + line = start; + + /* Store line pointer and height in cursor struct */ + curs->x = x; + curs->y = y; + curs->height = vc_priv->y_charsize; return 0; } @@ -116,7 +122,7 @@ struct vidconsole_ops console_ops = { .get_font = console_simple_get_font, .select_font = console_simple_select_font, #ifdef CONFIG_CURSOR - .set_cursor_visible = console_set_cursor_visible, + .get_cursor_info = console_get_cursor_info, #endif }; diff --git a/drivers/video/console_truetype.c b/drivers/video/console_truetype.c index eedc285903b..eee4ea2e2a9 100644 --- a/drivers/video/console_truetype.c +++ b/drivers/video/console_truetype.c @@ -993,33 +993,30 @@ static int truetype_entry_restore(struct udevice *dev, struct abuf *buf) return 0; } -static int truetype_set_cursor_visible(struct udevice *dev, bool visible, - uint x, uint y, uint index) +static int truetype_get_cursor_info(struct udevice *dev, bool visible, + uint x, uint y, uint index) { struct vidconsole_priv *vc_priv = dev_get_uclass_priv(dev); - struct udevice *vid = dev->parent; - struct video_priv *vid_priv = dev_get_uclass_priv(vid); struct console_tt_priv *priv = dev_get_priv(dev); - void *line; + struct vidconsole_cursor *curs = &vc_priv->curs; uint height; if (xpl_phase() <= PHASE_SPL) return -ENOSYS; - if (!visible) - return 0; - /* * figure out where to place the cursor. This driver ignores the * passed-in values, since an entry_restore() must have been done before * calling this function. */ - if (index < priv->pos_ptr) - x = VID_TO_PIXEL(priv->pos[index].xpos_frac); - else - x = VID_TO_PIXEL(vc_priv->xcur_frac); - - y = vc_priv->ycur; + if (visible) { + index = priv->pos_ptr; + if (index < priv->pos_ptr) + x = VID_TO_PIXEL(priv->pos[index].xpos_frac); + else + x = VID_TO_PIXEL(vc_priv->xcur_frac); + y = vc_priv->ycur; + } /* Get font height from current font type */ if (priv->cur_fontdata) @@ -1027,16 +1024,13 @@ static int truetype_set_cursor_visible(struct udevice *dev, bool visible, else height = priv->cur_met->font_size; - /* Figure out where to write the cursor in the frame buffer */ - line = vid_priv->fb + y * vid_priv->line_length + - x * VNBYTES(vid_priv->bpix); - - /* Use the shared cursor drawing function */ - cursor_show(line, vid_priv, height, NORMAL_DIRECTION); + /* Store line pointer and height in cursor struct */ + curs->x = x; + curs->y = y; + curs->index = index; + curs->height = height; - video_damage(dev->parent, x, y, VIDCONSOLE_CURSOR_WIDTH, height); - - return video_sync(vid, true); + return 0; } const char *console_truetype_get_font_size(struct udevice *dev, uint *sizep) @@ -1101,7 +1095,7 @@ struct vidconsole_ops console_truetype_ops = { .nominal = truetype_nominal, .entry_save = truetype_entry_save, .entry_restore = truetype_entry_restore, - .set_cursor_visible = truetype_set_cursor_visible + .get_cursor_info = truetype_get_cursor_info, }; U_BOOT_DRIVER(vidconsole_truetype) = { diff --git a/drivers/video/vidconsole-uclass.c b/drivers/video/vidconsole-uclass.c index 46fd355c05f..479793bc227 100644 --- a/drivers/video/vidconsole-uclass.c +++ b/drivers/video/vidconsole-uclass.c @@ -17,6 +17,7 @@ #include #include #include +#include "vidconsole_internal.h" #include /* Bitmap font for code page 437 */ #include @@ -702,21 +703,59 @@ int vidconsole_entry_restore(struct udevice *dev, struct abuf *buf) } #ifdef CONFIG_CURSOR -int vidconsole_set_cursor_visible(struct udevice *dev, bool visible, - uint x, uint y, uint index) +int vidconsole_show_cursor(struct udevice *dev, uint x, uint y, uint index) { + struct vidconsole_priv *priv = dev_get_uclass_priv(dev); struct vidconsole_ops *ops = vidconsole_get_ops(dev); + struct vidconsole_cursor *curs = &priv->curs; int ret; - if (ops->set_cursor_visible) { - ret = ops->set_cursor_visible(dev, visible, x, y, index); - if (ret != -ENOSYS) + /* find out where the cursor should be drawn */ + if (ops->get_cursor_info) { + ret = ops->get_cursor_info(dev, true, x, y, index); + if (ret && ret != -ENOSYS) + return ret; + } + + /* If the driver stored cursor line and height, use them for drawing */ + if (curs->height) { + struct udevice *vid = dev_get_parent(dev); + struct video_priv *vid_priv = dev_get_uclass_priv(vid); + + /* + * avoid drawing off the display - we assume that the driver + * ensures that curs->y < vid_priv->ysize + */ + curs->height = min(curs->height, vid_priv->ysize - curs->y); + + ret = cursor_show(curs, vid_priv, NORMAL_DIRECTION); + if (ret) + return ret; + + /* Update display damage for cursor area */ + video_damage(vid, curs->x, curs->y, VIDCONSOLE_CURSOR_WIDTH, + curs->height); + } + + priv->curs.visible = true; + + return 0; +} + +int vidconsole_set_cursor_visible(struct udevice *dev, bool visible, + uint x, uint y, uint index) +{ + if (visible) { + int ret; + + ret = vidconsole_show_cursor(dev, x, y, index); + if (ret) return ret; } return 0; } -#endif +#endif /* CONFIG_CURSOR */ void vidconsole_push_colour(struct udevice *dev, enum colour_idx fg, enum colour_idx bg, struct vidconsole_colour *old) diff --git a/drivers/video/vidconsole_internal.h b/drivers/video/vidconsole_internal.h index 0654a8f98e6..c008b9cf7d3 100644 --- a/drivers/video/vidconsole_internal.h +++ b/drivers/video/vidconsole_internal.h @@ -9,6 +9,10 @@ #include #include +struct udevice; +struct vidconsole_cursor; +struct video_priv; + #define FLIPPED_DIRECTION 1 #define NORMAL_DIRECTION 0 @@ -98,10 +102,10 @@ int fill_char_horizontally(uchar *pfont, void **line, struct video_priv *vid_pri /** * cursor_show() - Draw a simple vertical cursor * - * @line: pointer to framebuffer buffer: upper left cursor corner - * @vid_priv: driver private data - * @height: height of the cursor in pixels - * @param direction controls cursor orientation. Can be normal or flipped. + * @curs: cursor information + * @vid_priv: video-device info + * @direction: controls cursor orientation (normal or flipped) + * * When normal: When flipped: *|-----------------------------------------------| *| * | line stepping | @@ -116,7 +120,7 @@ int fill_char_horizontally(uchar *pfont, void **line, struct video_priv *vid_pri * * Return: 0, if success, or else error code. */ -int cursor_show(void *line, struct video_priv *vid_priv, uint height, +int cursor_show(struct vidconsole_cursor *curs, struct video_priv *vid_priv, bool direction); /** diff --git a/include/video_console.h b/include/video_console.h index ba34bb8e19f..d86cac42110 100644 --- a/include/video_console.h +++ b/include/video_console.h @@ -330,9 +330,9 @@ struct vidconsole_ops { int (*entry_restore)(struct udevice *dev, struct abuf *buf); /** - * set_cursor_visible() - Show or hide the cursor + * get_cursor_info() - Get cursor position info * - * Shows or hides a cursor at the current position + * Calculates and stores cursor position information * * @dev: Console device to use * @visible: true to show the cursor, false to hide it @@ -341,8 +341,8 @@ struct vidconsole_ops { * @index: Character position (0 = at start) * Return: 0 if OK, -ve on error */ - int (*set_cursor_visible)(struct udevice *dev, bool visible, - uint x, uint y, uint index); + int (*get_cursor_info)(struct udevice *dev, bool visible, + uint x, uint y, uint index); }; /* Get a pointer to the driver operations for a video console device */ @@ -430,6 +430,21 @@ int vidconsole_entry_save(struct udevice *dev, struct abuf *buf); int vidconsole_entry_restore(struct udevice *dev, struct abuf *buf); #ifdef CONFIG_CURSOR +/** + * vidconsole_show_cursor() - Show the cursor + * + * Shows a cursor at the specified position. The position is passed in, but for + * the truetype console it is not actually used, since it tracks where the + * cursor must go. + * + * @dev: Console device to use + * @x: X position in pixels + * @y: Y position in pixels + * @index: Character position (0 = at start) + * Return: 0 if OK, -ve on error + */ +int vidconsole_show_cursor(struct udevice *dev, uint x, uint y, uint index); + /** * vidconsole_set_cursor_visible() - Show or hide the cursor * @@ -445,6 +460,12 @@ int vidconsole_entry_restore(struct udevice *dev, struct abuf *buf); int vidconsole_set_cursor_visible(struct udevice *dev, bool visible, uint x, uint y, uint index); #else +static inline int vidconsole_show_cursor(struct udevice *dev, uint x, uint y, + uint index) +{ + return 0; +} + static inline int vidconsole_set_cursor_visible(struct udevice *dev, bool visible, uint x, uint y, uint index) From patchwork Fri Sep 19 20:14:29 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 364 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=1758313003; bh=hLV/GnZWPwDyFBf9mGkx8wmRamTwk+DnctcPqrE6FDk=; 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=RNU9QO7CEcah0VaWU7h6ubsJ/wxBZu53n+7QGREQgJTw/6fEwWOSfexJsl3ytvEdG /mDeq6xyuJkobIex1VekQdt2eIckOlrQqm96hnNa7ezuIGAi+pEGunxc8F8Dd5n6Kv 8R7SqexS3xwZF9zUWj5H4eTWAE8xBlfn5y2P9pVeDUhQnMtgriJyDan8dAhv80xLgF Yv7UfgQFVFVyMYvyHmBLMXAdqSWUWq15qTpNMJk+hTwjI8rDXVGVDCCxKlZZXRbPHF dgRo1SHOmlIdnO1xupH3Tba+Yt4s3HKQSppxAGOzAtuW6KL57k8X96EJ8hmPw84ij1 ni3hzyo5ouuzA== Received: from localhost (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id E653F67C20 for ; Fri, 19 Sep 2025 14:16: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 mB01ktYmrsz2 for ; Fri, 19 Sep 2025 14:16:43 -0600 (MDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1758313003; bh=hLV/GnZWPwDyFBf9mGkx8wmRamTwk+DnctcPqrE6FDk=; 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=RNU9QO7CEcah0VaWU7h6ubsJ/wxBZu53n+7QGREQgJTw/6fEwWOSfexJsl3ytvEdG /mDeq6xyuJkobIex1VekQdt2eIckOlrQqm96hnNa7ezuIGAi+pEGunxc8F8Dd5n6Kv 8R7SqexS3xwZF9zUWj5H4eTWAE8xBlfn5y2P9pVeDUhQnMtgriJyDan8dAhv80xLgF Yv7UfgQFVFVyMYvyHmBLMXAdqSWUWq15qTpNMJk+hTwjI8rDXVGVDCCxKlZZXRbPHF dgRo1SHOmlIdnO1xupH3Tba+Yt4s3HKQSppxAGOzAtuW6KL57k8X96EJ8hmPw84ij1 ni3hzyo5ouuzA== Received: from mail.u-boot.org (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id D412667B55 for ; Fri, 19 Sep 2025 14:16:43 -0600 (MDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1758313001; bh=1qgzHuGewrVKWAKqJlgLqCmLIPwTAhY9g3/jKtOGDn4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Icd6eYYLmk2mc6ClPUmHWTkU3nSWmNu456VA7CQ0GhrfqwThD1IhTPKYquwAilDft Dd0W+zQ+oGrWaPcx8yzMAj0ZataGLv6WkLPDvELzJd3a156MDuIJCUFKKSrj9OIu6J p1kL8LWNtdVjsJDvZfDncJpabS0b7h+PZVgvU2qfOUo4ffKJWSaRMsm9nGPun1JAFE S8mRb7D0zIgPHY0rna1WBS2bjZzWl6E3IiJd+UT/BX2ZgKsVtyrINi3o5KNAx5VDV9 BbJoPhHMq6BbRelbxku5I0SK7nhWA76Zzo/GJ3Ffm9QjAdhLM4jWe15CM4elo9Xh33 h/QpWUV1Vtv3A== Received: from localhost (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id BAA3A67BFC; Fri, 19 Sep 2025 14:16: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 tKT2_TbhpIVx; Fri, 19 Sep 2025 14:16:41 -0600 (MDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1758312994; bh=lB9pGGI+K7JVLC4Eqc48aqRoMa0qL6T8N4rDs/MCJRs=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=I+xKsuT8MLRZ+XECzZBSEhNOEGx56JXrRKcZQQQaDPxqvUaFxxKPgME6O1EeBDJx8 82Gf8rF5mcAR625Jg4QVME4WKqLLd3fJPVcyAuc6ZHVFVUxvyuHyDWVhGhGRlpDDVN UnP06Q+Z7dbfSJcg+i/oZAv8/PJrOKDuHFmI3HMGkeN9yJG4KVxeka5umhAQ5xZGhd 6qGSL+URJaQGKBIrisuxKvB9VYVGChiPN0TeCrlmT6AhYRa2Pzeu3Z9QtDfTvZ08n2 kHsMfqpRoS9xqX6q/rK54ClmFga73GHndTgm1xGBbjEqbGksAzFAbcTZ9cMoGLkXE7 fflhl/3CHUXpg== Received: from u-boot.org (unknown [73.34.74.121]) by mail.u-boot.org (Postfix) with ESMTPSA id 9E38A67A99; Fri, 19 Sep 2025 14:16:34 -0600 (MDT) From: Simon Glass To: U-Boot Concept Date: Fri, 19 Sep 2025 14:14:29 -0600 Message-ID: <20250919201507.4024144-23-sjg@u-boot.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20250919201507.4024144-1-sjg@u-boot.org> References: <20250919201507.4024144-1-sjg@u-boot.org> MIME-Version: 1.0 Message-ID-Hash: JLM7BKZJCVSLEMA63TAPEGRVRNBN3TTZ X-Message-ID-Hash: JLM7BKZJCVSLEMA63TAPEGRVRNBN3TTZ 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 22/42] video: Track the current CLI index List-Id: Discussion and patches related to U-Boot Concept Archived-At: List-Archive: List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: From: Simon Glass Keep track of the current character index in the current CLI entry. This corresponds to the cursor position and is numbered from zero. Signed-off-by: Simon Glass --- drivers/video/vidconsole-uclass.c | 4 ++++ include/video_console.h | 8 ++++++++ 2 files changed, 12 insertions(+) diff --git a/drivers/video/vidconsole-uclass.c b/drivers/video/vidconsole-uclass.c index 479793bc227..830e3ca306e 100644 --- a/drivers/video/vidconsole-uclass.c +++ b/drivers/video/vidconsole-uclass.c @@ -79,6 +79,9 @@ static int vidconsole_back(struct udevice *dev) if (priv->ycur < 0) priv->ycur = 0; } + assert(priv->cli_index); + cli_index_adjust(priv, -1); + return video_sync(dev->parent, false); } @@ -455,6 +458,7 @@ static int vidconsole_output_glyph(struct udevice *dev, int ch) priv->last_ch = ch; if (priv->xcur_frac >= priv->xsize_frac) vidconsole_newline(dev); + cli_index_adjust(priv, 1); return 0; } diff --git a/include/video_console.h b/include/video_console.h index d86cac42110..5074880c674 100644 --- a/include/video_console.h +++ b/include/video_console.h @@ -70,6 +70,7 @@ struct vidconsole_cursor { * @xsize_frac: Width of the display in fractional units * @xstart_frac: Left margin for the text console in fractional units * @last_ch: Last character written to the text console on this line + * @cli_index: Character index into the CLI text (0=start) * @escape: TRUE if currently accumulating an ANSI escape sequence * @escape_len: Length of accumulated escape sequence so far * @col_saved: Saved X position, in fractional units (VID_TO_POS(x)) @@ -91,6 +92,7 @@ struct vidconsole_priv { int xsize_frac; int xstart_frac; int last_ch; + int cli_index; /* * ANSI escape sequences are accumulated character by character, * starting after the ESC char (0x1b) until the entire sequence @@ -474,6 +476,12 @@ static inline int vidconsole_set_cursor_visible(struct udevice *dev, } #endif /* CONFIG_CURSOR */ +static inline void cli_index_adjust(struct vidconsole_priv *priv, int by) +{ + if (CONFIG_IS_ENABLED(CURSOR)) + priv->cli_index += by; +} + /** * vidconsole_push_colour() - Temporarily change the font colour * From patchwork Fri Sep 19 20:14:30 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 365 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=1758313006; bh=7VDSXlMgpFBhKG08yyJn/Ljrl/MunRulXadCID8lA3Y=; 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=aG1mEGmFnvm06Cbjk/YWH5/pLfcTZ+Rq2DQa+HfCVKM4wHTewrxsNBm2hrkyY9aQs VTYRaJKZKAQDkUmaTgWx5NSuCT1wydgk1XCxvT8iVKTyV0JAu2iP6vN/gf7ecdJgIu 8hljXVSvfXYM71sni+MxSU8OuIKHsF4blM8cZdbOultcMnXe60yf8EoOEhtfibS1gM kVfCkItfAMbDJGn/Iqc5XdiOLcVRCtMQwFekBU1UKyj3AmLNxrN66NSYk30JYLX3Q5 czAdrMdSgwMZSc06RrA58MaJ5pusP5KRATVKbMUyF5Ynx4dpk2UUsGR7S3kBlyToyH QVVo3KOruosVg== Received: from localhost (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id 3368967B55 for ; Fri, 19 Sep 2025 14:16: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 j8qERqVzyUqN for ; Fri, 19 Sep 2025 14:16:46 -0600 (MDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1758313004; bh=7VDSXlMgpFBhKG08yyJn/Ljrl/MunRulXadCID8lA3Y=; 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=PWCYphveK4f0eSY9cZ0ZicmVvz6+1JYp+8UzAzLxbk0BQfi7cmivC15i8iF8FOBdn 8XWdlTBV04PrtS6fHrP/g531rXcooc5H5uofsB7knT1DyhGRx9T8BcDemhGwfZa5T7 rsndzzcHRs0xfaLiSK7Nf9pRM8SwS8SdCb7BJ91lQYl6328OvyWBIBUdj6GHW4uGkf LJ+BQAl/+54tNw7ZWJEi9M+bpYa3vvFc8ZWGIjXL+SNpVigIdXgYEm/p5Gv/E1aF3M oxdy72oFnm71z/iYnLgNVsQK2LfmeTVPfP4Im29Afv7nYm5nzUhAsWvTJVi7WuAlrN uS6Q89ka4//aw== Received: from mail.u-boot.org (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id A2C6767C20 for ; Fri, 19 Sep 2025 14:16:44 -0600 (MDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1758313001; bh=E/VkZakmY+NPBRqFPsBay9ccPtLFNiECtdqjHbVRCnQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=UHHTMO/DmdFaFv/J90eGWSdU/cugss9Z6id7rCDlMohCRKK8uBQP9syk62z97DS+z /E/Qf2rrCemtuB/lbj4nA9HTtD0jwXskrpziDczrBwuSnZJmYLFQ0oTcIQ1z6/3DQe WNgX21wmjo6ylw/0aOYzKxE5WLFCBc+x9g76hi1zikgoWgfcsXV46WGn7hz/Ljxkmh NVMMvVDv9229eenEvg9ISl3J4TGtLUSLY/L/FCLajGOPGIYBjRSeZWrKiXA+QK+scU CLxkD6iDm4D2lwJzU5ONDERrDvL02MEFBHmk/RnIE6gaxu7yGV4T0yH/rcOXYjxxaX Z3gPw5M4dzI9w== Received: from localhost (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id C566F67A99; Fri, 19 Sep 2025 14:16: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 tdVNxQdEcDKr; Fri, 19 Sep 2025 14:16:41 -0600 (MDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1758312999; bh=GEM+PUyP9c88OyYjuvVx2LizPx/94nupYkVubxInvtI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Hn7cSzLaPX3dd/h8vlzRivj9kZNDJpvJ2bU1bCiL+EZP5kJqraJGDzMIGsEHvZB01 ozH1y7yT8H3IAB/aXRJ6mnTHyQavoFOACuGpClUAkKSLbI5iwwRwUoHpEmWkvvdyCp 7DebsYYsWRMSvlS4o0KBoj9QvvrpZp0C2cYqNukwj8VDRWYAogHoru0fZYjuFdpqC4 /IvUSrXfKMQt1w8TTIhzAFJkPMp53s7AuOl8yHVYYhUKxlQNruYgo/xZPSLhkCJjvr 3Xh5ruSZj9qz69bDXihNarvflxMnmdn0Yz1yp/oNAJ8OGIjK3LH7ptDaI5PlicKrOa +fM/oPdpHMTCA== Received: from u-boot.org (unknown [73.34.74.121]) by mail.u-boot.org (Postfix) with ESMTPSA id 4851067B3B; Fri, 19 Sep 2025 14:16:39 -0600 (MDT) From: Simon Glass To: U-Boot Concept Date: Fri, 19 Sep 2025 14:14:30 -0600 Message-ID: <20250919201507.4024144-24-sjg@u-boot.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20250919201507.4024144-1-sjg@u-boot.org> References: <20250919201507.4024144-1-sjg@u-boot.org> MIME-Version: 1.0 Message-ID-Hash: LQB2SDNSLOATGKDEFTZQUIOALQMQ7M6B X-Message-ID-Hash: LQB2SDNSLOATGKDEFTZQUIOALQMQ7M6B 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 23/42] video: Provide a way to indicate the start of CLI entry 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 mark_start() method for the console, which indicates that the CLI prompt has been written to the display and any following characters will be user input. There are two cases to consider, tracked by an indent flag in struct vidconsole_cursor: - normal CLI entry where new lines start at the left of the console - expo entry where new lines start at the same position as the previous line (indent=true) Record this position in the uclass info, so it is available to console drivers. Signed-off-by: Simon Glass --- common/cli_readline.c | 5 ++++ drivers/video/vidconsole-uclass.c | 39 +++++++++++++++++++++++++++ include/video_console.h | 44 +++++++++++++++++++++++++++++++ 3 files changed, 88 insertions(+) diff --git a/common/cli_readline.c b/common/cli_readline.c index 2326e4b4f37..dc27a962e9d 100644 --- a/common/cli_readline.c +++ b/common/cli_readline.c @@ -16,6 +16,7 @@ #include #include #include +#include #include #include @@ -676,6 +677,8 @@ int cli_readline_into_buffer(const char *const prompt, char *buffer, if (prompt) puts(prompt); + /* tell the vidconsole the cursor is at its start position */ + vidconsole_readline_start(false); rc = cread_line(prompt, p, &len, timeout); rc = rc < 0 ? rc : len; @@ -686,5 +689,7 @@ int cli_readline_into_buffer(const char *const prompt, char *buffer, pager_set_bypass(gd_pager(), old_bypass); pager_reset(gd_pager()); + vidconsole_readline_end(); + return rc; } diff --git a/drivers/video/vidconsole-uclass.c b/drivers/video/vidconsole-uclass.c index 830e3ca306e..0a7cf5ad81a 100644 --- a/drivers/video/vidconsole-uclass.c +++ b/drivers/video/vidconsole-uclass.c @@ -761,6 +761,25 @@ int vidconsole_set_cursor_visible(struct udevice *dev, bool visible, } #endif /* CONFIG_CURSOR */ +int vidconsole_mark_start(struct udevice *dev) +{ + struct vidconsole_priv *priv = dev_get_uclass_priv(dev); + struct vidconsole_ops *ops = vidconsole_get_ops(dev); + + priv->xmark_frac = priv->xcur_frac; + priv->ymark = priv->ycur; + priv->cli_index = 0; + if (ops->mark_start) { + int ret; + + ret = ops->mark_start(dev); + if (ret != -ENOSYS) + return ret; + } + + return 0; +} + void vidconsole_push_colour(struct udevice *dev, enum colour_idx fg, enum colour_idx bg, struct vidconsole_colour *old) { @@ -884,3 +903,23 @@ void vidconsole_set_bitmap_font(struct udevice *dev, void vidconsole_idle(struct udevice *dev) { } + +#ifdef CONFIG_CURSOR +void vidconsole_readline_start(bool indent) +{ + struct uclass *uc; + struct udevice *dev; + + uclass_id_foreach_dev(UCLASS_VIDEO_CONSOLE, dev, uc) { + struct vidconsole_priv *priv = dev_get_uclass_priv(dev); + + priv->curs.indent = indent; + vidconsole_mark_start(dev); + } +} + +void vidconsole_readline_end(void) +{ + /* TODO: mark the end */ +} +#endif /* CURSOR */ diff --git a/include/video_console.h b/include/video_console.h index 5074880c674..c5450f70c4d 100644 --- a/include/video_console.h +++ b/include/video_console.h @@ -30,6 +30,7 @@ enum { * vertical bar of width VIDCONSOLE_CURSOR_WIDTH shown in the foreground colour. * * @visible: cursor is currently visible + * @indent: indent subsequent lines to the same position as the first line * @x: cursor left X position in pixels * @y: cursor top Y position in pixels * @height: height of cursor in pixels @@ -37,6 +38,7 @@ enum { */ struct vidconsole_cursor { bool visible; + bool indent; /* filled in by get_cursor_info(): */ uint x; @@ -70,6 +72,8 @@ struct vidconsole_cursor { * @xsize_frac: Width of the display in fractional units * @xstart_frac: Left margin for the text console in fractional units * @last_ch: Last character written to the text console on this line + * @xmark_frac: X position of start of CLI text entry, in fractional units + * @ymark: Y position of start of CLI text * @cli_index: Character index into the CLI text (0=start) * @escape: TRUE if currently accumulating an ANSI escape sequence * @escape_len: Length of accumulated escape sequence so far @@ -92,6 +96,8 @@ struct vidconsole_priv { int xsize_frac; int xstart_frac; int last_ch; + int xmark_frac; + int ymark; int cli_index; /* * ANSI escape sequences are accumulated character by character, @@ -345,6 +351,17 @@ struct vidconsole_ops { */ int (*get_cursor_info)(struct udevice *dev, bool visible, uint x, uint y, uint index); + + /** + * mark_start() - Mark the current position as the state of CLI entry + * + * This indicates that a new CLI entry is starting, so the user will be + * entering characters from this point. The console can use this to set + * the beginning point for the cursor. + * + * @dev: Console device to use + */ + int (*mark_start)(struct udevice *dev); }; /* Get a pointer to the driver operations for a video console device */ @@ -461,6 +478,24 @@ int vidconsole_show_cursor(struct udevice *dev, uint x, uint y, uint index); */ int vidconsole_set_cursor_visible(struct udevice *dev, bool visible, uint x, uint y, uint index); + +/** + * vidconsole_readline_start() - Enable cursor for all video consoles + * + * Called at the start of command line input to show cursors on all + * active video consoles + * + * @indent: indent subsequent lines to the same position as the first line + */ +void vidconsole_readline_start(bool indent); + +/** + * vidconsole_readline_end() - Disable cursor for all video consoles + * + * Called at the end of command line input to hide cursors on all + * active video consoles + */ +void vidconsole_readline_end(void); #else static inline int vidconsole_show_cursor(struct udevice *dev, uint x, uint y, uint index) @@ -474,6 +509,15 @@ static inline int vidconsole_set_cursor_visible(struct udevice *dev, { return 0; } + +static inline void vidconsole_readline_start(bool indent) +{ +} + +static inline void vidconsole_readline_end(void) +{ +} + #endif /* CONFIG_CURSOR */ static inline void cli_index_adjust(struct vidconsole_priv *priv, int by) From patchwork Fri Sep 19 20:14:31 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 366 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=1758313010; bh=7+byhfuBqcbK9++1cBgJ8q5276a6d++d/6Zak2d5rHc=; 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=n4GBsmozPQU5aa2iz4Dwd3hX3z7UWWGy21aWBiCWO5LxWHm1dxN6+j0ma3nJBJNe0 65qo+JbCObz+Fo2Wql31iESmIISYjUgrKJJ4lEsO5TVjfcZ1g2rV/X+X8zl2yUNqY6 uXpBCyXLGlGOKsHIxHfc8z77AI4pvaVcGJt8Z5MUViDgUT237VZ6jZvsURSGbt3hcY ij2lxCywlohYk2OROT9csP5IEM5Pe5BxxWi++VkslDXuWJXuMvc/qJirRK0MzBD+R/ /tU21z9eWrXxgevdx9L2dQ9REk+a04FiLtkMTgbR6chlzdxwPw6sFAbjA96fNI844d lGwZX4ABteOWQ== Received: from localhost (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id 33C5D67C6C for ; Fri, 19 Sep 2025 14:16: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 lDhtuQ-NhuAT for ; Fri, 19 Sep 2025 14:16:50 -0600 (MDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1758313010; bh=7+byhfuBqcbK9++1cBgJ8q5276a6d++d/6Zak2d5rHc=; 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=n4GBsmozPQU5aa2iz4Dwd3hX3z7UWWGy21aWBiCWO5LxWHm1dxN6+j0ma3nJBJNe0 65qo+JbCObz+Fo2Wql31iESmIISYjUgrKJJ4lEsO5TVjfcZ1g2rV/X+X8zl2yUNqY6 uXpBCyXLGlGOKsHIxHfc8z77AI4pvaVcGJt8Z5MUViDgUT237VZ6jZvsURSGbt3hcY ij2lxCywlohYk2OROT9csP5IEM5Pe5BxxWi++VkslDXuWJXuMvc/qJirRK0MzBD+R/ /tU21z9eWrXxgevdx9L2dQ9REk+a04FiLtkMTgbR6chlzdxwPw6sFAbjA96fNI844d lGwZX4ABteOWQ== Received: from mail.u-boot.org (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id 23B5867BB6 for ; Fri, 19 Sep 2025 14:16:50 -0600 (MDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1758313008; bh=mROGzMiFVaFx7tlFdZMXKkSBWBnEown+MuMIX+cSPQw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=I3YW/DxKjToqPzDxs9jbTfDA6r4g7P/WTr6PRHvmtp92S59aiBn4Nxu/RRGI8bWF2 ZvLYETNELiBliUR3sxRpKdqBfDOdxjF1TvLApo6lnSv4A09s1apPJTPTHE/MBjHDqn M9krM0RXrsxSD1/iU6CgPMNLb9O4g5CBXzLdRixC+xNWA8tugengmjCPkt5EtHYEca HyMV6vTqSEgSuYkM5fanBgYmEk+ehDO0TGZ7XIU34q5lxxY6Ap751kQ4arasA5XkSV EfZgsWMXEeIt/OxY61eF15p+wTJZzCFO421J7wo0UNAuSOChdFRt769PnAmfn9aG12 kEfCL3BMeSlKA== Received: from localhost (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id 6C91467C20; Fri, 19 Sep 2025 14:16:48 -0600 (MDT) X-Virus-Scanned: Debian amavis at Received: from mail.u-boot.org ([127.0.0.1]) by localhost (mail.u-boot.org [127.0.0.1]) (amavis, port 10026) with ESMTP id EI04ImkXpJbA; Fri, 19 Sep 2025 14:16:48 -0600 (MDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1758313001; bh=OKKIlUNjfuRMEYhxvPYL2dfPH9glg2veY4a+uVk/2B8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=k6BFA1HhtYz2uVJeniPfN6bamFKVfQRxO38RLWyE3R3YuuJKhXMpU99lrZsXOQSfX h/tPiabFcDofQ1bUy5qx4c/PICSh3L7bFP3FGXTUHOPeh4VjoGcLsqemkBr5Ga5Hxu xJmG2IWwKVpzz7Bv59x6h5qOeimgvRGtuyHj6f8gJdpcqYtkopaXxBHXfvtFhmHcmK n4fnAKB2oX5vRujt8imKUr/pCORGY3+alUIt31N9Axu6+Uv/GuKpYn2hJEtGFs/2u9 8xNIRxz+ZaIJhwZdI+KA7tKsYZ/Y2a/tQklM8Kkl4zsQ0aab+GF/fSvhVBGiQOLu5W gRHS+vn47p96A== Received: from u-boot.org (unknown [73.34.74.121]) by mail.u-boot.org (Postfix) with ESMTPSA id 5EF3467BB6; Fri, 19 Sep 2025 14:16:41 -0600 (MDT) From: Simon Glass To: U-Boot Concept Date: Fri, 19 Sep 2025 14:14:31 -0600 Message-ID: <20250919201507.4024144-25-sjg@u-boot.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20250919201507.4024144-1-sjg@u-boot.org> References: <20250919201507.4024144-1-sjg@u-boot.org> MIME-Version: 1.0 Message-ID-Hash: VNY5R6IZYFY5YAW2RMI3ZLCAZTJYR3EA X-Message-ID-Hash: VNY5R6IZYFY5YAW2RMI3ZLCAZTJYR3EA 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 24/42] console: Add debugging for kerning 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 some debugging which can be used to manually check that truetype is kerning against the expected character. This is tested by the image-based tests but they are sometimes hard to debug. Signed-off-by: Simon Glass --- drivers/video/console_truetype.c | 10 ++++++++++ drivers/video/vidconsole-uclass.c | 5 +++++ 2 files changed, 15 insertions(+) diff --git a/drivers/video/console_truetype.c b/drivers/video/console_truetype.c index eee4ea2e2a9..d87b3828bb0 100644 --- a/drivers/video/console_truetype.c +++ b/drivers/video/console_truetype.c @@ -6,6 +6,7 @@ #define LOG_CATEGORY UCLASS_VIDEO #include +#include #include #include #include @@ -321,8 +322,17 @@ static int console_truetype_putc_xy(struct udevice *dev, uint x, uint y, if (vc_priv->last_ch) { kern = stbtt_GetCodepointKernAdvance(font, vc_priv->last_ch, cp); + if (_DEBUG) { + console_printf_select_stderr(true, "kern %c (%02x)", + vc_priv->last_ch, + vc_priv->last_ch); + } xpos += met->scale * kern; } + if (_DEBUG) { + console_printf_select_stderr(true, " %c (%02x)\n", + cp >= ' ' ? cp : ' ', cp); + } /* * Figure out where the cursor will move to after this character, and diff --git a/drivers/video/vidconsole-uclass.c b/drivers/video/vidconsole-uclass.c index 0a7cf5ad81a..9d161f4688e 100644 --- a/drivers/video/vidconsole-uclass.c +++ b/drivers/video/vidconsole-uclass.c @@ -442,6 +442,11 @@ static int vidconsole_output_glyph(struct udevice *dev, int ch) struct vidconsole_priv *priv = dev_get_uclass_priv(dev); int ret; + if (_DEBUG) { + console_printf_select_stderr(true, + "glyph last_ch '%c': ch '%c' (%02x): ", + priv->last_ch, ch >= ' ' ? ch : ' ', ch); + } /* * Failure of this function normally indicates an unsupported * colour depth. Check this and return an error to help with From patchwork Fri Sep 19 20:14:32 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 367 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=1758313010; bh=iQJU1YNuDBLojNiU5Xxb68C1wdr4tXzAOdBN2NtMzQs=; 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=Oiolv8fRJcUqWO0jJl45IwL0f3SpO3+M4C4P/pxDnKgaQV53pQGisZ/IsgJe+AvYs js94hgo6Yg5mdM2WcZST3MRMrt+RH1MUo3e59pTAolfE8sSPHW6ZP9x6sb279uZ0Li TC47iupSwDLkg1ddUlFqL4r+6ND1ijpZZ7l9ojQmxWvYdVoNcfIjwbDp2HKlDOXfdu 48MGVg3smMExmFqouv1AamhydtHsZJMlYW6JbjfHBrP2QMsLVXbNHbTWBo6k/p2voD RbHsBzrgPxFD/VhDmSxwGg43bkgyqU6uvZeWr4hQr8Sx0YDrXreKpSvGAvaVDkpWnO FcIjCunqv7M3g== Received: from localhost (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id 8B0C367C83 for ; Fri, 19 Sep 2025 14:16: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 gBmoRpePHmRY for ; Fri, 19 Sep 2025 14:16:50 -0600 (MDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1758313010; bh=iQJU1YNuDBLojNiU5Xxb68C1wdr4tXzAOdBN2NtMzQs=; 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=Oiolv8fRJcUqWO0jJl45IwL0f3SpO3+M4C4P/pxDnKgaQV53pQGisZ/IsgJe+AvYs js94hgo6Yg5mdM2WcZST3MRMrt+RH1MUo3e59pTAolfE8sSPHW6ZP9x6sb279uZ0Li TC47iupSwDLkg1ddUlFqL4r+6ND1ijpZZ7l9ojQmxWvYdVoNcfIjwbDp2HKlDOXfdu 48MGVg3smMExmFqouv1AamhydtHsZJMlYW6JbjfHBrP2QMsLVXbNHbTWBo6k/p2voD RbHsBzrgPxFD/VhDmSxwGg43bkgyqU6uvZeWr4hQr8Sx0YDrXreKpSvGAvaVDkpWnO FcIjCunqv7M3g== Received: from mail.u-boot.org (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id 7B50767A99 for ; Fri, 19 Sep 2025 14:16:50 -0600 (MDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1758313008; bh=tPf2MNZS5X/vg7bFil1VPHzhz75Y+qEKaE1cpmbXUVY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Xl2Gd/TUrKXL8DPtj1vym2HA6GV6nhFCP+MeIdySxY36/RgXJSM4iIONwRdw7KJ0n Jf9HL39cVf3A94g7PxRewTyYl6kDxIPJEkhWNEW2ncCxaCVV1YSpDCWQlz/YlP72aT yoJBA8nyQj97hN5KCrIZPCzRaab3t/29P4hPpyImxsVXqIKtr2A17ppRk0BQSqylOk dk9tOYwaiHQPeQT3iE9QmbR1QJemCx/WA/DieM9S5C3Nfl4LCqVqyB68wBk/fcej+4 5FvQB5tevD8yhwqFpBHWQ/WKIsPmqpBplC7bHSAmZ8QrSpFM7TW9zI97F/LZlMdOQP lEmNQ9/kdlyhg== Received: from localhost (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id 745F867BB6; Fri, 19 Sep 2025 14:16:48 -0600 (MDT) X-Virus-Scanned: Debian amavis at Received: from mail.u-boot.org ([127.0.0.1]) by localhost (mail.u-boot.org [127.0.0.1]) (amavis, port 10026) with ESMTP id hKLGXZ9GABE3; Fri, 19 Sep 2025 14:16:48 -0600 (MDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1758313006; bh=ahOdrxpZF3yazTXkHzK0+sDZqTQn4AJOhlTBULAkEWw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=XeacLPKHyYHr3v4/jCkG5qMk1MtNxMNjzkQiJzoW/OpHtOLgwDPDA4+iFWDwk9VWs E3QcPmaYGkGH9I2J+2iV4Zmt2S0vs/JJGnuEyQi+OsZ1QEJXaPaxV2a0H9U+hKKSZG F4ka8kpSaqbv1/LpC96hpcIhCVsoY9ZNr/97mbo6tXlm3JVFAP0u2Knm9aiY5gRCQc fuPJnTJ/I7on/olB4EQq6V7nE5QHMp8/76JPv/dJr/XYpX6EQEsrljYzVXQZsLSMKD xo02u0yr82su3SmhStQEwX3FVG+XXkEkZq9sc/Yla1TZAZMWjVaKRmgg2mwKGRqgTh kUofyzaIrckTA== Received: from u-boot.org (unknown [73.34.74.121]) by mail.u-boot.org (Postfix) with ESMTPSA id 0665B67A99; Fri, 19 Sep 2025 14:16:45 -0600 (MDT) From: Simon Glass To: U-Boot Concept Date: Fri, 19 Sep 2025 14:14:32 -0600 Message-ID: <20250919201507.4024144-26-sjg@u-boot.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20250919201507.4024144-1-sjg@u-boot.org> References: <20250919201507.4024144-1-sjg@u-boot.org> MIME-Version: 1.0 Message-ID-Hash: IIC4QG42WEZZS6XD4VQNEIDH5ADIINBV X-Message-ID-Hash: IIC4QG42WEZZS6XD4VQNEIDH5ADIINBV 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 25/42] video: truetype: Record the position where CLI entry starts List-Id: Discussion and patches related to U-Boot Concept Archived-At: List-Archive: List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: From: Simon Glass Implement the mark_start() method for the truetype console by recording which pos[] record corresponds to this event. We can be sure that the user will not be able to backspace past this point. Signed-off-by: Simon Glass --- drivers/video/console_truetype.c | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/drivers/video/console_truetype.c b/drivers/video/console_truetype.c index d87b3828bb0..edd2eb0a309 100644 --- a/drivers/video/console_truetype.c +++ b/drivers/video/console_truetype.c @@ -173,6 +173,8 @@ struct console_tt_metrics { * start of the current command line. * @pos_ptr: Current position in the position history * @cur_fontdata: Current fixed font data (NULL if using TrueType) + * @pos_start: Value of pos_ptr when the cursor is at the start of the text + * being entered by the user */ struct console_tt_priv { struct console_tt_metrics *cur_met; @@ -181,6 +183,7 @@ struct console_tt_priv { struct pos_info pos[POS_HISTORY_SIZE]; int pos_ptr; struct video_fontdata *cur_fontdata; + int pos_start; }; /** @@ -1060,6 +1063,15 @@ const char *console_truetype_get_font_size(struct udevice *dev, uint *sizep) } } +static int truetype_mark_start(struct udevice *dev) +{ + struct console_tt_priv *priv = dev_get_priv(dev); + + priv->pos_start = priv->pos_ptr; + + return 0; +} + static int console_truetype_probe(struct udevice *dev) { struct console_tt_priv *priv = dev_get_priv(dev); @@ -1106,6 +1118,7 @@ struct vidconsole_ops console_truetype_ops = { .entry_save = truetype_entry_save, .entry_restore = truetype_entry_restore, .get_cursor_info = truetype_get_cursor_info, + .mark_start = truetype_mark_start, }; U_BOOT_DRIVER(vidconsole_truetype) = { From patchwork Fri Sep 19 20:14:33 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 368 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=1758313013; bh=2IaM+57NMHz64ihkgcV7I1szG2MecxX0xHz7XBx+3sY=; 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=jB5LuRPWCeVdZtvGSrLIvWsLSh24hpY8d004AtW3cGRGDXiTIBXnGGxe0ib910J+g UW0MjQ0k0ugq3afaUSWrGjXrkq4KyO0bt7durMqiT/b6irUf2EGiyxyQlcX9tHEIqn jiZEdb1Bh03xRSLHVnCRmbv380T9pymrSsVCHQOf8ETApBZ37r7OgujNFQZyUeegYk RJ2sUFXb8NMc/OPOdnTVww/J/6XMxjqR868fjP9xWARpKtBy26oXeDzFgQic24Gnmd eLWnWIQxUuNM3fb0RAzcY0S/+CkrqLlFsDxnK1gYQExoDSR9ANKTdHIp8kUgg0odqU ZQwvqRiVxPVuA== Received: from localhost (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id E0C0167B3B for ; Fri, 19 Sep 2025 14:16: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 zVX5FjeCkhYy for ; Fri, 19 Sep 2025 14:16:53 -0600 (MDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1758313013; bh=2IaM+57NMHz64ihkgcV7I1szG2MecxX0xHz7XBx+3sY=; 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=jB5LuRPWCeVdZtvGSrLIvWsLSh24hpY8d004AtW3cGRGDXiTIBXnGGxe0ib910J+g UW0MjQ0k0ugq3afaUSWrGjXrkq4KyO0bt7durMqiT/b6irUf2EGiyxyQlcX9tHEIqn jiZEdb1Bh03xRSLHVnCRmbv380T9pymrSsVCHQOf8ETApBZ37r7OgujNFQZyUeegYk RJ2sUFXb8NMc/OPOdnTVww/J/6XMxjqR868fjP9xWARpKtBy26oXeDzFgQic24Gnmd eLWnWIQxUuNM3fb0RAzcY0S/+CkrqLlFsDxnK1gYQExoDSR9ANKTdHIp8kUgg0odqU ZQwvqRiVxPVuA== Received: from mail.u-boot.org (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id D0D3367C5B for ; Fri, 19 Sep 2025 14:16:53 -0600 (MDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1758313012; bh=cZ+3fLAUxSB+DWNGSeQV3clJJnMcnMY2SCfVJFd346U=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=aF5SOxSEeayAcnYsSNEa4C7eDIAohwY13CxVldKziW+M0iHnRZ7O0+8DnYVok1nmx KBslxBXBhGcxJ9zMmkeqI8Uy/BMA31kqLAEnmEa5CzM7S984WnZWMzRZ0/dzY36nBs BOWAA9fHUZq28b/cg/jFRl3KabpmQgdFS4ba/wBzGwTetnzfbAy6ke27QtWISfXBly NYaM73w18S1yNTUHj9nMkUo8eGaC4haVol5xsnWujbA0J3Xjnn0M8UkHAHAxuUQn5x brWSlQqG7spYAyRDSTq1G8QJHbdCvk16mEZF+pqX3H7E6QgKG3x4VjoeljmBHu/UTG 2px/mKv/19S6w== Received: from localhost (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id E84C667BFC; Fri, 19 Sep 2025 14:16:52 -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 ywlZlTvF2LIX; Fri, 19 Sep 2025 14:16:52 -0600 (MDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1758313008; bh=NgP0g26/8q8+Oh7uGRi9y7ojxaMVa4PvbnPWJNluoxY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ZySuLjk9GSly7ziodNhiXWlNen6yhLmwqQivuUtJnVYvPW0DPwFfj8TXI2xOaU9Lx iifUqitOGUSnL2+mWsHnTeLutwxK069SHWlGtm59YDyz5Y7dUW/iiHqRuuqAP9QNR5 5T3jeaCmYBzaUa640RWRSFGrYSVu7y8qZpVRnbAepfaxIz5CAVxo/RWafkTWGDZBl+ uDPVo6w7ipOo582+VheKDeM7qnu//5Pk+IRVi96Wrfs5jg1OCGxh91j3LWDsVBKwON cnxfgt4TQm+ME5gMVJREp2ZB7Ad1aWl6jweKxwaV7F7P/BGmosPDlN/Xigf5PiKujv M5Ij9ujQv2YSQ== Received: from u-boot.org (unknown [73.34.74.121]) by mail.u-boot.org (Postfix) with ESMTPSA id 1091167B55; Fri, 19 Sep 2025 14:16:47 -0600 (MDT) From: Simon Glass To: U-Boot Concept Date: Fri, 19 Sep 2025 14:14:33 -0600 Message-ID: <20250919201507.4024144-27-sjg@u-boot.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20250919201507.4024144-1-sjg@u-boot.org> References: <20250919201507.4024144-1-sjg@u-boot.org> MIME-Version: 1.0 Message-ID-Hash: IVM7UJSKT4YFMQDQVNH6Q7D37XR4SGPD X-Message-ID-Hash: IVM7UJSKT4YFMQDQVNH6Q7D37XR4SGPD 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 26/42] video: truetype: Track characters and their widths List-Id: Discussion and patches related to U-Boot Concept Archived-At: List-Archive: List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: From: Simon Glass The Truetype driver maintains a list of x and y positions for every character in the line being entered by the user. This allows it to backspace reliably without having to re-measure lots of text. For kerning, the video console maintains a last_ch variable which holds the last character written to the console. This allows accurate kerning between one character and the next. At present lash_ch is cleared on backspace, since we cannot know what the character before last_ch is. The slightly strange part is that the truetype console currently has no knowledge about what the characters were, only their x and y positions, with the x position being fractional. It also has no idea of the width of each character, since it doesn't need to: the CLI will always write out a new character in order to move forward during command-editing, since there is no actual concept of 'move the cursor to the right'. Part of the reason this works is that truetype implements backspace by actually clearing the character from the display. So if you type some text and then press the left arrow, it looks like it is doing a backspace. This has been a known limitation for some time. The correct way to implement left-arrow is to leave the display alone, only clearing it if characters are later added. This is necessary since Truetype fonts are OR'd onto the screen, which is assumed to be initially cleared to the background colour. We cannot do this clearing without knowing the width of the characters we need to clear, so add a 'width' to the struct pos_info for that. For kerning we must know the previous character to kern against, but we cannot yet make that change, since we don't want to kern against characters that were there before an erase. So that will be dealt with later, in 'Clear after the current char on insert'. Signed-off-by: Simon Glass --- drivers/video/console_truetype.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/drivers/video/console_truetype.c b/drivers/video/console_truetype.c index edd2eb0a309..aabacd10afe 100644 --- a/drivers/video/console_truetype.c +++ b/drivers/video/console_truetype.c @@ -120,10 +120,14 @@ static double tt_acos(double val) * * @xpos_frac: Fractional X position in pixels (multiplied by VID_FRAC_DIV) * @ypos: Y position (pixels from the top) + * @width: Width of the character at this position in pixels (rounded up) + * @cp: Unicode code point of the character */ struct pos_info { int xpos_frac; int ypos; + int width; + int cp; }; /* @@ -175,6 +179,7 @@ struct console_tt_metrics { * @cur_fontdata: Current fixed font data (NULL if using TrueType) * @pos_start: Value of pos_ptr when the cursor is at the start of the text * being entered by the user + * @pos_count: Maximum value reached by pos_ptr (initially zero) */ struct console_tt_priv { struct console_tt_metrics *cur_met; @@ -184,6 +189,7 @@ struct console_tt_priv { int pos_ptr; struct video_fontdata *cur_fontdata; int pos_start; + int pos_count; }; /** @@ -354,7 +360,11 @@ static int console_truetype_putc_xy(struct udevice *dev, uint x, uint y, pos = &priv->pos[priv->pos_ptr]; pos->xpos_frac = vc_priv->xcur_frac; pos->ypos = vc_priv->ycur; + pos->width = (width_frac + VID_FRAC_DIV - 1) / VID_FRAC_DIV; + pos->cp = cp; priv->pos_ptr++; + if (priv->pos_ptr > priv->pos_count) + priv->pos_count = priv->pos_ptr; } /* @@ -530,6 +540,7 @@ static int console_truetype_entry_start(struct udevice *dev) /* A new input line has start, so clear our history */ priv->pos_ptr = 0; + priv->pos_count = 0; vc_priv->last_ch = 0; return 0; @@ -1000,6 +1011,7 @@ static int truetype_entry_restore(struct udevice *dev, struct abuf *buf) vc_priv->xcur_frac = store.cur.xpos_frac; vc_priv->ycur = store.cur.ypos; priv->pos_ptr = store.priv.pos_ptr; + priv->pos_count = store.priv.pos_count; memcpy(priv->pos, store.priv.pos, store.priv.pos_ptr * sizeof(struct pos_info)); From patchwork Fri Sep 19 20:14:34 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 369 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=1758313017; bh=Ja8EjVd/sFqu29W/ZwJyMg1Ih647DijdnIWX6GyxSpw=; 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=rlt7/Fspq/cqAn9jKve7ZfVReuBK0Gsd704XYW5lQ+o7bF99jVSzyqwNdGs/2DMgN eJZECsvY/JLES3GExkgiPSdVObWOAzo9l57z1Qu/CWY3zDGM0ZJkH6rDyafJ+B97gN FWrGr9fpSJhcWI74Bs/U34ecGWsAHqPTH6lzXGm6eKxIcz/uX8iVA1YgCz39/LLp5n xvSWXzPEMrsgrBGP3H5S0jwGGUpkCH5ExKoiuSrFKkfz/2Q/KcVZW3IffoiAxWFnnl rMfZKn/RTlLCJATWEDUjvbusSqiaUguRUF5mVHxdjKEkeOME85wwx96LYmio/gDR9g bPH7ISBzwQV/Q== Received: from localhost (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id 45D5E67C0E for ; Fri, 19 Sep 2025 14:16: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 B3FdzxwKgx87 for ; Fri, 19 Sep 2025 14:16:57 -0600 (MDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1758313017; bh=Ja8EjVd/sFqu29W/ZwJyMg1Ih647DijdnIWX6GyxSpw=; 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=rlt7/Fspq/cqAn9jKve7ZfVReuBK0Gsd704XYW5lQ+o7bF99jVSzyqwNdGs/2DMgN eJZECsvY/JLES3GExkgiPSdVObWOAzo9l57z1Qu/CWY3zDGM0ZJkH6rDyafJ+B97gN FWrGr9fpSJhcWI74Bs/U34ecGWsAHqPTH6lzXGm6eKxIcz/uX8iVA1YgCz39/LLp5n xvSWXzPEMrsgrBGP3H5S0jwGGUpkCH5ExKoiuSrFKkfz/2Q/KcVZW3IffoiAxWFnnl rMfZKn/RTlLCJATWEDUjvbusSqiaUguRUF5mVHxdjKEkeOME85wwx96LYmio/gDR9g bPH7ISBzwQV/Q== Received: from mail.u-boot.org (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id 35EF167C5B for ; Fri, 19 Sep 2025 14:16:57 -0600 (MDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1758313016; bh=Zq3Sb/T9BBN1fXcp6kuboptfaKV+xaUCj+21zigJA5A=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Clih+e623Kg7gAeme3quy115up7Hur+OxNUbaDmHp62MII/oT3Rm3wgc6R5BIvcH5 U2Od4TqKqt+B2krdkDbcZ+aHJhENfphr9YteCJT9RKh0Ke4AzhnwPntqzA6I5fYgpi n4DfcdDabK/nUS8CpHl7EGXAmLzGQP7yoawjjAjkrDBs8rfYP4LUWRbLVdoS3JcKc0 UXqhqAbGlYzDRPdc8JcvnLeq5YLYUENpn7DEmZjJ7OTybuyryhxhJN8uE2NZ69FX4W hbEqFXGWP+Tjk0S+24F3jAVnSsXvZMgqELR6m0MT0+/JrmSncHyz9gd84pQdRwAVTF GFmh4uisj2USQ== Received: from localhost (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id 3C5DB67BFC; Fri, 19 Sep 2025 14:16:56 -0600 (MDT) X-Virus-Scanned: Debian amavis at Received: from mail.u-boot.org ([127.0.0.1]) by localhost (mail.u-boot.org [127.0.0.1]) (amavis, port 10026) with ESMTP id MMu7A_2uYqGV; Fri, 19 Sep 2025 14:16:56 -0600 (MDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1758313013; bh=SdTUqfw0NxfM193ZPjc9AOdiqQ77ZARuBjoyCYu5lMk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=fnniCVOFXGX9h3vri7mo9b29GgGrB8C46mcsMjsI8J3rG8FQC6FeB6rQqT5RkDyWX 5bMMmboV52wv4gFO3XN36zMixnYrtmo6N8QWvtyp9LJdFE2W33dlaYFalEJldacQvo Z8Lz13/WMGDs2EVLubif1arqSDJWawKju4fN9ExQFh1XnFihvUmAgs9wOF91Go9BXm Oe2SSseU6/fWirxnkEDsEkhid10uVIH5uRpGpeU/7jNzYqlW/LbwwfO77LSitiXuH+ V5Yi80/pLNh5exAx664kxvERz16F+zzVqlW9rOiM9mT/fX11wDGv9MEKtMaOjNlPwF HHLzY9Hhe7BQw== Received: from u-boot.org (unknown [73.34.74.121]) by mail.u-boot.org (Postfix) with ESMTPSA id B729067A99; Fri, 19 Sep 2025 14:16:52 -0600 (MDT) From: Simon Glass To: U-Boot Concept Date: Fri, 19 Sep 2025 14:14:34 -0600 Message-ID: <20250919201507.4024144-28-sjg@u-boot.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20250919201507.4024144-1-sjg@u-boot.org> References: <20250919201507.4024144-1-sjg@u-boot.org> MIME-Version: 1.0 Message-ID-Hash: 6KHQUNOTRH53NHACUKBNEYVFZ4Q5RWDF X-Message-ID-Hash: 6KHQUNOTRH53NHACUKBNEYVFZ4Q5RWDF 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 27/42] expo: Enable the cursor when editing a textline 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 Call the appropriate vidconsole functions to ensure that the cursor will be enabled while a textline is open. Signed-off-by: Simon Glass --- boot/scene_textline.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/boot/scene_textline.c b/boot/scene_textline.c index b595d3477e4..ba39cfb7cee 100644 --- a/boot/scene_textline.c +++ b/boot/scene_textline.c @@ -145,6 +145,9 @@ int scene_textline_send_key(struct scene *scn, struct scene_obj_textline *tline, /* Copy the backup text from the scene buffer */ memcpy(abuf_data(&tline->buf), abuf_data(&scn->buf), abuf_size(&scn->buf)); + + /* cursor is not needed now */ + vidconsole_readline_end(); } else { event->type = EXPOACT_QUIT; log_debug("menu quit\n"); @@ -241,5 +244,8 @@ int scene_textline_open(struct scene *scn, struct scene_obj_textline *tline) if (ret) return log_msg_ret("sav", ret); + /* make sure the cursor is visible */ + vidconsole_readline_start(true); + return 0; } From patchwork Fri Sep 19 20:14:35 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 370 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=1758313022; bh=GuxhvIETO+PVfv/kGfOI+aPYoehbc3r+Xm2/Y/QfbF8=; 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=rYYCSkUqPBSTyv9SGjmz5uGtMAE4NwEkz+csu+tnTpWPEurxhX+em7Su7S373+YA5 ELTglinenQZmW3cG+6TKROcKAMb3+D5Q9OOeN9jpitC5Av/Mdq3L4r6njgLLd1YgWF jKV/Ta6y3sWiH2AE+YgIPUnMyAacN+ZvU4Zf5AGqdweFNc72kKc4Wfpws6ElG66Bm5 Ox6FTN95ONuGddmXQpnJC3J3groRD3Sew6p2pQMPpanlsFZ9FxAx6yVd5O9l6E/wis yTsdcBNP5wmqorMRqaDegDJzKDeH4S6+m7MCsLRfv5mJR9WNH6P6uh3lLr6EUTJ7G7 0o/6lBMJHpotw== Received: from localhost (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id 008A267C6C for ; Fri, 19 Sep 2025 14:17: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 10024) with ESMTP id Z4dU8fJbADvj for ; Fri, 19 Sep 2025 14:17:01 -0600 (MDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1758313021; bh=GuxhvIETO+PVfv/kGfOI+aPYoehbc3r+Xm2/Y/QfbF8=; 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=GSBN9l2gmTG0CZZ0BwgPoH0UhX27I3avcX582OeRcXGvIvIhmAnxBBs/L2H3rwAb9 sPiADddsm/RN1rX1R+3kZrsu++TWs4BhDcPaHrjQnq617+pJYn0np32bOwO120eLxu 058PnOF8LJqk244wfFeWI0wYh0wakDv/z4UHUa8Kw9CR8cN1eYIzhBZVSMKm7ThCCK YzAbU8XGsQa1iXiuiO6by/JHO2Z3dB1WaOInbUuI1iOP+Fg0TZ8g7ML87osBxEtAZJ dWj0Qr2bx5S92j1pN68rBgRrln3mcauIBxA1qojOg9+KrxZfCVoASUZNWlfMM/yNoc qHrzGqRr3BgKw== Received: from mail.u-boot.org (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id E163467B55 for ; Fri, 19 Sep 2025 14:17:01 -0600 (MDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1758313019; bh=7B7L9wIM/QPTGfWE33WX/j/yO8Uze7egApi41Jz42/8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=L1zz41CW+LGJyyP8L97iMcQl1ZfTodp14ojQi6cJ0Lrq+bc9rWTb37mQ1b9dEUcLd t4sZcmrC4VmGOYWOP5jl9gGdRIa2TB5E3Q74+FExvdC2GVE3z9QRtswoNXLZ4aUa7d +GKUf5GfUI65zuJbTgco8mOCDXRnZgyVmKXa5fRrxY/e1l8c+lMlovqgd0me3kao1+ mPkCoVhL9WYbbJ0u0YqNHo7AEAZVSYYAS7qmY+nnlqhbLDAmhdWKOlHyA+W3crF/IR I0THZ66LYk13lDigGXTFp1bEdqr7T13TY7/8uCSyEm12HS5LEtl6EfpsiNz7M4Utxb yItOwUAl6iwdA== Received: from localhost (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id 89CA967BFC; Fri, 19 Sep 2025 14:16: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 10026) with ESMTP id AA5c6m396M61; Fri, 19 Sep 2025 14:16:59 -0600 (MDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1758313015; bh=GUu88Imq/ju4fw7HacJ0u8mdGOwVDSLbBVA9vEDpvJU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=FIFLA6KK1K6Bq8gaU2FyihrnpqCmqRkLrc8KbNKGDGq0zs/MYYMzrz6OThK++V8SK AiomhUnBbbYPwZJZ/O+7Lz8Rkz5yT2ozcoOHYf1u0XVLr5jSQ2ObToBaFTkS2c82Xb xM9/RIM2ZVta462hpDhLvLFqXkA2i97Ghn1o2f6NCYNcmSJWktUK+Eil7L7zJVY1XW IJzVy3R90WesMFQ25QeVIu2H3MndHukKuRCoX6FG7/doDfKcGsqkbxLjkLR5cZr3Ww m2a/Qusol/VNrfj/z2/rvU8vlhLah23RcgY2nddFkiDcU+eduXg6k+SkULUDoLeTDa Ouy8/+wPZ6g7g== Received: from u-boot.org (unknown [73.34.74.121]) by mail.u-boot.org (Postfix) with ESMTPSA id BEEE767B3B; Fri, 19 Sep 2025 14:16:54 -0600 (MDT) From: Simon Glass To: U-Boot Concept Date: Fri, 19 Sep 2025 14:14:35 -0600 Message-ID: <20250919201507.4024144-29-sjg@u-boot.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20250919201507.4024144-1-sjg@u-boot.org> References: <20250919201507.4024144-1-sjg@u-boot.org> MIME-Version: 1.0 Message-ID-Hash: ZYBMHC5PKSOSE3ZIWC6PK6XTGGEMZ7OH X-Message-ID-Hash: ZYBMHC5PKSOSE3ZIWC6PK6XTGGEMZ7OH 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 28/42] video: Track whether the cursor is enabled List-Id: Discussion and patches related to U-Boot Concept Archived-At: List-Archive: List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: From: Simon Glass The cursor should only be enabled if the user is entering something. This can be at the CLI or in an expo. Provide a flag to track it, which we can (later) use to determine whether or not to draw the cursor. Signed-off-by: Simon Glass --- drivers/video/vidconsole-uclass.c | 10 +++++++++- include/video_console.h | 2 ++ 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/drivers/video/vidconsole-uclass.c b/drivers/video/vidconsole-uclass.c index 9d161f4688e..9ab331af68a 100644 --- a/drivers/video/vidconsole-uclass.c +++ b/drivers/video/vidconsole-uclass.c @@ -919,12 +919,20 @@ void vidconsole_readline_start(bool indent) struct vidconsole_priv *priv = dev_get_uclass_priv(dev); priv->curs.indent = indent; + priv->curs.enabled = true; vidconsole_mark_start(dev); } } void vidconsole_readline_end(void) { - /* TODO: mark the end */ + struct uclass *uc; + struct udevice *dev; + + uclass_id_foreach_dev(UCLASS_VIDEO_CONSOLE, dev, uc) { + struct vidconsole_priv *priv = dev_get_uclass_priv(dev); + + priv->curs.enabled = false; + } } #endif /* CURSOR */ diff --git a/include/video_console.h b/include/video_console.h index c5450f70c4d..af2b8499bb4 100644 --- a/include/video_console.h +++ b/include/video_console.h @@ -29,6 +29,7 @@ enum { * The cursor is set up and maintained by the vidconsole. It is a simple * vertical bar of width VIDCONSOLE_CURSOR_WIDTH shown in the foreground colour. * + * @enabled: cursor is active (e.g. during readline) * @visible: cursor is currently visible * @indent: indent subsequent lines to the same position as the first line * @x: cursor left X position in pixels @@ -37,6 +38,7 @@ enum { * @index: cursor index within the CLI or field being edited */ struct vidconsole_cursor { + bool enabled; bool visible; bool indent; From patchwork Fri Sep 19 20:14:36 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 371 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=1758313025; bh=KtkL+1Cmq1ujrV+qU6MO/cZkL5sCZH5J8dt03z0PWWI=; 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=hQR7CM01SRL2/CDUn9tP4e2P/UnD0+xJw0qEKh6nJ571ujfM8XNGUipfaxF/zggu5 TDHis9YdmExAwxkAfz+KBStBDOYnwnsus2B+zFlEznV62B07/ET6GVJv13czfH8Mb2 1C0n4INmJhMhAjxHvxCk7t1t4kHkgdV5SZk6gTOAHrNPbwiEDBoNfv1ODQeLj7gPNE l4K/TjuGkxbk4gmIMH64i42WotJ4rj6dkDFCI/Zxgq2Tv87ui5z8+YxxAbTrRmnuKZ DRNQwWmdTDh3S8k9QstmEGcLnrAcomMEBp/nvgq+PZ+Jf17dSl9zb2VcAsx7gtvMyk KCFcgrhq2S6Uw== Received: from localhost (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id 5DCA567C81 for ; Fri, 19 Sep 2025 14:17: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 P9Hf9Dokb15p for ; Fri, 19 Sep 2025 14:17:05 -0600 (MDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1758313025; bh=KtkL+1Cmq1ujrV+qU6MO/cZkL5sCZH5J8dt03z0PWWI=; 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=hQR7CM01SRL2/CDUn9tP4e2P/UnD0+xJw0qEKh6nJ571ujfM8XNGUipfaxF/zggu5 TDHis9YdmExAwxkAfz+KBStBDOYnwnsus2B+zFlEznV62B07/ET6GVJv13czfH8Mb2 1C0n4INmJhMhAjxHvxCk7t1t4kHkgdV5SZk6gTOAHrNPbwiEDBoNfv1ODQeLj7gPNE l4K/TjuGkxbk4gmIMH64i42WotJ4rj6dkDFCI/Zxgq2Tv87ui5z8+YxxAbTrRmnuKZ DRNQwWmdTDh3S8k9QstmEGcLnrAcomMEBp/nvgq+PZ+Jf17dSl9zb2VcAsx7gtvMyk KCFcgrhq2S6Uw== Received: from mail.u-boot.org (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id 4E0C267B55 for ; Fri, 19 Sep 2025 14:17:05 -0600 (MDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1758313024; bh=bNv4J3anAnDHnGwL6gxyzHDVFFgSREKcd/SqaHvyugA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=s8Iil0srWnUgZY7yqOdKcYztjzD/S86N4t4uZiS9Hx+BNXbmFZ+MAuDBMplyf2aEL F83BkOWzKUT9Ha4+Y1lfHlK8diW16GZ8EvQAxE/DCVyHRaGuW88bfgbU5LsrwrhEig ZelPIQIKxgg3ttDsI80oHCaOPpDNM+Ax5amzdD0kYXLYgorwBHwHtbk2zp1sWyY3y3 ahOF8EMSzKd29RhGW0yNpH8BE/zwzHgwsS/mE2GwY8P6UuW1Bjh/cHojdzFYyLiM/l Vsy6OolxtPZUI5PMYiJQ5RqwWfI5vb45FUoxWrMMoMtAbyOHoeBsEXsGn3jZ2A26mF 0NwP3LtAW1ysQ== Received: from localhost (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id 5414D67C6C; Fri, 19 Sep 2025 14:17: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 daO9eiiMNTNC; Fri, 19 Sep 2025 14:17:04 -0600 (MDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1758313019; bh=3SootGanyZc5ga1wUkgd7qn4T7b79ZSR+dYn8+N4SjI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=bMACCzHMIQxH9GlhWLzUQuYpeGrkj1O9jq066ifIsKgmeFrgUTbEf2ypyUx/XrTSX qlDOJLczkCxEWZty4feVU0y+N0Ke2//+fZn6tQd1obAc/oul+pOtkc33fiYncDHOEU pmR/YCJiOZR5lOrQ25o1I7JchBIZyNX11X8SF/m2paRok6TcNhL+MMEyHl89r6Jh4/ JL0xs9NZdq0SLgLPSc2oL8Fty+Yqmc/Grj6WmCpCetQmcR7Ba4vX/xGye8eBlfswdt recbRN2zIjOPdDFySSw6pslnuEjOTK7SmoPxW8rX4xrdIGTyV4L2MGvtYcOsj0T/ss JaY8AC4IB58qQ== Received: from u-boot.org (unknown [73.34.74.121]) by mail.u-boot.org (Postfix) with ESMTPSA id 5B9A367A99; Fri, 19 Sep 2025 14:16:59 -0600 (MDT) From: Simon Glass To: U-Boot Concept Date: Fri, 19 Sep 2025 14:14:36 -0600 Message-ID: <20250919201507.4024144-30-sjg@u-boot.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20250919201507.4024144-1-sjg@u-boot.org> References: <20250919201507.4024144-1-sjg@u-boot.org> MIME-Version: 1.0 Message-ID-Hash: TSWDYRJOU7D7SMJ36YM2O25UPCQU3VO4 X-Message-ID-Hash: TSWDYRJOU7D7SMJ36YM2O25UPCQU3VO4 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 29/42] video: Drop vidconsole_set_cursor_visible() List-Id: Discussion and patches related to U-Boot Concept Archived-At: List-Archive: List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: From: Simon Glass There is only one user of this function. Update it to use the new vidconsole_show_cursor() instead. Remove the now-unused vidconsole_set_cursor_visible() Signed-off-by: Simon Glass --- boot/scene_textline.c | 4 ++-- drivers/video/vidconsole-uclass.c | 13 ------------- include/video_console.h | 24 +----------------------- 3 files changed, 3 insertions(+), 38 deletions(-) diff --git a/boot/scene_textline.c b/boot/scene_textline.c index ba39cfb7cee..3d4269a8e05 100644 --- a/boot/scene_textline.c +++ b/boot/scene_textline.c @@ -214,8 +214,8 @@ int scene_textline_render_deps(struct scene *scn, if (ret) return log_msg_ret("sav", ret); - vidconsole_set_cursor_visible(cons, true, txt->obj.bbox.x0, - txt->obj.bbox.y0, scn->cls.num); + vidconsole_show_cursor(cons, txt->obj.bbox.x0, + txt->obj.bbox.y0, scn->cls.num); } return 0; diff --git a/drivers/video/vidconsole-uclass.c b/drivers/video/vidconsole-uclass.c index 9ab331af68a..65c912a4f6f 100644 --- a/drivers/video/vidconsole-uclass.c +++ b/drivers/video/vidconsole-uclass.c @@ -751,19 +751,6 @@ int vidconsole_show_cursor(struct udevice *dev, uint x, uint y, uint index) return 0; } -int vidconsole_set_cursor_visible(struct udevice *dev, bool visible, - uint x, uint y, uint index) -{ - if (visible) { - int ret; - - ret = vidconsole_show_cursor(dev, x, y, index); - if (ret) - return ret; - } - - return 0; -} #endif /* CONFIG_CURSOR */ int vidconsole_mark_start(struct udevice *dev) diff --git a/include/video_console.h b/include/video_console.h index af2b8499bb4..0b8742c5ee9 100644 --- a/include/video_console.h +++ b/include/video_console.h @@ -466,21 +466,6 @@ int vidconsole_entry_restore(struct udevice *dev, struct abuf *buf); */ int vidconsole_show_cursor(struct udevice *dev, uint x, uint y, uint index); -/** - * vidconsole_set_cursor_visible() - Show or hide the cursor - * - * Shows or hides a cursor at the current position - * - * @dev: Console device to use - * @visible: true to show the cursor, false to hide it - * @x: X position in pixels - * @y: Y position in pixels - * @index: Character position (0 = at start) - * Return: 0 if OK, -ve on error - */ -int vidconsole_set_cursor_visible(struct udevice *dev, bool visible, - uint x, uint y, uint index); - /** * vidconsole_readline_start() - Enable cursor for all video consoles * @@ -505,13 +490,6 @@ static inline int vidconsole_show_cursor(struct udevice *dev, uint x, uint y, return 0; } -static inline int vidconsole_set_cursor_visible(struct udevice *dev, - bool visible, uint x, uint y, - uint index) -{ - return 0; -} - static inline void vidconsole_readline_start(bool indent) { } @@ -519,7 +497,6 @@ static inline void vidconsole_readline_start(bool indent) static inline void vidconsole_readline_end(void) { } - #endif /* CONFIG_CURSOR */ static inline void cli_index_adjust(struct vidconsole_priv *priv, int by) @@ -529,6 +506,7 @@ static inline void cli_index_adjust(struct vidconsole_priv *priv, int by) } /** + * vidconsole_push_colour() - Temporarily change the font colour * * @dev: Device to adjust From patchwork Fri Sep 19 20:14:37 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 372 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=1758313029; bh=5txBkhkbr0DckfydSgEjGV9chIoYCoo+RCuod5i3Qp8=; 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=rGQ7zuhplnTqPbJUyRm8qBBIcP0ffSH7U36f9ubxDEwekt723dhxHKSQsidg3gQiR CwxMFRb9y/9RXqrKvvK1u67MySmTFTkA8uYQgOGjS4Cv3EnFTQfCRK92CFZU7A1zcX xaARFS9/1nYYIXQq2f4nRxx/N0GlP25w+cBu30ywDa9W9sfR8EPxiqyvRScOStCofk +F6hjlEiwcC77JGB8IfiD29mqmxbALDQtNDehpxZT/4KHs1emV6ocj3f/Q18Zf0f0A UOT8sUSbeqv5wBNrkuOkyl499TgkQqWNaiwSglTW4IhNcLXlbFjcZhPofaBWm67+M2 HBYKCH7QIR+8w== Received: from localhost (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id B500A67C74 for ; Fri, 19 Sep 2025 14:17: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 10024) with ESMTP id idazNYo6oz3w for ; Fri, 19 Sep 2025 14:17:09 -0600 (MDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1758313029; bh=5txBkhkbr0DckfydSgEjGV9chIoYCoo+RCuod5i3Qp8=; 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=rGQ7zuhplnTqPbJUyRm8qBBIcP0ffSH7U36f9ubxDEwekt723dhxHKSQsidg3gQiR CwxMFRb9y/9RXqrKvvK1u67MySmTFTkA8uYQgOGjS4Cv3EnFTQfCRK92CFZU7A1zcX xaARFS9/1nYYIXQq2f4nRxx/N0GlP25w+cBu30ywDa9W9sfR8EPxiqyvRScOStCofk +F6hjlEiwcC77JGB8IfiD29mqmxbALDQtNDehpxZT/4KHs1emV6ocj3f/Q18Zf0f0A UOT8sUSbeqv5wBNrkuOkyl499TgkQqWNaiwSglTW4IhNcLXlbFjcZhPofaBWm67+M2 HBYKCH7QIR+8w== Received: from mail.u-boot.org (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id A430567C06 for ; Fri, 19 Sep 2025 14:17:09 -0600 (MDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1758313027; bh=eIM6WSGHIVMM87aQ5kjYPMpS/AaU1uR/uMOa11PTNUk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=NSK8sdHlLJ94jX2ccNOadfQxR1Afg6p3W8jvIT6lxkyl5d0czGsfRjNZVK5fxPD5x baBlmoF1wlCjVJZNcQiW5YAGfg+V4HbK5HYS+qa5rlsWGBdDI9StScNAr1PLE2s0Wi RCzZpR3d6b5NvoV0S8nrr3o+PZbc5F42QvNek246QSqG4aNQWZj6n52aeCrPYtz1Ht 5WwgZylFy/W8geNDiemoJI/VAaeaVvkgWf3OJbcbDGurpZx/S/45QiINXD/Q+bBuuU I3GNEKXQQZmLJDKDfXvSWNTBEzhrYT7Y6qxqebDWkModxZWkNmf6k6innk3jkZ1YCR NpG3hz9qgNDNA== Received: from localhost (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id A816167A99; Fri, 19 Sep 2025 14:17: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 10026) with ESMTP id f--BFe9gWe8Q; Fri, 19 Sep 2025 14:17:07 -0600 (MDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1758313024; bh=epnaTwx3I53Hn7HMdFG9FMKyaixQ7ZhCxqp0uPegAic=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=iSRh/xZMttvoPgzeWrfHj9UgB8tutwuVWpH2z3SdamMaFIrRImO3NB9oZsHAsWeAc ktQsBt2MltPZZ3RGypHS7ntOzZ8U9lILKc4Ldfapoh2S8DiMZTMDdML4GKVRr0tqdp YyEhc0b111YAi7pJmoKW+BMp827uZBUVHLS+3pZsLtnmfoM1Z67NOzie9Vp7eInx9i OcF58KaRiUwhln4QrgO/rrTeDkJhDHN+EjXKn8tTywenOpevZUztBbL2+TN11AkrKa 7ClT2YUvOEsJjSkkWwPKLOhd6kIjc/a/kqWmau+uPx64Is/W1cseR+Vo/ZcvXjexEY iuBsbh0T5uBGg== Received: from u-boot.org (unknown [73.34.74.121]) by mail.u-boot.org (Postfix) with ESMTPSA id F3FAF67B3B; Fri, 19 Sep 2025 14:17:03 -0600 (MDT) From: Simon Glass To: U-Boot Concept Date: Fri, 19 Sep 2025 14:14:37 -0600 Message-ID: <20250919201507.4024144-31-sjg@u-boot.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20250919201507.4024144-1-sjg@u-boot.org> References: <20250919201507.4024144-1-sjg@u-boot.org> MIME-Version: 1.0 Message-ID-Hash: LLQGVOGDJO5NM4L5KIW2WWU24G55QAUB X-Message-ID-Hash: LLQGVOGDJO5NM4L5KIW2WWU24G55QAUB 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 30/42] video: Update normal console to use tracking information List-Id: Discussion and patches related to U-Boot Concept Archived-At: List-Archive: List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: From: Simon Glass The console supports keeping track of the index and the start position of the CLI entry. Use this instead of the passed-in values. Signed-off-by: Simon Glass --- drivers/video/console_normal.c | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/drivers/video/console_normal.c b/drivers/video/console_normal.c index ad7eb4661a4..4b00732f98d 100644 --- a/drivers/video/console_normal.c +++ b/drivers/video/console_normal.c @@ -80,31 +80,28 @@ static __maybe_unused int console_get_cursor_info(struct udevice *dev, uint index) { struct vidconsole_priv *vc_priv = dev_get_uclass_priv(dev); - struct udevice *vid = dev->parent; - struct video_priv *vid_priv = dev_get_uclass_priv(vid); struct console_simple_priv *priv = dev_get_priv(dev); struct video_fontdata *fontdata = priv->fontdata; struct vidconsole_cursor *curs = &vc_priv->curs; - int pbytes = VNBYTES(vid_priv->bpix); - void *start, *line; /* for now, this is not used outside expo */ if (!IS_ENABLED(CONFIG_EXPO)) return -ENOSYS; + x = VID_TO_PIXEL(vc_priv->xmark_frac); + y = vc_priv->ymark; + index = vc_priv->cli_index; x += index * fontdata->width; /* place the cursor 1 pixel before the start of the next char */ if (x > 0) x -= 1; - start = vid_priv->fb + y * vid_priv->line_length + x * pbytes; - line = start; - /* Store line pointer and height in cursor struct */ curs->x = x; curs->y = y; curs->height = vc_priv->y_charsize; + curs->index = index; return 0; } From patchwork Fri Sep 19 20:14:38 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 374 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=1758313036; bh=vyYJv+vlXn6hYZ/XiRXyq893RdPUJdsec6uNAZ925vI=; 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=ELYTbFyBcJmYrNTRlY28+UZOFPe4lmbuX0u4Sj/Ffo/wn5yiMcDAbNf1mEFYUUFas mMhzcuSffjaFtXse0jnMZNf1OUzfxhD3KgX7AmRukA7C7jJyyI+6DyeeC4sh4nKiZT svu5Ge/ZPcxc3fYBfU7dwYg/UysOFZR3gW2K0GIC+RXuGaj40WVxKkwbXFCwCqjkjS guDYLaimviD3v3jxaRxs4qE0entuhz1iCmOMR0pI9XPenb2SAu2nwdul8+5MgKvooY jeGCkVArObFJVh8Bu4nNDwLQC7NXBYKTXlywPi9LPExpIXVQNMkUa1HmQgpzeTEdem kCcrNOjesCPFQ== Received: from localhost (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id A326F67C83 for ; Fri, 19 Sep 2025 14:17:16 -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 tfGhF3my62t3 for ; Fri, 19 Sep 2025 14:17:16 -0600 (MDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1758313034; bh=vyYJv+vlXn6hYZ/XiRXyq893RdPUJdsec6uNAZ925vI=; 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=PXU2WyaVnuAmaiEq/FEbwvGDfZ+2IPo36Mmie0Ue2YgLKd2eucuto2iZvVYOYbrWU ssjXm26VkQxOkps0soUhu3202OT5wymFPiAz3ql0539DwZmPz1hn7U76L3nFcLRMax QSxpHtnVNt1EHmWzGBjtW/17LzTmb13TIkNELSyFX5rTcHOPBv+nMeFrVad6Zq1tfz LXimj0qASSdY6F7UrbW24tfa3oOT84XPY4SUzTrVx1f/5Wqh/OkkFXIIixbeZRLx60 hSTOXlErzTf4aJ8+A0ZGee9CqGPhUW1pi6CDSccgpB2vvRSYDfalmcTMfdAcMwC/6o twjWlBm48zVfg== Received: from mail.u-boot.org (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id 9AD8D67A99 for ; Fri, 19 Sep 2025 14:17:14 -0600 (MDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1758313032; bh=7JNM/4CMvTUkSh1twyt+z7P2PypTz2p4aVgwSm/5CA8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=V35vkXG7NEAJxwbx8X6vtjvGJsj8CeR7RrSl5PzZ5RuP7zveZpBUM9o2sPD6I9KwC qWw4x+EYZwdEJLQA6UWR5h5hOQ+qNGUOw5NB5WUDClLq2HUkgjGFfPHVVmnioEKWC2 /VuKhHxOdutyMvTrsHjFomNy0VwDdjX0FcWZ/nL9f5ERSvLZionU+ooScPiCaQk3qJ IHGjXaDSMYEz1pFP7+1c4o2JMReT35RVXq364RkTIh22mYcbtIhuE6o/UHsEYaTM8b UgluX4FNrDpJY3vh+ODC0uGR66bmYJCk5pzivQCAbegbY0m/34uCg1nHc8bj7GdREs Dh4yE+4mtqIiw== Received: from localhost (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id 07C5667C0E; Fri, 19 Sep 2025 14:17: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 10026) with ESMTP id mxakRIXpl7qA; Fri, 19 Sep 2025 14:17:11 -0600 (MDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1758313026; bh=9qGKyOO+MGao6frNO6/yUrPlK3xCLGetghO3Cm2M/Ko=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=gddVXI+VhjlOKFHyDa363dm9YcX1yczS+07R+gZyCFWCy5E+/GWSCWxCNhtw/pYgH nSBM4uXV4M+Rq8ZMDFhDb3OPNT/xbfS1YVF+YhgBQLDg8RqSPZI7cpbXzDoYBHNyCB LJrA7OgavgQqL1ntP82D7fJiR8l39B5Z9nFNM9zBZDITakQ5d9V4ApL0j+C/rsxWSQ 5uE5ZdWEYNiZa2ywx6Rfib3gkmud+ggZy5reoh4UGG+a4Kb5GVZMT/Ki1mr+L/96Ka THV8jjwd7Xuu1cAyBVy9oxbLzfSPpNRwXGAJ+SmUT/cW4xGMpavFjV06h/g197/7I4 Mq+BiEAEJ74Xg== Received: from u-boot.org (unknown [73.34.74.121]) by mail.u-boot.org (Postfix) with ESMTPSA id 0555667B55; Fri, 19 Sep 2025 14:17:05 -0600 (MDT) From: Simon Glass To: U-Boot Concept Date: Fri, 19 Sep 2025 14:14:38 -0600 Message-ID: <20250919201507.4024144-32-sjg@u-boot.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20250919201507.4024144-1-sjg@u-boot.org> References: <20250919201507.4024144-1-sjg@u-boot.org> MIME-Version: 1.0 Message-ID-Hash: JZ4ULHQR63XL7BX3X2MNZFETBYETT6NA X-Message-ID-Hash: JZ4ULHQR63XL7BX3X2MNZFETBYETT6NA 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 31/42] video: Add save and restore drivers for normal console List-Id: Discussion and patches related to U-Boot Concept Archived-At: List-Archive: List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: From: Simon Glass Provide these two methods so that we can use expo lineedits with the normal console (i.e. no truetype). This allows the cursor to be positioned correctly when editing the lineedit and rendering the expo. Signed-off-by: Simon Glass --- drivers/video/console_normal.c | 48 ++++++++++++++++++++++++++++++++++ 1 file changed, 48 insertions(+) diff --git a/drivers/video/console_normal.c b/drivers/video/console_normal.c index 4b00732f98d..ac7053d60a8 100644 --- a/drivers/video/console_normal.c +++ b/drivers/video/console_normal.c @@ -8,11 +8,18 @@ #include #include +#include #include #include #include /* Get font data, width and height */ #include "vidconsole_internal.h" +struct console_store { + int xpos_frac; + int ypos; + int cli_index; +}; + static int console_set_row(struct udevice *dev, uint row, int clr) { struct video_priv *vid_priv = dev_get_uclass_priv(dev->parent); @@ -106,6 +113,45 @@ static __maybe_unused int console_get_cursor_info(struct udevice *dev, return 0; } +static __maybe_unused int normal_entry_save(struct udevice *dev, + struct abuf *buf) +{ + struct vidconsole_priv *vc_priv = dev_get_uclass_priv(dev); + struct console_store store; + const uint size = sizeof(store); + + if (xpl_phase() <= PHASE_SPL) + return -ENOSYS; + + if (!abuf_realloc(buf, size)) + return log_msg_ret("sav", -ENOMEM); + + store.xpos_frac = vc_priv->xcur_frac; + store.ypos = vc_priv->ycur; + store.cli_index = vc_priv->cli_index; + memcpy(abuf_data(buf), &store, size); + + return 0; +} + +static __maybe_unused int normal_entry_restore(struct udevice *dev, + struct abuf *buf) +{ + struct vidconsole_priv *vc_priv = dev_get_uclass_priv(dev); + struct console_store store; + + if (xpl_phase() <= PHASE_SPL) + return -ENOSYS; + + memcpy(&store, abuf_data(buf), sizeof(store)); + + vc_priv->xcur_frac = store.xpos_frac; + vc_priv->ycur = store.ypos; + vc_priv->cli_index = store.cli_index; + + return 0; +} + static int console_putc_xy(struct udevice *dev, uint x_frac, uint y, int cp) { return console_normal_putc_xy(dev, x_frac, y, cp); @@ -120,6 +166,8 @@ struct vidconsole_ops console_ops = { .select_font = console_simple_select_font, #ifdef CONFIG_CURSOR .get_cursor_info = console_get_cursor_info, + .entry_save = normal_entry_save, + .entry_restore = normal_entry_restore, #endif }; From patchwork Fri Sep 19 20:14:39 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 373 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=1758313034; bh=iq0wJoaVRPFCXf3B9N9qJKyhIJZWpbDfG+nai9wayr0=; 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=V4V1my7nmDO4fDV/HRtEquf3jRtZLhz08siMomVG7T3+GFzeiAJSNpZr6Sc1MOg7v T7c0yRer8Ije6e6v941xdowoJVsUtgMsS7nBBB/Ag3C5YJz8sIqEJSPYTXqg98EVm1 PoLIh/QHa9xiL0hqlpg9cqSfI5NDklzHR0ynL4k9yU7qNSfP03Wx5ytGzvA9C5jdh+ HUxTqGg1z/0Mc72QZWIwyIfZZ7b1mUSh6KrVV7d8/jLmDPDcqSgmaiFvSlbqMYDAEJ wEp9IUa8BTqLwFAOx8oXDVc/4Nsmys6n3OsZDADGcOLr39zWM0TMO3WBpYDhFm48OO JlgcQF3ReKkZQ== Received: from localhost (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id 508E067C74 for ; Fri, 19 Sep 2025 14:17:14 -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 f_A9j-iCIjf7 for ; Fri, 19 Sep 2025 14:17:14 -0600 (MDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1758313034; bh=iq0wJoaVRPFCXf3B9N9qJKyhIJZWpbDfG+nai9wayr0=; 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=V4V1my7nmDO4fDV/HRtEquf3jRtZLhz08siMomVG7T3+GFzeiAJSNpZr6Sc1MOg7v T7c0yRer8Ije6e6v941xdowoJVsUtgMsS7nBBB/Ag3C5YJz8sIqEJSPYTXqg98EVm1 PoLIh/QHa9xiL0hqlpg9cqSfI5NDklzHR0ynL4k9yU7qNSfP03Wx5ytGzvA9C5jdh+ HUxTqGg1z/0Mc72QZWIwyIfZZ7b1mUSh6KrVV7d8/jLmDPDcqSgmaiFvSlbqMYDAEJ wEp9IUa8BTqLwFAOx8oXDVc/4Nsmys6n3OsZDADGcOLr39zWM0TMO3WBpYDhFm48OO JlgcQF3ReKkZQ== Received: from mail.u-boot.org (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id 3F05F67C0E for ; Fri, 19 Sep 2025 14:17:14 -0600 (MDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1758313032; bh=fw2aIOj7ftbMGD3si72mHi3+Z2X6QFLCuSd3FD+L3Kg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Uo+H+GfYJViaVQRgV8JQy+ReyKKDobhxs7qDQpkJ0Szzl94ArWR5t4mDOZIZSqihU 8+rHg4X+E+6ZvF+mKijeX+mqrJxvAtea23SwOCSObqTW9vovTKX4RHcWQOIXxmUP22 +8R/jaoIKC4qLGbuZcqZayMuPUCggOPCKYsdDMJkUh9XkrxGKTdSRrq+lONbG2SEHt 0FSLo11Dax87OfJzAagS6G4kfgFMqNqbohrCTB1SU2SqtaLyYcO63y083h6Nhe7l9i pPfzQ5B/S1nu3Qs9BVDOwHqEFNz7mk89k50yycEJ292r1VGHueW61xN9zJ2wrmmY8X TnInOV841qRfA== Received: from localhost (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id 07C6E67C74; Fri, 19 Sep 2025 14:17: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 10026) with ESMTP id SI8PGvSiyg0G; Fri, 19 Sep 2025 14:17:11 -0600 (MDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1758313030; bh=weOMTQ0g/beaeQsMF33aeuN+EviwNSA8I5m4POYbl/k=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=JJ4zUnEhAeqIwC5xmTiwEslVT7ZgWVEP+NfiumkQpFY0TmaYYgCPqpBn0iOTVfe8K aPis7g5M0G98kueJgDErjKJXm4gDsqumPmvL0j9KclS63DzYEJAXgQ+SYZYACOKEC0 Tmz+4GfHbA/CTv/E7qHYL5qt3ocBVcEeHj6MtEnR7qL+Knd4O1uk1EPMxi4NWMH7Od /4K0Us67kk8FxD+loUOL+QRYl/oTfGGsY+WSPXLi0Rabnp1whKN5rAhMbNgGcrAlzz RBHw216WjkcvBJ3+q1BvTSmLiEU97pRbbUyZnSdOQCu8CLkFbJ+xbxU5s4b8ZzchNt CRtnw4CIkQgaA== Received: from u-boot.org (unknown [73.34.74.121]) by mail.u-boot.org (Postfix) with ESMTPSA id 905AC67A99; Fri, 19 Sep 2025 14:17:10 -0600 (MDT) From: Simon Glass To: U-Boot Concept Date: Fri, 19 Sep 2025 14:14:39 -0600 Message-ID: <20250919201507.4024144-33-sjg@u-boot.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20250919201507.4024144-1-sjg@u-boot.org> References: <20250919201507.4024144-1-sjg@u-boot.org> MIME-Version: 1.0 Message-ID-Hash: SITLTDWONSU5KGDXXG4KDR7X5AV3LCME X-Message-ID-Hash: SITLTDWONSU5KGDXXG4KDR7X5AV3LCME 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 32/42] video: Drop extra parameters from get_cursor_info() 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 Now that the console tracks the CLI index, remove the unnecessary parameters. Both the normal and truetype consoles use the information provided by the console. Signed-off-by: Simon Glass --- drivers/video/console_normal.c | 5 ++--- drivers/video/console_truetype.c | 20 +++++++++----------- drivers/video/vidconsole-uclass.c | 11 ++++++----- include/video_console.h | 11 ++++------- 4 files changed, 21 insertions(+), 26 deletions(-) diff --git a/drivers/video/console_normal.c b/drivers/video/console_normal.c index ac7053d60a8..5ef1cb1c68f 100644 --- a/drivers/video/console_normal.c +++ b/drivers/video/console_normal.c @@ -82,14 +82,13 @@ int console_normal_putc_xy(struct udevice *dev, uint x_frac, uint y, int cp) return console_fixed_putc_xy(dev, x_frac, y, cp, priv->fontdata); } -static __maybe_unused int console_get_cursor_info(struct udevice *dev, - bool visible, uint x, uint y, - uint index) +static __maybe_unused int console_get_cursor_info(struct udevice *dev) { struct vidconsole_priv *vc_priv = dev_get_uclass_priv(dev); struct console_simple_priv *priv = dev_get_priv(dev); struct video_fontdata *fontdata = priv->fontdata; struct vidconsole_cursor *curs = &vc_priv->curs; + int x, y, index; /* for now, this is not used outside expo */ if (!IS_ENABLED(CONFIG_EXPO)) diff --git a/drivers/video/console_truetype.c b/drivers/video/console_truetype.c index aabacd10afe..e215a3e0e54 100644 --- a/drivers/video/console_truetype.c +++ b/drivers/video/console_truetype.c @@ -1018,12 +1018,12 @@ static int truetype_entry_restore(struct udevice *dev, struct abuf *buf) return 0; } -static int truetype_get_cursor_info(struct udevice *dev, bool visible, - uint x, uint y, uint index) +static int truetype_get_cursor_info(struct udevice *dev) { struct vidconsole_priv *vc_priv = dev_get_uclass_priv(dev); struct console_tt_priv *priv = dev_get_priv(dev); struct vidconsole_cursor *curs = &vc_priv->curs; + int x, y, index; uint height; if (xpl_phase() <= PHASE_SPL) @@ -1034,14 +1034,12 @@ static int truetype_get_cursor_info(struct udevice *dev, bool visible, * passed-in values, since an entry_restore() must have been done before * calling this function. */ - if (visible) { - index = priv->pos_ptr; - if (index < priv->pos_ptr) - x = VID_TO_PIXEL(priv->pos[index].xpos_frac); - else - x = VID_TO_PIXEL(vc_priv->xcur_frac); - y = vc_priv->ycur; - } + index = priv->pos_ptr; + if (index < priv->pos_ptr) + x = VID_TO_PIXEL(priv->pos[index].xpos_frac); + else + x = VID_TO_PIXEL(vc_priv->xcur_frac); + y = vc_priv->ycur; /* Get font height from current font type */ if (priv->cur_fontdata) @@ -1052,8 +1050,8 @@ static int truetype_get_cursor_info(struct udevice *dev, bool visible, /* Store line pointer and height in cursor struct */ curs->x = x; curs->y = y; - curs->index = index; curs->height = height; + curs->index = index; return 0; } diff --git a/drivers/video/vidconsole-uclass.c b/drivers/video/vidconsole-uclass.c index 65c912a4f6f..f62e34673db 100644 --- a/drivers/video/vidconsole-uclass.c +++ b/drivers/video/vidconsole-uclass.c @@ -720,11 +720,12 @@ int vidconsole_show_cursor(struct udevice *dev, uint x, uint y, uint index) int ret; /* find out where the cursor should be drawn */ - if (ops->get_cursor_info) { - ret = ops->get_cursor_info(dev, true, x, y, index); - if (ret && ret != -ENOSYS) - return ret; - } + if (!ops->get_cursor_info) + return -ENOSYS; + + ret = ops->get_cursor_info(dev); + if (ret) + return ret; /* If the driver stored cursor line and height, use them for drawing */ if (curs->height) { diff --git a/include/video_console.h b/include/video_console.h index 0b8742c5ee9..669292c97d7 100644 --- a/include/video_console.h +++ b/include/video_console.h @@ -342,17 +342,14 @@ struct vidconsole_ops { /** * get_cursor_info() - Get cursor position info * - * Calculates and stores cursor position information + * Calculates and stores cursor position information. This must fill in + * @x, @y, @height and @index using struct vidconsole_priv fields + * @xmark_frac, @ymark and @index * * @dev: Console device to use - * @visible: true to show the cursor, false to hide it - * @x: X position in pixels - * @y: Y position in pixels - * @index: Character position (0 = at start) * Return: 0 if OK, -ve on error */ - int (*get_cursor_info)(struct udevice *dev, bool visible, - uint x, uint y, uint index); + int (*get_cursor_info)(struct udevice *dev); /** * mark_start() - Mark the current position as the state of CLI entry From patchwork Fri Sep 19 20:14:40 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 375 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=1758313036; bh=pwGVARoM1LmKilZX7Sj6k5f5jQylW0Z+YlCgPW7MQO4=; 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=bu5kXW2OUqGb/S9cLoXESDkHBKzCSolfu3oc9TBU3ND5DTILuRmKTfrFuxbAj+omE ZRf8IOEM9EdVJqhxKHbCKWTZV8JGTdOoefRr9n422WZqH4491iPgRbxWy+5g9UKR7Q YbITf1PaZGSqIdhqaDwxCR3CbcZJu2IB3F4KdPEW/HD/RbwzUsFIUYf/W4TTIWq6NS ymK2nmGoPzlvAzqABBGfML57KtU+YMpfXeVMwrObttPPBlac7oOzwhmm+KOcrTgcXB tJUXgG/atLZsYMydYTPkjwsktIpWllp6SLDWcuYRfirzqk/xHR8w5fjhdqxAyaTwr1 i+0o5WUskaRog== Received: from localhost (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id D811567C8C for ; Fri, 19 Sep 2025 14:17:16 -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 BriK3xeayx1O for ; Fri, 19 Sep 2025 14:17:16 -0600 (MDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1758313034; bh=pwGVARoM1LmKilZX7Sj6k5f5jQylW0Z+YlCgPW7MQO4=; 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=XlyszUXcXzHmTTfxd5dn9Jbv6/Ni7q0bL9IEdrAqZVGuApgnfE8QE67jsq8vjgQwX YtTG3ywEwisZREkRcLpFrvzRD3jhdBtRAgRuOwQpSVNFK5mCfbA/xoclJoVSlfUxiL VibwaUmkU0mX6p8DXvOhuuvzMBGKqlNWI+6fZXTDuJN4l098/RMebWXM2l0VuKXcoI jrChUWqHjP+h5tsaE223GwwKPD1mUJXTT4FhB3YpCDLVa4kTPhYeLFL5liuQXMFxkC TKo5kvhKhiETz8xaHEmp7NDOY2hqk4JqDRWtxZG+W7fF1e3ToxB8VQLU7zeSjCcgAB tASt75nTtzasQ== Received: from mail.u-boot.org (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id EA96067C81 for ; Fri, 19 Sep 2025 14:17:14 -0600 (MDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1758313032; bh=LGrdsajODZhUXJkQmuLq1c0AnDiODYqBM5zhNndwT/k=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=D/TC4X30Xedj4DNpXjGpIc0DuTH6Ojev6QAOOGAmJsOI9/ZaehQB5r+GL3FijhKiy uS9xFZRkqH+KYYTFIYZSH6B84P+3Cie5lleg8W4YEyr1SAtLCcjhXV8pEx3B6Dz9kB +qlf6zUZwYWlyFiZlEk6zlQbCqgSCMC1thJEbZgmZs+QYL6uMuKz3husmX+SiURrDi 3HvrT6AegqnUiG6RG3LXRVfSx6VTvK428759ZE66T5UZj+BrDME9ZFQSFk2H+xKOFg ce2EQg2txW85YyCI7LO/W8eIgCVXvaVEQIsvpTnZyWiXOFQeo9vdKA/OrLMr0kc60z 35M/AxhDL+FVQ== Received: from localhost (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id 1ABDF67A99; Fri, 19 Sep 2025 14:17: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 10026) with ESMTP id 4QJr8viukK8o; Fri, 19 Sep 2025 14:17:12 -0600 (MDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1758313031; bh=pkmgTo/evbBv0kqOnAkFoqLPnCzpi8bC6gdMFBB14GM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=dSGKfipzoYdIWAXF0LxdbI8AmpaZHHUcYpRZsSKgxb5kDW9t0IJEXFHUT0bE+rcHh EPaLJfRkqAe+trzNpoGunytoUImuBEc0neXNjK5b53WvbDwo2VUCnUEwlMmCQNoWsc Y/i2RkYHHJlya/8g0P0uYlYFrocik4DcG0iybzlfJRju4eibIlwx3F/jjVGRDnM9d3 EsOhuzHrRizyl4Y1uQ4jbJB/x5Vc6jZzlwjhcv4VCCaRTBys23xm/OnwiID63af7og YIWRy60iZAEH/WA+++GJIVscvZLfay305aNVuzm2G9Clz6X3y1pFRrl/yEVXfaYLqO utIcjQm3Nm1wA== Received: from u-boot.org (unknown [73.34.74.121]) by mail.u-boot.org (Postfix) with ESMTPSA id 7ACF267C06; Fri, 19 Sep 2025 14:17:11 -0600 (MDT) From: Simon Glass To: U-Boot Concept Date: Fri, 19 Sep 2025 14:14:40 -0600 Message-ID: <20250919201507.4024144-34-sjg@u-boot.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20250919201507.4024144-1-sjg@u-boot.org> References: <20250919201507.4024144-1-sjg@u-boot.org> MIME-Version: 1.0 Message-ID-Hash: JBPPSMBUZJLAJJP2IPVTHG4HMTTBXT4G X-Message-ID-Hash: JBPPSMBUZJLAJJP2IPVTHG4HMTTBXT4G 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 33/42] video: Support a cursor in multi-line text 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 For expo, lineedit only supports a single line. For the CLI, the text can extend across multiple lines. Add support for this in the normal console, calculating the x and y offset of the cursor position based on the display width and font size. The truetype console already works, since it has had this tracking for a while. Signed-off-by: Simon Glass --- drivers/video/console_normal.c | 29 ++++++++++++++++++++++++++--- 1 file changed, 26 insertions(+), 3 deletions(-) diff --git a/drivers/video/console_normal.c b/drivers/video/console_normal.c index 5ef1cb1c68f..8f936191dd8 100644 --- a/drivers/video/console_normal.c +++ b/drivers/video/console_normal.c @@ -88,7 +88,7 @@ static __maybe_unused int console_get_cursor_info(struct udevice *dev) struct console_simple_priv *priv = dev_get_priv(dev); struct video_fontdata *fontdata = priv->fontdata; struct vidconsole_cursor *curs = &vc_priv->curs; - int x, y, index; + int x, y, index, xspace, xpos; /* for now, this is not used outside expo */ if (!IS_ENABLED(CONFIG_EXPO)) @@ -97,7 +97,30 @@ static __maybe_unused int console_get_cursor_info(struct udevice *dev) x = VID_TO_PIXEL(vc_priv->xmark_frac); y = vc_priv->ymark; index = vc_priv->cli_index; - x += index * fontdata->width; + + /* rounded up character position in this line */ + xpos = (x + vc_priv->x_charsize - 1) / vc_priv->x_charsize; + + /* number of characters which can fit on this (first) line */ + xspace = vc_priv->cols - xpos; + + if (!curs->indent && index > xspace) { + /* move to the next line */ + y += vc_priv->y_charsize; + index -= xspace; + + /* figure out the available space in subsequent lines */ + if (!curs->indent) { + xspace = vc_priv->cols; + x = 0; + } + + /* calculate the line based on that */ + y += index / xspace; + x += (index % xspace) * fontdata->width; + } else { + x += index * fontdata->width; + } /* place the cursor 1 pixel before the start of the next char */ if (x > 0) @@ -107,7 +130,7 @@ static __maybe_unused int console_get_cursor_info(struct udevice *dev) curs->x = x; curs->y = y; curs->height = vc_priv->y_charsize; - curs->index = index; + curs->index = vc_priv->cli_index; return 0; } From patchwork Fri Sep 19 20:14: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: 376 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=1758313041; bh=uRdKjbkrdTFy+Pm5G1AlncJM6pHZNBp36bZEK7K+6DI=; 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=Xmy5LSk/rWgRuVAnYflASI+sn/BRpUkyJCUELqjZJaH9Anu3Yp7lndAmuYM9kPQkw bIzgfmJwdsvh1yRqG0BB7MusxPu6SiUFhcwh1VS9Fnwq8xo8mJqdzi48XcNwUn+ouG xpvBqDh0zZP2QCXXKcyxP+fjJ25JPEFWU6IIXS4Rn1QQ0Ee4VtXB8cHr0+deGUj/Dc yP7ETgd2QNnX1IYUxxFbVBldLnfBvF2/bYi4gakPyXxdopX3fHzZ7RN17UWouuL+Ok OlzxPXpj7KVwS4ihCxkdEYnvIWlY8yduD7vQRCEylQS+S3jBtBZHaURA8JnHnWJDSi VO0avwzjzV2kA== Received: from localhost (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id D6EA367C74 for ; Fri, 19 Sep 2025 14:17:21 -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 LRvbWzV3wBSi for ; Fri, 19 Sep 2025 14:17:21 -0600 (MDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1758313041; bh=uRdKjbkrdTFy+Pm5G1AlncJM6pHZNBp36bZEK7K+6DI=; 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=Xmy5LSk/rWgRuVAnYflASI+sn/BRpUkyJCUELqjZJaH9Anu3Yp7lndAmuYM9kPQkw bIzgfmJwdsvh1yRqG0BB7MusxPu6SiUFhcwh1VS9Fnwq8xo8mJqdzi48XcNwUn+ouG xpvBqDh0zZP2QCXXKcyxP+fjJ25JPEFWU6IIXS4Rn1QQ0Ee4VtXB8cHr0+deGUj/Dc yP7ETgd2QNnX1IYUxxFbVBldLnfBvF2/bYi4gakPyXxdopX3fHzZ7RN17UWouuL+Ok OlzxPXpj7KVwS4ihCxkdEYnvIWlY8yduD7vQRCEylQS+S3jBtBZHaURA8JnHnWJDSi VO0avwzjzV2kA== Received: from mail.u-boot.org (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id C498B67B3B for ; Fri, 19 Sep 2025 14:17:21 -0600 (MDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1758313039; bh=i+AY4z8B24oZaIT8zhIjE8VMOxEFjgis2JpiUDBMLg0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Oup9aPanmNhEKshkuBnr6TFhKPFJP0QubKvATOTp8jZ6W1gS2ijHUGmhvoKhZj5WW ZlTZrTejiRO98qioBC7tqwgeZTpWvSl/P/TLj0zjGEq9gcYiz+FNd+cBzJf8Fwl/Wv zr7//mPslFSxIun1483Kxtk9sDZug2LfK5ceVA9YSodfHQdiK0FwY0oKAuAxPcRa/H JMH2Jv/H7mfkJ2kgDaxKdSCXjC9bEfeG5OqNGTaZWErIRMD95KD0AXEv7pOoHFT+ex Q/EnRiCKP5ZJTSvGL5PdyBY5nCKS4MZutuuhDa0I5IQtcVCUVtc8TL7jtTEB+fCw5D Cuvp4u7O8i2ew== Received: from localhost (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id 1D76D67C0E; Fri, 19 Sep 2025 14:17: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 10026) with ESMTP id axAJCbYkBAqD; Fri, 19 Sep 2025 14:17:19 -0600 (MDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1758313032; bh=LaxOfUkqo5djV9zbifQ+xFJn9TOfI4B69vkt+/ZIfPY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=EbkbEH9TYC7rvLRYsG5Vly19qXEu/OaJQNSNIkSg9bL0D95OUUhGDEkbSmYPdu/K2 zsDaF2ZK2w3tfK3OsDV14acqATwxy4dae1XJrshZWdmBzwcPZVgFyFWfXl/S+Vw8Xp SBz7vj0CFjkNehSqUpn1b22dgyuVy/AaxEmDjwdJijbACpJaFam8jaT5h7aD61Icrp aGMKn6KvzHnVTgUoXqDEktgG7l3wA2AFv39Y8YUWIH1nqhlSx01zqqQrMVcvaQ+fu1 wjcYKQ3jVhwgjPc9MfKX22QLxTO3PZey1tJpt7UVLVdl+GSaJ7UDv8CL89bCoAM/e5 5ALPldRSPQ1hg== Received: from u-boot.org (unknown [73.34.74.121]) by mail.u-boot.org (Postfix) with ESMTPSA id 5EA0467B3B; Fri, 19 Sep 2025 14:17:12 -0600 (MDT) From: Simon Glass To: U-Boot Concept Date: Fri, 19 Sep 2025 14:14:41 -0600 Message-ID: <20250919201507.4024144-35-sjg@u-boot.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20250919201507.4024144-1-sjg@u-boot.org> References: <20250919201507.4024144-1-sjg@u-boot.org> MIME-Version: 1.0 Message-ID-Hash: C42ZOPYHVQE5XM36R5OQVXRNREXUSXXV X-Message-ID-Hash: C42ZOPYHVQE5XM36R5OQVXRNREXUSXXV 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 34/42] video: Drop extra parameters from vidconsole_show_cursor() 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 Now that both console drivers use the CLI index, we don't need the extra parameters for this. Drop them. Signed-off-by: Simon Glass --- boot/scene_textline.c | 3 +-- drivers/video/vidconsole-uclass.c | 4 ++-- include/video_console.h | 12 +++--------- 3 files changed, 6 insertions(+), 13 deletions(-) diff --git a/boot/scene_textline.c b/boot/scene_textline.c index 3d4269a8e05..7e01959c40d 100644 --- a/boot/scene_textline.c +++ b/boot/scene_textline.c @@ -214,8 +214,7 @@ int scene_textline_render_deps(struct scene *scn, if (ret) return log_msg_ret("sav", ret); - vidconsole_show_cursor(cons, txt->obj.bbox.x0, - txt->obj.bbox.y0, scn->cls.num); + vidconsole_show_cursor(cons); } return 0; diff --git a/drivers/video/vidconsole-uclass.c b/drivers/video/vidconsole-uclass.c index f62e34673db..15b62d160cd 100644 --- a/drivers/video/vidconsole-uclass.c +++ b/drivers/video/vidconsole-uclass.c @@ -712,7 +712,7 @@ int vidconsole_entry_restore(struct udevice *dev, struct abuf *buf) } #ifdef CONFIG_CURSOR -int vidconsole_show_cursor(struct udevice *dev, uint x, uint y, uint index) +int vidconsole_show_cursor(struct udevice *dev) { struct vidconsole_priv *priv = dev_get_uclass_priv(dev); struct vidconsole_ops *ops = vidconsole_get_ops(dev); @@ -747,7 +747,7 @@ int vidconsole_show_cursor(struct udevice *dev, uint x, uint y, uint index) curs->height); } - priv->curs.visible = true; + curs->visible = true; return 0; } diff --git a/include/video_console.h b/include/video_console.h index 669292c97d7..b40253b218d 100644 --- a/include/video_console.h +++ b/include/video_console.h @@ -451,17 +451,12 @@ int vidconsole_entry_restore(struct udevice *dev, struct abuf *buf); /** * vidconsole_show_cursor() - Show the cursor * - * Shows a cursor at the specified position. The position is passed in, but for - * the truetype console it is not actually used, since it tracks where the - * cursor must go. + * Shows a cursor at the current position. * * @dev: Console device to use - * @x: X position in pixels - * @y: Y position in pixels - * @index: Character position (0 = at start) * Return: 0 if OK, -ve on error */ -int vidconsole_show_cursor(struct udevice *dev, uint x, uint y, uint index); +int vidconsole_show_cursor(struct udevice *dev); /** * vidconsole_readline_start() - Enable cursor for all video consoles @@ -481,8 +476,7 @@ void vidconsole_readline_start(bool indent); */ void vidconsole_readline_end(void); #else -static inline int vidconsole_show_cursor(struct udevice *dev, uint x, uint y, - uint index) +static inline int vidconsole_show_cursor(struct udevice *dev) { return 0; } From patchwork Fri Sep 19 20:14: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: 377 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=1758313044; bh=unMY5ueFIzxdPAHvJyZv7KSOmOs+WqV1En9meDQQR20=; 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=vEASm8lvXJgUo7UteaV40Czg/6y1LsUxpeLVpmkAc6d16IInuoKHLH2ZrfPKd0Cor 3KKyQUfJYxe8J4WDD7xybOpIr2Ma832WCK/dAuevsrpHhnh6JoUBt/dhd87Z52/Axw eCmodjr0L+Y23SzHZ4TGMfVwdGkGu7GWjgZI8H+gtp645tqgVW9TzQXe7CFAVlLCbI L/fOXG8Q0BOVPR/HFieJBnb+MLX5a4NZq0nqc/weiJe3N8InLMqu6iPdAE5PSRwOcP PDAT9fn1Q5/+pKJQOTapxyRvL0sfXQltIDf8l/9JiqeAXGvqphbdQkHSmWRWc8nCXY yiDK5z6exu1fg== Received: from localhost (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id 425A367C6C for ; Fri, 19 Sep 2025 14:17: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 Cbhbm_M8W_BP for ; Fri, 19 Sep 2025 14:17:24 -0600 (MDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1758313042; bh=unMY5ueFIzxdPAHvJyZv7KSOmOs+WqV1En9meDQQR20=; 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=JB7iCShd5hKFEoxPSofXByN7Cw+00WFWVfB3s884RysoxCAEpi55E7/UhvGABm7TX zRTGC2gMk+9DvnGD+RQemiYS4aXrjGXk+98AG1SAETixen77IKFThWSZncD/opRJrC tz93ZwISlc80hguv10hzjkJhbUL+h3CJ0M3iRSGCkqmpZ+Pk5DEixQP6SWMAPGYS7u VwA6YjSq1ds9FOz2FBu4gk3JlXgPixIDe2JCgShl1dS2yMSNtYuGOeAFkNUEUUonG1 d9Sm1WKj8zwBbsSjP5LVn4vcLZaY10YbeAY9vCa5sxRx/J2AOgh65mqiMoZouNjdD9 yqrYFExXidR1w== Received: from mail.u-boot.org (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id 3B19067C0E for ; Fri, 19 Sep 2025 14:17:22 -0600 (MDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1758313039; bh=qX/3ZzWMi1fFCxfcBPwy8fgfpDzFCh73G39sD1eB7Xs=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=bR3Ptv0b0eG5akyD4TugnbdykJyIPme8I0fE/OzaKl+Nm2HM1P2boflLSq1lItlA8 7HC/OwL9q1i4CiX+ohjecFvsUBvZDysROst2SHjPqvHqFkWfyNvfpahZxtGT7hK5sF 2JjIg1gXvuUehp9ig/tO7sfoW1M7OawOHUA845VmdXKx5N2z1e6dnIPO0qBhY2cCsk XIrmjKQQvXqJysZ9phFllNqTTIzI3CLFF20ZM8zQxn4CoZGFw+JW8M01in28l/3Eko IhnV+mAyh7vTgZqBFvmY4fOaK7Bc/bxMNRivij12UyuP+XWNxyuWP/Uj5S6d1e/5tp wREs10YXROk2w== Received: from localhost (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id 275EA67B3B; Fri, 19 Sep 2025 14:17: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 10026) with ESMTP id 6zH8gKJw62A7; Fri, 19 Sep 2025 14:17:19 -0600 (MDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1758313037; bh=4nq7TZJ71bMceY2rUChXnWgHhM6nsI2Bw1avKY6ViU0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=mOVbX2aIhPGTsIYxW+CS/KiQ5e0jlSmg7DD/uBU2zXPld9mX/jP/C8ARbFgkIj5bc a1K1YOq0Lg1YNTqnNRs6ggJblCw2BmbH6pBL1CKv5yea+K00g5ewWecwEv484qJDwQ g9KVTl2KxBQsbYNfY/fnzm5I1YElkZCzmza06EnH/PDcP26mUPTgjZGzXRM+rg2Mx1 fe9EtHfJgxBks6Io8nm954sF5quBLyOFoK0DcYP+v9gaN8xBrwuHvtjIBWk2FTNg7R 3rwoqOT5Pi3ZnJdFr8qAf1lmyeavT5AV8ELeEl97J1ACoQdzAnUfG005bMct+/JemV +9xmUfT21H/sg== Received: from u-boot.org (unknown [73.34.74.121]) by mail.u-boot.org (Postfix) with ESMTPSA id 0A44567C8F; Fri, 19 Sep 2025 14:17:16 -0600 (MDT) From: Simon Glass To: U-Boot Concept Date: Fri, 19 Sep 2025 14:14:42 -0600 Message-ID: <20250919201507.4024144-36-sjg@u-boot.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20250919201507.4024144-1-sjg@u-boot.org> References: <20250919201507.4024144-1-sjg@u-boot.org> MIME-Version: 1.0 Message-ID-Hash: EKWDJ4E5R25W7LFPCH6GTZXCH26Q6OWU X-Message-ID-Hash: EKWDJ4E5R25W7LFPCH6GTZXCH26Q6OWU 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 35/42] video: Provide a buffer to hold pixels behind the cursor 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 Drawing the cursor is a destructive operation, so we must save the previous contents of the affected part of the framebuffer, so it can be restored afterwards. Add this to the cursor info and set it up when probing the console device. Signed-off-by: Simon Glass --- drivers/video/console_core.c | 41 ++++++++++++++++++++++++++++- drivers/video/console_truetype.c | 4 +++ drivers/video/vidconsole_internal.h | 10 +++++++ include/video_console.h | 4 +++ 4 files changed, 58 insertions(+), 1 deletion(-) diff --git a/drivers/video/console_core.c b/drivers/video/console_core.c index 6db42e63ea9..b1688e717c9 100644 --- a/drivers/video/console_core.c +++ b/drivers/video/console_core.c @@ -9,6 +9,8 @@ #include #include #include +#include +#include #include #include "vidconsole_internal.h" @@ -198,9 +200,46 @@ int cursor_show(struct vidconsole_cursor *curs, struct video_priv *vid_priv, return 0; } +int console_alloc_cursor(struct udevice *dev) +{ + struct vidconsole_priv *vc_priv; + struct vidconsole_cursor *curs; + struct video_priv *vid_priv; + struct udevice *vid; + int save_count; + + if (!CONFIG_IS_ENABLED(CURSOR) || xpl_phase() < PHASE_BOARD_R) + return 0; + + vc_priv = dev_get_uclass_priv(dev); + vid = dev_get_parent(dev); + vid_priv = dev_get_uclass_priv(vid); + curs = &vc_priv->curs; + + /* Allocate cursor save buffer for maximum possible cursor height */ + save_count = vid_priv->ysize * VIDCONSOLE_CURSOR_WIDTH; + curs->save_data = malloc(save_count * sizeof(u32)); + if (!curs->save_data) + return -ENOMEM; + + return 0; +} + int console_probe(struct udevice *dev) { - return console_set_font(dev, fonts); + int ret; + + ret = console_set_font(dev, fonts); + if (ret) + return ret; + + if (CONFIG_IS_ENABLED(CURSOR) && xpl_phase() == PHASE_BOARD_R) { + ret = console_alloc_cursor(dev); + if (ret) + return ret; + } + + return 0; } const char *console_simple_get_font_size(struct udevice *dev, uint *sizep) diff --git a/drivers/video/console_truetype.c b/drivers/video/console_truetype.c index e215a3e0e54..fc2985ed92f 100644 --- a/drivers/video/console_truetype.c +++ b/drivers/video/console_truetype.c @@ -1111,6 +1111,10 @@ static int console_truetype_probe(struct udevice *dev) debug("%s: ready\n", __func__); + ret = console_alloc_cursor(dev); + if (ret) + return ret; + return 0; } diff --git a/drivers/video/vidconsole_internal.h b/drivers/video/vidconsole_internal.h index c008b9cf7d3..4cb6ba4e15f 100644 --- a/drivers/video/vidconsole_internal.h +++ b/drivers/video/vidconsole_internal.h @@ -123,6 +123,16 @@ int fill_char_horizontally(uchar *pfont, void **line, struct video_priv *vid_pri int cursor_show(struct vidconsole_cursor *curs, struct video_priv *vid_priv, bool direction); +/** + * console_alloc_cursor() - Allocate cursor save buffer + * + * Allocates memory for saving pixels under the cursor + * + * @dev: vidconsole device + * Return: 0 if success, -ENOMEM if allocation fails + */ +int console_alloc_cursor(struct udevice *dev); + /** * console probe function. * diff --git a/include/video_console.h b/include/video_console.h index b40253b218d..ffe331c5803 100644 --- a/include/video_console.h +++ b/include/video_console.h @@ -32,6 +32,8 @@ enum { * @enabled: cursor is active (e.g. during readline) * @visible: cursor is currently visible * @indent: indent subsequent lines to the same position as the first line + * @saved: true if save_data contains valid data + * @save_data: saved pixels under cursor * @x: cursor left X position in pixels * @y: cursor top Y position in pixels * @height: height of cursor in pixels @@ -41,6 +43,8 @@ struct vidconsole_cursor { bool enabled; bool visible; bool indent; + bool saved; + u32 *save_data; /* filled in by get_cursor_info(): */ uint x; From patchwork Fri Sep 19 20:14: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: 378 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=1758313048; bh=SBTr9oQnoJsUODG/31DtSESWwrj6jaJpagF4q5wZUQY=; 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=fXMitbEORIcVzfFy/d2fFkhauQT8oTywoNK/VSFuSWUv57owKr4OnLmGG4czjUvvn x6lEe7DiU7hGCqij9STN9IgUZOGxF8HE8YTqO3RUnXv+s6PdYe/vAbtBnmGeBXlRjM RYL+BVEnul+Tqfz9s0ziGrl42LQ5KtW3SXiN8Hx+3w53B7BgR4uFa+3oukIwHQNFpc vjCoKC1d2fqDnu7li/KZBq2hBnGlmMPgGlnDxfPX2/4QtjdQEvUPsZF99Khcfnz7pd sAe0334wpNXn88+NShIHY17pD1E3Tz75GUe70F4WKTKae6gfxbQy9xZxmh3MEis9yo V+Oi4B0XfjiYg== Received: from localhost (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id 9F8CC67BFC for ; Fri, 19 Sep 2025 14:17: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 vf8Nwgijf970 for ; Fri, 19 Sep 2025 14:17:28 -0600 (MDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1758313048; bh=SBTr9oQnoJsUODG/31DtSESWwrj6jaJpagF4q5wZUQY=; 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=fXMitbEORIcVzfFy/d2fFkhauQT8oTywoNK/VSFuSWUv57owKr4OnLmGG4czjUvvn x6lEe7DiU7hGCqij9STN9IgUZOGxF8HE8YTqO3RUnXv+s6PdYe/vAbtBnmGeBXlRjM RYL+BVEnul+Tqfz9s0ziGrl42LQ5KtW3SXiN8Hx+3w53B7BgR4uFa+3oukIwHQNFpc vjCoKC1d2fqDnu7li/KZBq2hBnGlmMPgGlnDxfPX2/4QtjdQEvUPsZF99Khcfnz7pd sAe0334wpNXn88+NShIHY17pD1E3Tz75GUe70F4WKTKae6gfxbQy9xZxmh3MEis9yo V+Oi4B0XfjiYg== Received: from mail.u-boot.org (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id 8F64867C06 for ; Fri, 19 Sep 2025 14:17:28 -0600 (MDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1758313046; bh=ALT+PR3q55DIRU329bhhQjZUjLN6qV9vHP7K3+87zWM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Cmyl0vNCTgQPxZaqXowFaJI7KZ3RFoOUcGs2ZdwMIGB+oDdKoPczck5vvbzRvLpau Nf75ft5OizP60rLxg8uOtB7N/DVK0Pxa2lodJcXvZcehy3eN/rQONWf5gEUMes/kWK iTCFaD0hcOcV+1m+G8jY5eOlryZb38Vlu67YzjekufC6M/TgHppiDm81Sn0G3ggxqS rmk/SoEOWwli/3pw2y0iO4m3zlEoGhuwE2+CFTleN1HfnhxR+Id6tC6cQwLSMtHiig GpjVn/ltDs+S/gtGBu/bk/WU4yGwosn+OPYuYq8cRXIkjS33PXlcHDTtvkUv9J8LAC Tnx8xs82uuSCw== Received: from localhost (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id 8022B67C06; Fri, 19 Sep 2025 14:17: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 b50dme6iCQoE; Fri, 19 Sep 2025 14:17:26 -0600 (MDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1758313039; bh=rtLA4nuX+Qmtpo2iXWC9841R6wYQO3QAkKFnVtDB+4s=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Ijjl5dLR+tSSMIjBsZqzrz+Jg6cuJ6fevulD79FJ5vboDfUrWPFVibIzkAQIr3nNJ sD78lV5uTiN1xSkylJWcJzrnnKja2QlPfTS1TsEj3PKCfh0u1r44uQl0y76dTzsAcE O/r9i3+U9/vxnPskJtTD45dofrRdPlY9P1hUbfV7c8PcYr7E+tYDRYaP7RMgswGsqO PiaZyAnJPysF65vesQJfBZI2aRnwV4Ckyx1YM9BmND0qZ4LltoOjz7AZAPVJSqmnoT odH1BfFgOclpFQGLrDzaUqPepCgoXzIlaZq5CkQF8JIqYORSZGRBwzCBiail2AbDgq ClXMRkbFHAs9w== Received: from u-boot.org (unknown [73.34.74.121]) by mail.u-boot.org (Postfix) with ESMTPSA id 1176967A99; Fri, 19 Sep 2025 14:17:19 -0600 (MDT) From: Simon Glass To: U-Boot Concept Date: Fri, 19 Sep 2025 14:14:43 -0600 Message-ID: <20250919201507.4024144-37-sjg@u-boot.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20250919201507.4024144-1-sjg@u-boot.org> References: <20250919201507.4024144-1-sjg@u-boot.org> MIME-Version: 1.0 Message-ID-Hash: 6AGQINEQR7HDBGZEWAAKO7X2RSAAHIVS X-Message-ID-Hash: 6AGQINEQR7HDBGZEWAAKO7X2RSAAHIVS 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 36/42] video: Support reading the framebuffer when writing 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 Create a variant of fill_pixel_and_goto_next() function which returns the old pixel value. This will make it easy to save the framebuffer pixels as they are overwritten by drawing the cursor. Leave the current function alone, since it increases code size about 16 bytes and may slow down blitting. Signed-off-by: Simon Glass --- drivers/video/console_core.c | 25 +++++++++++++++++++++++++ drivers/video/vidconsole_internal.h | 12 ++++++++++++ 2 files changed, 37 insertions(+) diff --git a/drivers/video/console_core.c b/drivers/video/console_core.c index b1688e717c9..4fab5a2605e 100644 --- a/drivers/video/console_core.c +++ b/drivers/video/console_core.c @@ -61,6 +61,31 @@ inline void fill_pixel_and_goto_next(void **dstp, u32 value, int pbytes, int ste *dstp = dst_byte + step; } +inline u32 swap_pixel_and_goto_next(void **dstp, u32 value, int pbytes, int step) +{ + u8 *dst_byte = *dstp; + u32 old_value = 0; + + if (pbytes == 4) { + u32 *dst = *dstp; + old_value = *dst; + *dst = value; + } + if (pbytes == 2) { + u16 *dst = *dstp; + old_value = *dst; + *dst = value; + } + if (pbytes == 1) { + u8 *dst = *dstp; + old_value = *dst; + *dst = value; + } + *dstp = dst_byte + step; + + return old_value; +} + int fill_char_vertically(uchar *pfont, void **line, struct video_priv *vid_priv, struct video_fontdata *fontdata, bool direction) { diff --git a/drivers/video/vidconsole_internal.h b/drivers/video/vidconsole_internal.h index 4cb6ba4e15f..93f9c7b4e56 100644 --- a/drivers/video/vidconsole_internal.h +++ b/drivers/video/vidconsole_internal.h @@ -45,6 +45,18 @@ int check_bpix_support(int bpix); */ void fill_pixel_and_goto_next(void **dstp, u32 value, int pbytes, int step); +/** + * swap_pixel_and_goto_next() - Swap 1 pixel in framebuffer, and go to next one + * + * @param dstp a pointer to pointer to framebuffer. + * @param value value to write to framebuffer. + * @param pbytes framebuffer bytes per pixel. + * @param step framebuffer pointer increment. Usually is equal to pbytes, + * and may be negative to control filling direction. + * Return: old value of the pixel + */ +u32 swap_pixel_and_goto_next(void **dstp, u32 value, int pbytes, int step); + /** * Fills 1 character in framebuffer vertically. Vertically means we're filling char font data rows * across the lines. From patchwork Fri Sep 19 20:14: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: 379 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=1758313048; bh=Xolh9sPpL4Fhe8SBviksbQ5XaFssdS1gSMuMIRU6Hx8=; 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=UVfuTxaJ7/fkp/uNrvhqXi8kFJmgl3S6yLcYchUElATNsNnjIt1dYzehHfw6WQBAO ih75rGrnzmbSkW1LvYbHm921e/X+nVClnHDadIP1DH/9JkLZI2ynYFCgz3zlFtuws9 CETPChU2VM1GgKPGw1/9bYpXVDDKMMICHHq2a4YAVpkJvEPc9OQV+wLL+fKyk4wv6E 4UPnPEc5SKI8qe5MLKigfFOoNxPP1QdHvsQNC4D0OulEg62f1tIzS/NgDs+ViAXMkk 6ZBBmru8bRev9HGQ/lIzUA/DvB+z7vPPx+2CnFtV+AeMe4RBB0kSEkPNCbKEgdI2j9 bfDbBbHd2GttA== Received: from localhost (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id F15A767C8E for ; Fri, 19 Sep 2025 14:17: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 F9U5qLhCQFtB for ; Fri, 19 Sep 2025 14:17:28 -0600 (MDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1758313048; bh=Xolh9sPpL4Fhe8SBviksbQ5XaFssdS1gSMuMIRU6Hx8=; 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=UVfuTxaJ7/fkp/uNrvhqXi8kFJmgl3S6yLcYchUElATNsNnjIt1dYzehHfw6WQBAO ih75rGrnzmbSkW1LvYbHm921e/X+nVClnHDadIP1DH/9JkLZI2ynYFCgz3zlFtuws9 CETPChU2VM1GgKPGw1/9bYpXVDDKMMICHHq2a4YAVpkJvEPc9OQV+wLL+fKyk4wv6E 4UPnPEc5SKI8qe5MLKigfFOoNxPP1QdHvsQNC4D0OulEg62f1tIzS/NgDs+ViAXMkk 6ZBBmru8bRev9HGQ/lIzUA/DvB+z7vPPx+2CnFtV+AeMe4RBB0kSEkPNCbKEgdI2j9 bfDbBbHd2GttA== Received: from mail.u-boot.org (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id E115967C06 for ; Fri, 19 Sep 2025 14:17:28 -0600 (MDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1758313046; bh=vs2BhE74ejAKiLRXa4UaWVUWDRDQuxK2rcUT9KmWAz8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=HVtge+2C+hm0RnQKMB3PUoe4IbYvhIiFSlkXK2lkybZMwSw1ALLD359hIY0rqporv XpAVbft77fsLqmE+f9Q3YzWHLhvSSUU898xLfK4K+7q7ycaXVa1mr8N6k8sK2FLy4L WgqsmeJvMG6U1Ni2Lej4EP/knBnJlUcIHfTgFi1siNm2kBL2YZdg5+iKOBVNdaKW2J zOvn4ZUexumUDVWchkWohWtCRemf/OU/DjSusXV5j6Tfx6VlJWWJqFZP0O6EZXaaiV e5B5G14PYaGLMxnwimV4BP73r9KdGZZ0fpkc3ZHKoy3YuS4Ec5DMTmi2va43HIU+r1 0Hop5glLrJ3xQ== Received: from localhost (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id 81F4867C0E; Fri, 19 Sep 2025 14:17: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 3kpCTTEU45H5; Fri, 19 Sep 2025 14:17:26 -0600 (MDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1758313044; bh=DE4oZGcFs7eoF+x3UlvSruhE/O8V2PYuwOZdbqCUi/s=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=VX/yz0zQc5Bja+HY0MmUBH/cWxEQGqzpVsBAvSBoWO/nYv+LngSXgRFBxyrLmKRAJ HL8U3RwOO/ZAs55YXPmRWsEEkW3D0UK3cqT4+K4kem6IndhwNW4eqJQoDD3EOjn8IB cL+um/EKjpfaqGIEPrV8jqNWBeI000BZqKR9VUc/ycy9JFRjJdVdZzuLcr3f5ADJdj om6lGqs/ZW8VY6QnEug/7ApOTbvYp/7fR11gun7EPGv0v8eRzZdVSYECpegSQhGYj/ /BLL7OtqWZo+s2rh8vWOWyOSNdEwLjB+UUveXA00jIHIyDbvzAt0te+sNFoVRQTqWO CpDpWtvaVThYQ== Received: from u-boot.org (unknown [73.34.74.121]) by mail.u-boot.org (Postfix) with ESMTPSA id B22EE67B55; Fri, 19 Sep 2025 14:17:23 -0600 (MDT) From: Simon Glass To: U-Boot Concept Date: Fri, 19 Sep 2025 14:14:44 -0600 Message-ID: <20250919201507.4024144-38-sjg@u-boot.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20250919201507.4024144-1-sjg@u-boot.org> References: <20250919201507.4024144-1-sjg@u-boot.org> MIME-Version: 1.0 Message-ID-Hash: ZH6DF477HPXIHOQOUO5W535TWP7MZHXN X-Message-ID-Hash: ZH6DF477HPXIHOQOUO5W535TWP7MZHXN 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 37/42] video: Save overwritten pixels when drawing the cursor 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 Save the pixels overwritten by the cursor into the save area. Signed-off-by: Simon Glass --- drivers/video/console_core.c | 63 ++++++++++++++++++++++++++--- drivers/video/vidconsole-uclass.c | 36 +++++++++++++++++ drivers/video/vidconsole_internal.h | 15 ++++++- include/video_console.h | 16 +++++++- 4 files changed, 122 insertions(+), 8 deletions(-) diff --git a/drivers/video/console_core.c b/drivers/video/console_core.c index 4fab5a2605e..3f3efb94ab1 100644 --- a/drivers/video/console_core.c +++ b/drivers/video/console_core.c @@ -190,8 +190,9 @@ int fill_char_horizontally(uchar *pfont, void **line, struct video_priv *vid_pri int cursor_show(struct vidconsole_cursor *curs, struct video_priv *vid_priv, bool direction) { - int step, line_step, pbytes, ret; + int step, line_step, pbytes, ret, row; void *line, *dst; + u32 *save_ptr; uint value; ret = check_bpix_support(vid_priv->bpix); @@ -207,20 +208,72 @@ int cursor_show(struct vidconsole_cursor *curs, struct video_priv *vid_priv, line_step = vid_priv->line_length; } + /* we should not already have saved data */ + if (curs->saved) { + debug("Trying to show cursor but data is already saved\n"); + return -EINVAL; + } + /* Figure out where to write the cursor in the frame buffer */ line = vid_priv->fb + curs->y * vid_priv->line_length + curs->x * VNBYTES(vid_priv->bpix); + /* save pixels under cursor and draw new cursor in one pass */ value = vid_priv->colour_fg; - - for (int row = 0; row < curs->height; row++) { + save_ptr = curs->save_data; + for (row = 0; row < curs->height; row++) { dst = line; for (int col = 0; col < VIDCONSOLE_CURSOR_WIDTH; col++) - fill_pixel_and_goto_next(&dst, value, pbytes, step); - + *save_ptr++ = swap_pixel_and_goto_next(&dst, value, + pbytes, step); line += line_step; } + curs->saved = true; + + return 0; +} + +int cursor_hide(struct vidconsole_cursor *curs, struct video_priv *vid_priv, + bool direction) +{ + int step, line_step, pbytes, ret; + void *line, *dst; + + ret = check_bpix_support(vid_priv->bpix); + if (ret) + return ret; + + pbytes = VNBYTES(vid_priv->bpix); + if (direction) { + step = -pbytes; + line_step = -vid_priv->line_length; + } else { + step = pbytes; + line_step = vid_priv->line_length; + } + + /* Trying to hide cursor - we should have saved data */ + if (!curs->saved) { + debug("Trying to hide cursor but no data was saved\n"); + return -EINVAL; + } + + /* Figure out where to write the cursor in the frame buffer */ + line = vid_priv->fb + curs->y * vid_priv->line_length + + curs->x * VNBYTES(vid_priv->bpix); + + /* Restore saved pixels */ + u32 *save_ptr = curs->save_data; + dst = line; + for (int row = 0; row < curs->height; row++) { + void *row_dst = dst; + for (int col = 0; col < VIDCONSOLE_CURSOR_WIDTH; col++) + fill_pixel_and_goto_next(&row_dst, *save_ptr++, pbytes, + step); + dst += line_step; + } + curs->saved = false; return 0; } diff --git a/drivers/video/vidconsole-uclass.c b/drivers/video/vidconsole-uclass.c index 15b62d160cd..3621714c742 100644 --- a/drivers/video/vidconsole-uclass.c +++ b/drivers/video/vidconsole-uclass.c @@ -71,6 +71,9 @@ static int vidconsole_back(struct udevice *dev) return ret; } + /* Hide cursor at old position if it's visible */ + vidconsole_hide_cursor(dev); + priv->xcur_frac -= VID_TO_POS(priv->x_charsize); if (priv->xcur_frac < priv->xstart_frac) { priv->xcur_frac = (priv->cols - 1) * @@ -128,6 +131,9 @@ void vidconsole_set_cursor_pos(struct udevice *dev, int x, int y) { struct vidconsole_priv *priv = dev_get_uclass_priv(dev); + /* Hide cursor at old position if it's visible */ + vidconsole_hide_cursor(dev); + priv->xcur_frac = VID_TO_POS(x); priv->xstart_frac = priv->xcur_frac; priv->ycur = y; @@ -473,6 +479,9 @@ int vidconsole_put_char(struct udevice *dev, char ch) struct vidconsole_priv *priv = dev_get_uclass_priv(dev); int cp, ret; + /* Hide cursor to avoid artifacts */ + vidconsole_hide_cursor(dev); + if (priv->escape) { vidconsole_escape_char(dev, ch); return 0; @@ -752,6 +761,33 @@ int vidconsole_show_cursor(struct udevice *dev) return 0; } +int vidconsole_hide_cursor(struct udevice *dev) +{ + struct vidconsole_priv *priv = dev_get_uclass_priv(dev); + struct vidconsole_cursor *curs = &priv->curs; + int ret; + + if (!curs->visible) + return 0; + + /* If the driver stored cursor line and height, use them for drawing */ + if (curs->height) { + struct udevice *vid = dev_get_parent(dev); + struct video_priv *vid_priv = dev_get_uclass_priv(vid); + + ret = cursor_hide(curs, vid_priv, NORMAL_DIRECTION); + if (ret) + return ret; + + /* Update display damage for cursor area */ + video_damage(vid, curs->x, curs->y, VIDCONSOLE_CURSOR_WIDTH, + curs->height); + } + + curs->visible = false; + + return 0; +} #endif /* CONFIG_CURSOR */ int vidconsole_mark_start(struct udevice *dev) diff --git a/drivers/video/vidconsole_internal.h b/drivers/video/vidconsole_internal.h index 93f9c7b4e56..241be149ac9 100644 --- a/drivers/video/vidconsole_internal.h +++ b/drivers/video/vidconsole_internal.h @@ -112,7 +112,7 @@ int fill_char_horizontally(uchar *pfont, void **line, struct video_priv *vid_pri struct video_fontdata *fontdata, bool direction); /** - * cursor_show() - Draw a simple vertical cursor + * cursor_show() - Show cursor by saving and drawing pixels * * @curs: cursor information * @vid_priv: video-device info @@ -130,11 +130,22 @@ int fill_char_horizontally(uchar *pfont, void **line, struct video_priv *vid_pri *|---!!we're starting from upper left char corner| *|-----------------------------------------------| * - * Return: 0, if success, or else error code. + * Return: 0 on success, -EINVAL if cursor data already saved */ int cursor_show(struct vidconsole_cursor *curs, struct video_priv *vid_priv, bool direction); +/** + * cursor_hide() - Hide cursor by restoring saved pixels + * + * @curs: cursor information + * @vid_priv: video-device info + * @direction: controls cursor orientation (normal or flipped) + * Return: 0 if success, -EINVAL if no cursor data was saved + */ +int cursor_hide(struct vidconsole_cursor *curs, struct video_priv *vid_priv, + bool direction); + /** * console_alloc_cursor() - Allocate cursor save buffer * diff --git a/include/video_console.h b/include/video_console.h index ffe331c5803..9005e9f4442 100644 --- a/include/video_console.h +++ b/include/video_console.h @@ -462,6 +462,16 @@ int vidconsole_entry_restore(struct udevice *dev, struct abuf *buf); */ int vidconsole_show_cursor(struct udevice *dev); +/** + * vidconsole_hide_cursor() - Hide the cursor + * + * Hides the cursor if it's currently visible + * + * @dev: Console device to use + * Return: 0 if OK, -ve on error + */ +int vidconsole_hide_cursor(struct udevice *dev); + /** * vidconsole_readline_start() - Enable cursor for all video consoles * @@ -485,6 +495,11 @@ static inline int vidconsole_show_cursor(struct udevice *dev) return 0; } +static inline int vidconsole_hide_cursor(struct udevice *dev) +{ + return 0; +} + static inline void vidconsole_readline_start(bool indent) { } @@ -501,7 +516,6 @@ static inline void cli_index_adjust(struct vidconsole_priv *priv, int by) } /** - * vidconsole_push_colour() - Temporarily change the font colour * * @dev: Device to adjust From patchwork Fri Sep 19 20:14: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: 380 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=1758313053; bh=Krz/V40WW6sO4KkHqJQ2KZz6bST7esc8Ofp7xnEnAEk=; 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=EZD+/dLCjs5gmdGTdtMMEvYnF8t2Q/MHwaJkbpLwNcJa7LObiiNmHBkR12q0E4bDB 5JjkgkDC0N1K4ckfC0sQ522vY63Wa1iSguUnFjwRm59265farTUPRi2gFXsrSIlPAl w2z0g6fHzdWrCb5XQqRavmc3LiZOHjRjD9uR2h2HxSAq0AC2VH4IqiCBgqtflF+ZQ+ x5aYBCr0sE5LMeRiVnKOYvsljvkTXCbbbfQCPLCSKD/0B5dPRNNXN7ZWhf8WpsP5UA W58/Hi0Ogk/9Jp8N63/jy6S58dFIX3Ii8Qecj4gygVLFzXnMICVPvu+RvekvhDKQYA LRcC4r3BgBImA== Received: from localhost (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id 52E7C67C83 for ; Fri, 19 Sep 2025 14:17: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 10024) with ESMTP id oOSMK3y3TnKB for ; Fri, 19 Sep 2025 14:17:33 -0600 (MDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1758313053; bh=Krz/V40WW6sO4KkHqJQ2KZz6bST7esc8Ofp7xnEnAEk=; 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=EZD+/dLCjs5gmdGTdtMMEvYnF8t2Q/MHwaJkbpLwNcJa7LObiiNmHBkR12q0E4bDB 5JjkgkDC0N1K4ckfC0sQ522vY63Wa1iSguUnFjwRm59265farTUPRi2gFXsrSIlPAl w2z0g6fHzdWrCb5XQqRavmc3LiZOHjRjD9uR2h2HxSAq0AC2VH4IqiCBgqtflF+ZQ+ x5aYBCr0sE5LMeRiVnKOYvsljvkTXCbbbfQCPLCSKD/0B5dPRNNXN7ZWhf8WpsP5UA W58/Hi0Ogk/9Jp8N63/jy6S58dFIX3Ii8Qecj4gygVLFzXnMICVPvu+RvekvhDKQYA LRcC4r3BgBImA== Received: from mail.u-boot.org (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id 433F367BFC for ; Fri, 19 Sep 2025 14:17:33 -0600 (MDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1758313051; bh=a/s1ZyA0OhOHaBlsENOIaLu78XpIo7XByajHRBYcJ3c=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ju0/cTMslOTJUzjYRN7umcxUIHKb6vWHj+oGIwiA33mK1jMS+ENS2Yowm/eCOb4G6 M4j+lMBvV7gPzeIXtdEneslOB6inWPWLVO0BTUmuXNyqX3bYb/Zzt3Qo8qKHj8enUS 2FyMw3wgzSwT7fed6uqh8rCqxvJb7cVG1sK9zoL6QQfsQUK3t0G+u4afvxzPCe3bbB H1tvSy/hi+DONdkB+tcBusbJ2IU155Rh46OH1X8KbO+Iz9oiX6Y1YmTyjjQ0JNoBwS tbo21qO7IditWktx0Tn9/LDx3RzeFkXpZQeOkwp5G+cTTJQZ+A0PzbmMPlDBoNPPYx IWpzA5FSR7krg== Received: from localhost (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id 4963367C06; Fri, 19 Sep 2025 14:17:31 -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 6sRbAmSpI1rb; Fri, 19 Sep 2025 14:17:31 -0600 (MDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1758313046; bh=M3LXCK4gX4zLeWYbxz1vdQi61XBlwFb9gvbMfjb/+QE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=INj3qxkakeXrHhXSr1QL2Dyf+qF95Q6CEIg438hn87XlnwAlVvmKbfBUt3Utu7Y/c e7Zr8jtny1zacaxFRlCncuoxaURKgKsAPe1neVcI6iDWtp81uiUS6bieSFWXRzPim/ vDHVIPDy/PUY9NYpOeFxHVFgTRgnyWgbiwxU197kUgFCxeSYCC9WJPmreO/CklDULF iR1mpW+tj05aZ9BfempillLTohq47V63OCZWHLGYbwkMk6PxU2f8PrnqgXhFLSi0eu 3h9Q89rndbPxppoDHTkKUBh9kVssiiMl7LDZTOdKIgSj6vboaGh19gIvzPIsLN6zcI tdfJMxf2RwWWg== Received: from u-boot.org (unknown [73.34.74.121]) by mail.u-boot.org (Postfix) with ESMTPSA id C9C7067B3B; Fri, 19 Sep 2025 14:17:25 -0600 (MDT) From: Simon Glass To: U-Boot Concept Date: Fri, 19 Sep 2025 14:14:45 -0600 Message-ID: <20250919201507.4024144-39-sjg@u-boot.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20250919201507.4024144-1-sjg@u-boot.org> References: <20250919201507.4024144-1-sjg@u-boot.org> MIME-Version: 1.0 Message-ID-Hash: VVH6OBND6ROKSJ2TBH7J2LWL3V7TQJ4J X-Message-ID-Hash: VVH6OBND6ROKSJ2TBH7J2LWL3V7TQJ4J 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 38/42] video: Show the cursor when idle List-Id: Discussion and patches related to U-Boot Concept Archived-At: List-Archive: List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: From: Simon Glass When the console is idle and at the CLI, ensure the cursor is visible. Signed-off-by: Simon Glass --- drivers/video/vidconsole-uclass.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/drivers/video/vidconsole-uclass.c b/drivers/video/vidconsole-uclass.c index 3621714c742..52a51b5e1c1 100644 --- a/drivers/video/vidconsole-uclass.c +++ b/drivers/video/vidconsole-uclass.c @@ -931,6 +931,18 @@ void vidconsole_set_bitmap_font(struct udevice *dev, void vidconsole_idle(struct udevice *dev) { + struct vidconsole_priv *priv = dev_get_uclass_priv(dev); + struct vidconsole_cursor *curs = &priv->curs; + + /* Only handle cursor if it's enabled */ + if (curs->enabled && !curs->visible) { + /* + * TODO(sjg@chromium.org): We are using a saved position here, + * but vidconsole_show_cursor() calls get_cursor_info() to + * recalc the position anyway. + */ + vidconsole_show_cursor(dev); + } } #ifdef CONFIG_CURSOR From patchwork Fri Sep 19 20:14: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: 381 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=1758313055; bh=lLodAZTgmP1kAsniY9oJKIJpBFinulQjsUinEaOnlaw=; 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=Qc9Amd2Wm30LyrFH0EPcwZvJ1+BiGOvtrKDB6qgKcRieKVQWKfH3jXqyElqi4RwMd yNjbMY23lNS+gzNbQlLCslxD0lp3T4XsyWjPuZRZU2rPHHaNPtnEKLxITQreTqs+x8 ik9RTPleArS1B1RZvSUTq8V2nKnEiMwuPXpYL9yflopNi4BvVmY4JQf+f9GFdrfGCU oE4ihjEnduE9QS2m3dcdrw63SjS2dXLqFbtvv29uMdUaGXypHxPHruGomcWt0G0KKn pKLNsIiwXFZVnJgKhWvxL3i70/WwohLOSYdxm4lMbWym14hYsX5erOV1GGOtvRy0gJ OQ9q482N2UeJA== Received: from localhost (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id 0AEC767C88 for ; Fri, 19 Sep 2025 14:17:35 -0600 (MDT) X-Virus-Scanned: Debian amavis at Received: from mail.u-boot.org ([127.0.0.1]) by localhost (mail.u-boot.org [127.0.0.1]) (amavis, port 10024) with ESMTP id czQniurCNOXN for ; Fri, 19 Sep 2025 14:17:34 -0600 (MDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1758313054; bh=lLodAZTgmP1kAsniY9oJKIJpBFinulQjsUinEaOnlaw=; 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=ffVNrKMJJGiZTtRMnOJA3ldCIrur3q0O8rc2EvKTJIgKsPbSvGJkd3d8iq+RDXL4O ACvNk5PIv+DMvwvo8+KZDlDlFlBbJiqi+FJ7SuZfZzFn9YWboeouWEOm2WgvyBVmo9 43lVUdOdOnb+XCQEzX8r5I6E/MGOvmofVErpgHE/K7whW8pfC8KQs6PFcGRY5XT+lb TN9qav/CEoHs0Ugt3BzFdvVfXY7kV2cR8ve0wOtoivna5QfWrX1FbhfisKkIZdFKNZ 7Zyq7pMBppClDJBIv2tAuN292Ln4DxChG0athZwB67GaYox7ICNFaSsj66FNQl9Id5 6NStr8Xhje7BA== Received: from mail.u-boot.org (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id E4E4067C0E for ; Fri, 19 Sep 2025 14:17:34 -0600 (MDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1758313052; bh=/te0abcUOn3EQngu4rt6IPKE+RYXejH1lagAC5GoNCY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=jLNFhIayZRLj8prmjCDo1WtkEAtYWVLeTS8I1MyXi4KwhNscPu35Zsf93zzi3fxbk cdC65V1IVVrwFJiN6xG1hPxcbOqsdLRcF76Qcx0XfeytHYgJ2gfQ7AZAjlinnXKPwB O0DZ8kQwtsxsnIdM2PECeYZdVl2WstNUlvKxsF5Wg7HsCNieyK/Kydn+/oRCu1oCHT QkwjQyh50pq5f2bBGZKWSqCtVqQLHMHabNS+U8o2Qs3vHYCbFmC3xxFgJEisWW2Jw1 UlCu5gmiSoGjzX+/hVjWdHbbtu30nPWnWZ77JuHFuqW/O+FQRbBIYcdxaQUHbFVtTd URP88Vnj+J7mg== Received: from localhost (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id 3E50567B3B; Fri, 19 Sep 2025 14:17: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 jjy5ed4AkT8m; Fri, 19 Sep 2025 14:17:32 -0600 (MDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1758313050; bh=YI9lm2WGrcw5DqgDTni3BFLVtYLcqpIoZylKQ5XZvzo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=rXB0lSCWB18vJ4mG4Z6uW5UYBgJNIdrn2wX2ESMSEH+sBWsEDJc9dwtgulw+a/fR1 6hU7/RUc2cgIsTawrMmifuL8D4cIkQUnR0BCdCv601CBT3NIoSzH+GRsCwRYu0sZsV p7ictaCUfV5evboy9wld7pXNMA8i90PWqdQg9wSQAsbhq1pbDAxXi8fYFb3vqP9HiQ ons5AOBG6rrChOt3Dn/NiVISZA0yoUCLiG2q7L97r6m7ls3oj5+sSCopZYEWo5yoE+ d5fHK67p8kXekvcjEPlXJSLdVjISAiD+0mCqhuqUjOWcusqE2cFC7VWZfXPu9VVR+i Wyg5+qERNWxLA== Received: from u-boot.org (unknown [73.34.74.121]) by mail.u-boot.org (Postfix) with ESMTPSA id 6F87F67BFC; Fri, 19 Sep 2025 14:17:30 -0600 (MDT) From: Simon Glass To: U-Boot Concept Date: Fri, 19 Sep 2025 14:14:46 -0600 Message-ID: <20250919201507.4024144-40-sjg@u-boot.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20250919201507.4024144-1-sjg@u-boot.org> References: <20250919201507.4024144-1-sjg@u-boot.org> MIME-Version: 1.0 Message-ID-Hash: GV32L4ZWDPYPYOR6T7E2CNUMR2Y5MCMA X-Message-ID-Hash: GV32L4ZWDPYPYOR6T7E2CNUMR2Y5MCMA 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 39/42] video: truetype: Clear after the current char on insert 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 Within the CLI, inserting a character works by writing out the new char and then all the ones after it. With the truetype console this results in gibberish since the new chars are written on top of the old. To resolve this, clear the rest of the input when a character is inserted. Consider that the end of the input, at least until furture characters are written. As an optimisation, don't clear if the new character is the same as the old. This cleans up a dot above the 'g' of greatness which should not be there, so update the dm_test_video_truetype() test. It also clean up the part of the 't' of 'not be' which should not be there, so update dm_test_video_truetype_bs() too. Signed-off-by: Simon Glass --- drivers/video/console_truetype.c | 76 ++++++++++++++++++++++++++++++-- test/dm/video.c | 4 +- 2 files changed, 74 insertions(+), 6 deletions(-) diff --git a/drivers/video/console_truetype.c b/drivers/video/console_truetype.c index fc2985ed92f..a42ae318fc8 100644 --- a/drivers/video/console_truetype.c +++ b/drivers/video/console_truetype.c @@ -295,6 +295,58 @@ static int console_truetype_move_rows(struct udevice *dev, uint rowdst, return 0; } +/** + * clear_from() - Clear characters on the display from given index onwards + * + * Erases all characters from the specified position index in the position + * history to the end of the position array (pos_count). This handles line + * wrapping by clearing to the end of lines and continuing on subsequent lines. + * + * @dev: Device to update + * @index: Starting index in priv->pos array to erase from + */ +static void clear_from(struct udevice *dev, int index) +{ + struct vidconsole_priv *vc_priv = dev_get_uclass_priv(dev); + struct console_tt_priv *priv = dev_get_priv(dev); + struct udevice *vid_dev = dev->parent; + struct video_priv *vid_priv = dev_get_uclass_priv(vid_dev); + struct pos_info *start_pos, *end_pos; + int xstart, xend; + int ystart, yend; + + assert(priv->pos_count && index && index < priv->pos_count); + + start_pos = &priv->pos[index]; + xstart = VID_TO_PIXEL(start_pos->xpos_frac); + ystart = start_pos->ypos; + + /* End position is the last character in the position array */ + end_pos = &priv->pos[priv->pos_count - 1]; + xend = VID_TO_PIXEL(end_pos->xpos_frac) + end_pos->width; + yend = end_pos->ypos; + + /* If on the same line, just erase from start to end position */ + if (ystart == yend) { + video_fill_part(vid_dev, xstart, ystart, xend, ystart + vc_priv->y_charsize, + vid_priv->colour_bg); + } else { + /* Different lines - erase to end of first line */ + video_fill_part(vid_dev, xstart, ystart, vid_priv->xsize, + ystart + vc_priv->y_charsize, vid_priv->colour_bg); + + /* Erase any complete lines in between */ + if (yend > ystart + vc_priv->y_charsize) { + video_fill_part(vid_dev, 0, ystart + vc_priv->y_charsize, + vid_priv->xsize, yend, vid_priv->colour_bg); + } + + /* Erase from start of final line to end of last character */ + video_fill_part(vid_dev, 0, yend, xend, yend + vc_priv->y_charsize, + vid_priv->colour_bg); + } +} + static int console_truetype_putc_xy(struct udevice *dev, uint x, uint y, int cp) { @@ -326,15 +378,19 @@ static int console_truetype_putc_xy(struct udevice *dev, uint x, uint y, * First out our current X position in fractional pixels. If we wrote * a character previously, use kerning to fine-tune the position of * this character */ + pos = priv->pos_ptr < priv->pos_count ? &priv->pos[priv->pos_ptr] : + NULL; xpos = frac(VID_TO_PIXEL((double)x)); kern = 0; if (vc_priv->last_ch) { - kern = stbtt_GetCodepointKernAdvance(font, vc_priv->last_ch, - cp); + int last_cp = vc_priv->last_ch; + + if (pos) + last_cp = pos->cp; + kern = stbtt_GetCodepointKernAdvance(font, last_cp, cp); if (_DEBUG) { console_printf_select_stderr(true, "kern %c (%02x)", - vc_priv->last_ch, - vc_priv->last_ch); + last_cp, last_cp); } xpos += met->scale * kern; } @@ -357,6 +413,18 @@ static int console_truetype_putc_xy(struct udevice *dev, uint x, uint y, /* Write the current cursor position into history */ if (priv->pos_ptr < POS_HISTORY_SIZE) { + bool erase = false; + + /* Check if we're overwriting a different character */ + if (pos && pos->cp != cp) { + erase = true; + /* Erase using the old character's position before updating */ + clear_from(dev, priv->pos_ptr); + + /* After erasing, we don't care about erased characters */ + priv->pos_count = priv->pos_ptr; + } + pos = &priv->pos[priv->pos_ptr]; pos->xpos_frac = vc_priv->xcur_frac; pos->ypos = vc_priv->ycur; diff --git a/test/dm/video.c b/test/dm/video.c index 3ec12956909..3395fd9f1b3 100644 --- a/test/dm/video.c +++ b/test/dm/video.c @@ -594,7 +594,7 @@ static int dm_test_video_truetype(struct unit_test_state *uts) ut_assertok(uclass_get_device(UCLASS_VIDEO_CONSOLE, 0, &con)); vidconsole_put_string(con, test_string); vidconsole_put_stringn(con, test_string, 30); - ut_asserteq(13055, video_compress_fb(uts, dev, false)); + ut_asserteq(13073, video_compress_fb(uts, dev, false)); ut_assertok(video_check_copy_fb(uts, dev)); return 0; @@ -648,7 +648,7 @@ static int dm_test_video_truetype_bs(struct unit_test_state *uts) ut_assertok(video_get_nologo(uts, &dev)); ut_assertok(uclass_get_device(UCLASS_VIDEO_CONSOLE, 0, &con)); vidconsole_put_string(con, test_string); - ut_asserteq(29223, video_compress_fb(uts, dev, false)); + ut_asserteq(29310, video_compress_fb(uts, dev, false)); ut_assertok(video_check_copy_fb(uts, dev)); return 0; From patchwork Fri Sep 19 20:14: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: 382 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=1758313055; bh=RLYAIT5ycTKPvCTEtclidcsSJfTQ2v4Pdu0VmYXHh2M=; 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=dwK5hiQV3ZYPYQtjgqYv+UBybXItBlSDACtgJ5WcYJ60Z5zpzQoOyKtTri4TKsJd3 Mq5Q9heriTwKkfsuVHZmY7RaaYEiCXsCiXSClMCCXAXvXOTqZ5lFhWJNCqFdlHg6KS kA9S5tZjkfEx5qwsPhKmIKaszgYHS+yh1cetO8v8XnuUxXguPGjxVEOniVLpg+xF9g 95SI0WKGTqq1P09AEAnmTbT87BCJ3axQCJmvG/fp0v8yTKuQkzkL3gydIboFN4yjuQ 8Ex94wzQ39USuy9gSr3yZ/fPaYcRRIrAUcF8i7LsoV3AHPktFt6/8aVC5Tu0qqoWyL XEFQqPNt8BuTw== Received: from localhost (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id 667F267C92 for ; Fri, 19 Sep 2025 14:17:35 -0600 (MDT) X-Virus-Scanned: Debian amavis at Received: from mail.u-boot.org ([127.0.0.1]) by localhost (mail.u-boot.org [127.0.0.1]) (amavis, port 10024) with ESMTP id zGcE7cO2Y5RR for ; Fri, 19 Sep 2025 14:17:35 -0600 (MDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1758313055; bh=RLYAIT5ycTKPvCTEtclidcsSJfTQ2v4Pdu0VmYXHh2M=; 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=dwK5hiQV3ZYPYQtjgqYv+UBybXItBlSDACtgJ5WcYJ60Z5zpzQoOyKtTri4TKsJd3 Mq5Q9heriTwKkfsuVHZmY7RaaYEiCXsCiXSClMCCXAXvXOTqZ5lFhWJNCqFdlHg6KS kA9S5tZjkfEx5qwsPhKmIKaszgYHS+yh1cetO8v8XnuUxXguPGjxVEOniVLpg+xF9g 95SI0WKGTqq1P09AEAnmTbT87BCJ3axQCJmvG/fp0v8yTKuQkzkL3gydIboFN4yjuQ 8Ex94wzQ39USuy9gSr3yZ/fPaYcRRIrAUcF8i7LsoV3AHPktFt6/8aVC5Tu0qqoWyL XEFQqPNt8BuTw== Received: from mail.u-boot.org (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id 5628567C06 for ; Fri, 19 Sep 2025 14:17:35 -0600 (MDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1758313053; bh=TBjaF2WgFGhs28qSR5WAKeAubORlgAPNDPcM4w9GqqA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Rv9cIBUEfjh/ykqKrRJS6VmRHplm9BkA6Ot7BnVRm0BbfwpxRq43UQE2NVR0DcPQu Y9dMWtSItwhQKywYHMjo8sf92ul/WVQgVbfeJ+4EoSaWdYYXnL7o2Ll/9Dunk5PJ2I pzhp+6IJlsJAxahD/ySk4PWnArCZpQWlY5e0Q/y3JPyH4EZUIIt7pDT9DHuBiMgb9i aEUDCaR7nxgLKAkwduthNDknADRkhBgob9WKjmOBpKkE7w2cNc44dL9t2NQvAMViDC WU9JYLhKGkrez0nJFbBuakRa4oikwlRBKafB4VRFFjtMzFulLX1BLO26KYgvmT0RdJ EeuToXm6v3v4w== Received: from localhost (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id 35ABB67C06; Fri, 19 Sep 2025 14:17: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 Bcc3UudhqBoT; Fri, 19 Sep 2025 14:17:33 -0600 (MDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1758313052; bh=/7gRk668WnfVEYHaqKTb/o3NaYZrcDjGgW+t9WcrFLc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=oZqFo9Nhl3hCZhI9BHO8gjbvIgPuRf8v9KoeyzZbVmIvvwqnmZ2hM6ZD3D5hO06/C FaSkJ7IKCWC59Ix60OAymCKuVKThC3qa9XPt5QiKo8gJ1gSWInzaO/UL6Eev5iRwMH u/qK5Z+lLC5tveLplozl3L0z0VsjLeJdcUhfbTe6WVDs25CTMlW+1bdw3Y1/lD+pww y+8pu9X3Ktzlq6908ytZZQamIgtP9/GUSKp/bpbn4l6YxLUxaxejcyxJQr2axYZVwK Ax9ttrx8vCvq4dkzBdZUocpjEwBfBK50FmnNO8w6ipuyFT2gnCPh40ERPU8GQJekkH PmnqXGKj/smwQ== Received: from u-boot.org (unknown [73.34.74.121]) by mail.u-boot.org (Postfix) with ESMTPSA id 84E6A67BFC; Fri, 19 Sep 2025 14:17:32 -0600 (MDT) From: Simon Glass To: U-Boot Concept Date: Fri, 19 Sep 2025 14:14:47 -0600 Message-ID: <20250919201507.4024144-41-sjg@u-boot.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20250919201507.4024144-1-sjg@u-boot.org> References: <20250919201507.4024144-1-sjg@u-boot.org> MIME-Version: 1.0 Message-ID-Hash: EGFT3WQQXA443JNVSUZWYLALQLSZNEFP X-Message-ID-Hash: EGFT3WQQXA443JNVSUZWYLALQLSZNEFP 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 40/42] video: truetype: Avoid clearing on backspace 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 Now that the truetype console properly handles clearing text from the display during editing, we don't need to clear the character when processing a backspace. This allows arrow keys to work as expected on the truetype console. Signed-off-by: Simon Glass --- drivers/video/console_truetype.c | 4 ---- 1 file changed, 4 deletions(-) diff --git a/drivers/video/console_truetype.c b/drivers/video/console_truetype.c index a42ae318fc8..4ddf133f2e0 100644 --- a/drivers/video/console_truetype.c +++ b/drivers/video/console_truetype.c @@ -590,10 +590,6 @@ static int console_truetype_backspace(struct udevice *dev) else xend = vid_priv->xsize; - video_fill_part(vid_dev, VID_TO_PIXEL(pos->xpos_frac), pos->ypos, - xend, pos->ypos + vc_priv->y_charsize, - vid_priv->colour_bg); - /* Move the cursor back to where it was when we pushed this record */ vc_priv->xcur_frac = pos->xpos_frac; vc_priv->ycur = pos->ypos; From patchwork Fri Sep 19 20:14: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: 383 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=1758313057; bh=RotGBFDH+tSXJlsI4fbNi/5Pwu7x+QQrXok3LgwiTHI=; 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=AbF1Jba8gdx8dNGWtpdWTGm+US3PSJFV0AD7jYnAI8Uw2QE5hmXbcUTauyStEQ39h Xi+Zu2Fwt7LzAAmSCRUtW4FT0hFoUnXm98QhID3NF+cfpd3YdxR5TN9aaQnnV9IeS2 l5xABUm/EHTMvRzjZccAIfvg+mg/a5Af3KnCwWo7MZaXkDFZZlDNVPyEpJnPK4PvyL 2E/+h0MZLDCMVCL4sPDkbGWLTlEC9rIEkFmFMiuGFQfblN1Vvi0RAfG/MnecYCRKfU fNYgyLke891TKFhN+9bDbZxAFcnsvtE5OvXpdaDPMzWF0HEA3ZHAnZrgPTw/WVzh9S AKvrFjHWQai6Q== Received: from localhost (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id BC39767C8A for ; Fri, 19 Sep 2025 14:17: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 yJ75RrW2HfLS for ; Fri, 19 Sep 2025 14:17:37 -0600 (MDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1758313055; bh=RotGBFDH+tSXJlsI4fbNi/5Pwu7x+QQrXok3LgwiTHI=; 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=T/z2Oj3lmkIWRFz2ZmGPA1gFJUx2oDHiDUM9au+yCN1DFZ2Dd3jFaddXz6NsL6y1m ZkUeL+euAJyqNyX+rH/ldpICm9T8DkL55PkIXlZiQNVqTt+CL1kYitZbjH/blNQqZ3 31+pqEEkb7aqboazVPzNMxscddxNkdHso4UWKER6wgzVAvtO8EYlQbKh15xcplQJdI MjJ0BO4D4mAx+GCaJr0OThCAxZBu9ddR84Xnjr6XIl7YbqR1mbMA8MkR7wBkySHlPJ pWBGx3WWJM/n2CGuCHNSkJPRvZAmkjTgpanfqH08vtYF6cmHeKX8oX5PAxrTtt+u5U C+wRFfU8a1NPw== Received: from mail.u-boot.org (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id B0D2867B3B for ; Fri, 19 Sep 2025 14:17:35 -0600 (MDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1758313054; bh=oKvockTPcfY/E5dEWla6GBWaXTy4BPA92f1WAXe4kgU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=KlsWLTSqbBY/dFO6lJV0TnYfAhwzlbUe8SKKkPyfDMEzfBspjGzomxMGX92ILwq9k GJbSwwXUELIWdzkleO3qBDTsFltsQFvN9OVoeNVu+nf+dg9oBdOrvIUSbSnnBwPOk4 3IJHFSE4+HoejGu2K5MEYzGlB2RJtREKq+Xp2yFN9BAqSAIluUoU5nc3OJCMt0FyVQ o0K1rQtDE/QP1OJy9cqzF/WTNIionVK1zEFr91L+XZMMkhaB8RVU7LDjZqiTz0yh3C fvP8B6KjQlnBPIis/hd3VK4c8WskzWalx8MyCvsT0IzHOPqSx52SQqV8Qmtag11QFr DJSXUDhDNVksA== Received: from localhost (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id 1496467B3B; Fri, 19 Sep 2025 14:17: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 ZMQv_3keoTzK; Fri, 19 Sep 2025 14:17:34 -0600 (MDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1758313053; bh=jn6EHuxjkdZssVuMQGwJ1FiFZqNdH06Hcw6iw7I48Pc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=urf+Tg81gbeJB2KDnxHjYk4z7RVD6I5DsABEum9jkaGAai32QQGyADAyfJqHoB8Lf DxqfSLM4Jk5aCbVchl/c9kssqe3G5adFjSsJxseuiWmOgNPFjY9oSeozQcMOy5DoEu me65udBd+HcFPYsCZhU4hV3JfFpN0aE1uGS1VaLXgcYLDHclayZqi383Uyo9U6cNmz 04P3Wk5J2PAfBLsyGDgAizM5BAo/f/8v5fFNRIhydEnACBsYG+ZBoY3TAJBwUx7SId TC/+QSzQQ0ZlrzXmzdybbwi7za1u+O2sWPY/zXz76U4RzoWbyGf7msfNPPpzwOwrnK 3Pta404gSBxIg== Received: from u-boot.org (unknown [73.34.74.121]) by mail.u-boot.org (Postfix) with ESMTPSA id 7896D67C0E; Fri, 19 Sep 2025 14:17:33 -0600 (MDT) From: Simon Glass To: U-Boot Concept Date: Fri, 19 Sep 2025 14:14:48 -0600 Message-ID: <20250919201507.4024144-42-sjg@u-boot.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20250919201507.4024144-1-sjg@u-boot.org> References: <20250919201507.4024144-1-sjg@u-boot.org> MIME-Version: 1.0 Message-ID-Hash: 2TZOUASW2MIVACTUJXA2EP6S3664JFBE X-Message-ID-Hash: 2TZOUASW2MIVACTUJXA2EP6S3664JFBE 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 41/42] video: Add some notes about the cursor List-Id: Discussion and patches related to U-Boot Concept Archived-At: List-Archive: List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: From: Simon Glass Provide a few notes about how the cursor works in the video console. Signed-off-by: Simon Glass --- include/video_console.h | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/include/video_console.h b/include/video_console.h index 9005e9f4442..ac04aeb3aef 100644 --- a/include/video_console.h +++ b/include/video_console.h @@ -29,6 +29,26 @@ enum { * The cursor is set up and maintained by the vidconsole. It is a simple * vertical bar of width VIDCONSOLE_CURSOR_WIDTH shown in the foreground colour. * + * No cursor processing is done unless @enabled is true. + * + * To figure out where to draw the cursor, the vidconsole's get_cursor_info() is + * called. It fills in the @x, @y, @height and @index information below. That + * information remains valid while the cursor is shown, so it can be used to + * hide the cursor. + * + * The cursor is drawn only when idle (by vidconsole_show_cursor() called from + * vidconsole_idle()). It is erased as soon as any output needs to be written to + * the display - vidconsole_hide_cursor() is called from a few places in the + * vidconsole uclass. + * + * Under the hood, vidconsole_show_cursor() calls cursor_show() which saves the + * pixels under the cursor as it draws it. Once finished it sets @visible to + * true, so that we know we must erase the cursor before drawing anything else. + * + * The old pixels end up in @save_data and are used by cursor_hide() (called + * from vidconsole_hide_cursor()) to restore the display contents to what they + * were. Once that is done, @visible is set back to false. + * * @enabled: cursor is active (e.g. during readline) * @visible: cursor is currently visible * @indent: indent subsequent lines to the same position as the first line From patchwork Fri Sep 19 20:14: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: 384 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=1758313062; bh=0HUUt0OU8nC72ISnuzq4JIOLbhFNfDqahXT34OmXcfc=; 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=HLLGcocfGqFPFY6uCjuKFwfAOsDy6yEn7le00aAFAJ285/VjyRDSCPAz0T9emDSz5 EVUqwZ6irzrF9YGI5oeBg24T6ag+T3KFiUjS4tAs8Gwd9DMenUILIWAEidxHEacImb i49F70FH4BHwGR/4k/PiFyALER5MDZdLRYqUZGmVoMiC7Qc4NUYmicMrqtN0WVBxkY /NTQXCzo3uvR04sQU0qaP1BK+bLGmo2jLYahFByO/OgVDLXAsoHfPrXC3y90AuN97Y IMu6lAVPSHq4uS0irmT/qkJua93LwXfbEEl9syQo9e1KLhvr2iLGLQ2kUW67Pvcibt n1jpwA86WZ/Ug== Received: from localhost (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id 56AAC67C6C for ; Fri, 19 Sep 2025 14:17:42 -0600 (MDT) X-Virus-Scanned: Debian amavis at Received: from mail.u-boot.org ([127.0.0.1]) by localhost (mail.u-boot.org [127.0.0.1]) (amavis, port 10024) with ESMTP id SL8PUIzdAOxN for ; Fri, 19 Sep 2025 14:17:42 -0600 (MDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1758313062; bh=0HUUt0OU8nC72ISnuzq4JIOLbhFNfDqahXT34OmXcfc=; 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=HLLGcocfGqFPFY6uCjuKFwfAOsDy6yEn7le00aAFAJ285/VjyRDSCPAz0T9emDSz5 EVUqwZ6irzrF9YGI5oeBg24T6ag+T3KFiUjS4tAs8Gwd9DMenUILIWAEidxHEacImb i49F70FH4BHwGR/4k/PiFyALER5MDZdLRYqUZGmVoMiC7Qc4NUYmicMrqtN0WVBxkY /NTQXCzo3uvR04sQU0qaP1BK+bLGmo2jLYahFByO/OgVDLXAsoHfPrXC3y90AuN97Y IMu6lAVPSHq4uS0irmT/qkJua93LwXfbEEl9syQo9e1KLhvr2iLGLQ2kUW67Pvcibt n1jpwA86WZ/Ug== Received: from mail.u-boot.org (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id 4607C67C0E for ; Fri, 19 Sep 2025 14:17:42 -0600 (MDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1758313059; bh=i2tAqW6ydtqqKLSww9Vus7CL2E+bNcFtsPYAU7ZLOmE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=wzMnRcnkIcD8n6PzCIbutseXWBCddir/phOR3ZvkVY+ynuanF9RIvNPYqDxIllBnc qTKXMNfFT845iH19/6IxpFrcf1mSfnXpoVHjicueKIdNA0iOydC+4iA7ZZdY6iNvbb tdICx7oxxN8OKVGoiHnjqioY/CqFb6+p8UhKceIiCsbVAFqEIbav+6roWHkdHi0H9w ihEAwvyx/drLsfg5DU0cS+Ic3M7xz7BvReGAKxTWRAmZg3GtdEzzPajpMG1BgHCWN4 dP/MrSdhPjbUbetkVvKqscAV0JabukH+xQtWyhJHQq2/tdTIMly+loUsFXjxys7yg4 y9VPBL4fcUXJA== Received: from localhost (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id EC09267B55; Fri, 19 Sep 2025 14:17: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 10026) with ESMTP id rtAhqdpWDrhM; Fri, 19 Sep 2025 14:17:39 -0600 (MDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1758313054; bh=1mBJ86kC6BKmzCXq2SpIV8D8v85Qu98+jCnQNNZBOzg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=r4Bevdgho4bGG4qTsfsP/aiW/RCypmsCI/j7KaskssSInIqn4rjkT8uBdpFF5awBk lPUr39VP+rTsDWOhpEH0UxBiXSiDMntpMQdnH62gWB/VZeAEjlLMhooYHKB1LBeSVY s7/1L75bgJnQTQ4IVHYPX8dp2AG6iN9F1i9vAkHa09L2hylMBUt412K7sjxZzwQ01y pGMBFxVZmEixiFZjJTj71bemq87ShnX/SnCo/L0d5TZN/S+sFP5IEjaxUeKgqyL+B8 /XL2L2zTimI7FMxyKz/pUEcCnSh6O9sxQNC1MU7DFhhl2mwgoPrMrr3QN75G2Mdthj xS/+99yfWTvWg== Received: from u-boot.org (unknown [73.34.74.121]) by mail.u-boot.org (Postfix) with ESMTPSA id 5A6C467BFC; Fri, 19 Sep 2025 14:17:34 -0600 (MDT) From: Simon Glass To: U-Boot Concept Date: Fri, 19 Sep 2025 14:14:49 -0600 Message-ID: <20250919201507.4024144-43-sjg@u-boot.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20250919201507.4024144-1-sjg@u-boot.org> References: <20250919201507.4024144-1-sjg@u-boot.org> MIME-Version: 1.0 Message-ID-Hash: M4KW4LEKSGIBLNUDMHUEHBQW5FIJ6HX3 X-Message-ID-Hash: M4KW4LEKSGIBLNUDMHUEHBQW5FIJ6HX3 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 42/42] console: Add some cursor tests 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 few tests of cursor operation. Co-developed-by: Claude Signed-off-by: Simon Glass --- test/dm/video.c | 84 +++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 84 insertions(+) diff --git a/test/dm/video.c b/test/dm/video.c index 3395fd9f1b3..bb88c17e272 100644 --- a/test/dm/video.c +++ b/test/dm/video.c @@ -997,3 +997,87 @@ static int dm_test_video_font_switch(struct unit_test_state *uts) return 0; } DM_TEST(dm_test_video_font_switch, UTF_SCAN_PDATA | UTF_SCAN_FDT); + +/* cursor backspace without artifacts */ +static int check_cursor_backspace(struct unit_test_state *uts, + struct udevice *dev, struct udevice *con, + int exp_height) +{ + int with_a, with_cursor, after_backspace, after_idle, after_hide; + struct vidconsole_priv *vc_priv = dev_get_uclass_priv(con); + struct vidconsole_cursor *curs = &vc_priv->curs; + + /* Output chars without cursor */ + ut_assert(!curs->visible); + ut_assert(!curs->enabled); + ut_assert(!curs->saved); + ut_assert(!curs->height); + ut_assertok(vidconsole_put_char(con, ' ')); + ut_assertok(vidconsole_put_char(con, 'a')); + with_a = video_compress_fb(uts, dev, false); + + /* Show cursor at current position (after 'a') */ + ut_assertok(vidconsole_show_cursor(con)); + ut_assert(curs->visible); + ut_assert(curs->saved); + ut_asserteq(exp_height, curs->height); + with_cursor = video_compress_fb(uts, dev, false); + + /* Enable the cursor so that backspace will move it */ + curs->enabled = true; + + /* Do backspace - the cursor will be hidden */ + ut_assertok(vidconsole_put_char(con, '\b')); + ut_assert(!curs->visible); + ut_assert(!curs->saved); + after_backspace = video_compress_fb(uts, dev, false); + ut_asserteq(with_a, after_backspace); + ut_assert(curs->enabled); + + /* Run idle function - this should show the cursor */ + vidconsole_idle(con); + ut_assert(curs->visible); + ut_assert(curs->saved); + after_idle = video_compress_fb(uts, dev, false); + ut_assert(after_idle != with_a); + + /* Hide the cursor */ + ut_assertok(vidconsole_hide_cursor(con)); + ut_assert(curs->enabled); + ut_assert(!curs->visible); + ut_assert(!curs->saved); + after_hide = video_compress_fb(uts, dev, false); + + ut_asserteq(with_a, after_hide); + + return 0; +} + +/* cursor backspace without artifacts */ +static int dm_test_video_backspace_normal(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(check_cursor_backspace(uts, dev, con, 16)); + + return 0; +} +DM_TEST(dm_test_video_backspace_normal, UTF_SCAN_PDATA | UTF_SCAN_FDT); + +/* cursor backspace without artifacts on truetype */ +static int dm_test_video_backspace_truetype(struct unit_test_state *uts) +{ + struct udevice *dev, *con; + + ut_assertok(video_get_nologo(uts, &dev)); + ut_assertok(uclass_get_device(UCLASS_VIDEO_CONSOLE, 0, &con)); + ut_assertok(vidconsole_select_font(con, NULL, 30)); + ut_assertok(check_cursor_backspace(uts, dev, con, 30)); + + return 0; +} +DM_TEST(dm_test_video_backspace_truetype, UTF_SCAN_PDATA | UTF_SCAN_FDT);