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