Author SHA1 Message Date
vhaudiquet c78ba55fd4 video: console: fix scrolling on rotated consoles
For odd rotations (rot=1 and rot=3) the console rows advance along the
physical X axis by the font height (priv->y_charsize): console_move_rows()
and console_set_row() treat a row as fontdata->height physical columns.

But the scroll condition in vidconsole_newline() compared the cursor
position against the font *width* (priv->x_charsize):

    priv->ycur + priv->x_charsize > vid_priv->xsize

The condition is only met at the bottom boundary when
(xsize % font_height) < font_width. With CONFIG_VIDEO_FONT_16X32 on a
1200x1920 panel used with rot=3, xsize % 32 == 16 == font_width, so the
condition is never true at the boundary: the console fills the visible
rows and then keeps drawing past the right screen edge, corrupting the
following scanout line (and past the framebuffer allocation on the last
scanout line), with no visible scrolling.

Use priv->y_charsize in the odd-rotation branch, matching the even-
rotation branch which already correctly compares against the character
height. With this the cursor wraps back to row 0 and scrolling advances
by one row per newline as expected.

Signed-off-by: vhaudiquet <vhaudiquet@localhost>
2026-08-31 12:51:29 +02:00
+1 -1
View File
@@ -95,7 +95,7 @@ static void vidconsole_newline(struct udevice *dev)
/* Check if we need to scroll the terminal */
if (vid_priv->rot % 2 ?
priv->ycur + priv->x_charsize > vid_priv->xsize :
priv->ycur + priv->y_charsize > vid_priv->xsize :
priv->ycur + priv->y_charsize > vid_priv->ysize) {
vidconsole_move_rows(dev, 0, rows, priv->rows - rows);
for (i = 0; i < rows; i++)