| Message ID | 20261004-b4-framebuffer-stride-fix-v2-1-923af6708491@protonmail.com |
|---|---|
| State | Accepted |
| Commit | e16958bc076d842df20c8ea96d9fbec479e54459 |
| Delegated to: | Anatolij Gustschin |
| Headers | show |
| Series | [v2] video: console: clear rows stride-aware in set_row | expand |
On 2026-10-04T19:47:24, Petr Hodina via B4 Relay <devnull+petr.hodina.protonmail.com@kernel.org> wrote: > video: console: clear rows stride-aware in set_row > > console_set_row() and console_set_row_2() clear a row with a single > contiguous fill assuming line_length == xsize * pbytes. A stride-padded > framebuffer inherited from a prior boot stage (e.g. via > simple-framebuffer) breaks that assumption leaving stale pixels after > scroll. > > Use video_fill_part() which already steps per scanline by > line_length. > > Signed-off-by: Petr Hodina <petr.hodina@protonmail.com> > > drivers/video/console_normal.c | 26 +++----------------------- > drivers/video/console_rotate.c | 23 ++++------------------- > 2 files changed, 7 insertions(+), 42 deletions(-) Reviewed-by: Simon Glass <sjg@chromium.org>
On Sun, 04 Oct 2026 21:47:24 +0200, Petr Hodina wrote: > console_set_row() and console_set_row_2() clear a row with a single > contiguous fill assuming line_length == xsize * pbytes. A stride-padded > framebuffer inherited from a prior boot stage (e.g. via > simple-framebuffer) breaks that assumption leaving stale pixels after > scroll. > > Use video_fill_part() which already steps per scanline by > line_length. > > [...] Applied to u-boot/main, thanks! [1/1] video: console: clear rows stride-aware in set_row commit: e16958bc076d842df20c8ea96d9fbec479e54459
diff --git a/drivers/video/console_normal.c b/drivers/video/console_normal.c index 07db613ac53..9a3d08aad02 100644 --- a/drivers/video/console_normal.c +++ b/drivers/video/console_normal.c @@ -18,30 +18,10 @@ static int console_set_row(struct udevice *dev, uint row, int clr) struct video_priv *vid_priv = dev_get_uclass_priv(dev->parent); struct console_simple_priv *priv = dev_get_priv(dev); struct video_fontdata *fontdata = priv->fontdata; - void *line, *dst, *end; - int pixels = fontdata->height * vid_priv->xsize; - int ret; - int i; - int pbytes; - ret = check_bpix_support(vid_priv->bpix); - if (ret) - return ret; - - line = vid_priv->fb + row * fontdata->height * vid_priv->line_length; - dst = line; - pbytes = VNBYTES(vid_priv->bpix); - for (i = 0; i < pixels; i++) - fill_pixel_and_goto_next(&dst, clr, pbytes, pbytes); - end = dst; - - video_damage(dev->parent, - 0, - fontdata->height * row, - vid_priv->xsize, - fontdata->height); - - return 0; + return video_fill_part(dev->parent, 0, row * fontdata->height, + vid_priv->xsize, + (row + 1) * fontdata->height, clr); } static int console_move_rows(struct udevice *dev, uint rowdst, diff --git a/drivers/video/console_rotate.c b/drivers/video/console_rotate.c index 886b25dcfaf..6feacd43b6c 100644 --- a/drivers/video/console_rotate.c +++ b/drivers/video/console_rotate.c @@ -112,26 +112,11 @@ static int console_set_row_2(struct udevice *dev, uint row, int clr) struct video_priv *vid_priv = dev_get_uclass_priv(dev->parent); struct console_simple_priv *priv = dev_get_priv(dev); struct video_fontdata *fontdata = priv->fontdata; - void *start, *line, *dst, *end; - int pixels = fontdata->height * vid_priv->xsize; - int i; - int pbytes = VNBYTES(vid_priv->bpix); - - start = vid_priv->fb + vid_priv->ysize * vid_priv->line_length - - (row + 1) * fontdata->height * vid_priv->line_length; - line = start; - dst = line; - for (i = 0; i < pixels; i++) - fill_pixel_and_goto_next(&dst, clr, pbytes, pbytes); - end = dst; - video_damage(dev->parent, - 0, - vid_priv->ysize - (row + 1) * fontdata->height, - vid_priv->xsize, - fontdata->height); - - return 0; + return video_fill_part(dev->parent, 0, + vid_priv->ysize - (row + 1) * fontdata->height, + vid_priv->xsize, + vid_priv->ysize - row * fontdata->height, clr); } static int console_move_rows_2(struct udevice *dev, uint rowdst, uint rowsrc,