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 };