[Concept,11/16] console: Get the pager lines from the vidconsole

Message ID 20250822142153.3404275-12-sjg@u-boot.org
State New
Headers
Series Introduce a pager for the console |

Commit Message

Simon Glass Aug. 22, 2025, 2:21 p.m. UTC
  From: Simon Glass <sjg@chromium.org>

If there is a video console, use that to set the number of lines for the
pager.

Signed-off-by: Simon Glass <sjg@chromium.org>
---

 common/console.c | 15 +++++++++++++++
 1 file changed, 15 insertions(+)
  

Patch

diff --git a/common/console.c b/common/console.c
index 7bafe98375a..bddbde9de5a 100644
--- a/common/console.c
+++ b/common/console.c
@@ -1134,6 +1134,21 @@  static void setup_pager(void)
 					   CONFIG_CONSOLE_PAGER_LINES);
 		int ret;
 
+		/* get number of lines from the video console, if available */
+		if (IS_ENABLED(CONFIG_VIDEO)) {
+			struct udevice *dev;
+			int ret;
+
+			ret = uclass_first_device_err(UCLASS_VIDEO_CONSOLE,
+						      &dev);
+			if (!ret) {
+				struct vidconsole_priv *priv;
+
+				priv = dev_get_uclass_priv(dev);
+				lines = priv->rows;
+			}
+		}
+
 		ret = pager_init(gd_pagerp(), env_get_hex("pager", lines),
 				 PAGER_BUF_SIZE);
 		if (ret)