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