Linux Serial subsystem development
 help / color / mirror / Atom feed
* [PATCH v2 0/2] vt/vgacon: Skip blanked hardware scroll and fix VESA blanking
@ 2026-11-24  2:48 Yu Peng
  2026-11-24  2:48 ` [PATCH v2 1/2] vt: Skip hardware scrolling while blanked Yu Peng
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Yu Peng @ 2026-11-24  2:48 UTC (permalink / raw)
  To: Greg Kroah-Hartman, Jiri Slaby, Helge Deller
  Cc: Thomas Zimmermann, Nicolas Pitre, Ronan Pigott, linux-serial,
	linux-fbdev, dri-devel, linux-kernel, Yu Peng

Split v1 [1] into two independent patches as requested by Helge Deller,
ordered so patch 1 fixes blanked scrolling before patch 2 switches
direct VESA blanking to vc->vc_screenbuf.

[1] https://lore.kernel.org/all/20261123101151.414436-1-pengyu@kylinos.cn/

Yu Peng (2):
  vt: Skip hardware scrolling while blanked
  vgacon: Switch to screenbuf on direct VESA blanking

 drivers/tty/vt/vt.c            | 7 ++++---
 drivers/video/console/vgacon.c | 2 +-
 2 files changed, 5 insertions(+), 4 deletions(-)

-- 
2.43.0


^ permalink raw reply	[flat|nested] 4+ messages in thread

* [PATCH v2 1/2] vt: Skip hardware scrolling while blanked
  2026-11-24  2:48 [PATCH v2 0/2] vt/vgacon: Skip blanked hardware scroll and fix VESA blanking Yu Peng
@ 2026-11-24  2:48 ` Yu Peng
  2026-11-24  2:48 ` [PATCH v2 2/2] vgacon: Switch to screenbuf on direct VESA blanking Yu Peng
  2026-11-24  2:58 ` [PATCH v2 0/2] vt/vgacon: Skip blanked hardware scroll and fix " sashiko-bot
  2 siblings, 0 replies; 4+ messages in thread
From: Yu Peng @ 2026-11-24  2:48 UTC (permalink / raw)
  To: Greg Kroah-Hartman, Jiri Slaby, Helge Deller
  Cc: Thomas Zimmermann, Nicolas Pitre, Ronan Pigott, linux-serial,
	linux-fbdev, dri-devel, linux-kernel, Yu Peng

When vgacon is blanked without palette blanking (!vga_palette_blanked),
vgacon_set_origin() rejects VRAM so vc->vc_origin points to the heap
buffer vc->vc_screenbuf. Calling hardware scroll callbacks while blanked
then treats vc->vc_screenbuf as VRAM and causes out-of-bounds accesses.

Use con_should_update() to skip hardware scrolling and scrollback while
blanked, allowing con_scroll() to fall back to software scrolling.

Assisted-by: LLM
Signed-off-by: Yu Peng <pengyu@kylinos.cn>
---
 drivers/tty/vt/vt.c | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/drivers/tty/vt/vt.c b/drivers/tty/vt/vt.c
index 6a6eb8b2a6dec..39be682645097 100644
--- a/drivers/tty/vt/vt.c
+++ b/drivers/tty/vt/vt.c
@@ -726,8 +726,8 @@ static void con_scroll(struct vc_data *vc, unsigned int top,
 		return;
 
 	vc_uniscr_scroll(vc, top, bottom, dir, nr);
-	if (con_is_visible(vc) &&
-			vc->vc_sw->con_scroll(vc, top, bottom, dir, nr))
+	if (con_should_update(vc) &&
+	    vc->vc_sw->con_scroll(vc, top, bottom, dir, nr))
 		return;
 
 	src = clear = (u16 *)(vc->vc_origin + vc->vc_size_row * top);
@@ -3488,7 +3488,8 @@ static void console_callback(struct work_struct *ignored)
 	if (scrollback_delta) {
 		struct vc_data *vc = vc_cons[fg_console].d;
 		clear_selection();
-		if (vc->vc_mode == KD_TEXT && vc->vc_sw->con_scrolldelta)
+		if (con_should_update(vc) && vc->vc_mode == KD_TEXT &&
+		    vc->vc_sw->con_scrolldelta)
 			vc->vc_sw->con_scrolldelta(vc, scrollback_delta);
 		scrollback_delta = 0;
 	}
-- 
2.43.0


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* [PATCH v2 2/2] vgacon: Switch to screenbuf on direct VESA blanking
  2026-11-24  2:48 [PATCH v2 0/2] vt/vgacon: Skip blanked hardware scroll and fix VESA blanking Yu Peng
  2026-11-24  2:48 ` [PATCH v2 1/2] vt: Skip hardware scrolling while blanked Yu Peng
@ 2026-11-24  2:48 ` Yu Peng
  2026-11-24  2:58 ` [PATCH v2 0/2] vt/vgacon: Skip blanked hardware scroll and fix " sashiko-bot
  2 siblings, 0 replies; 4+ messages in thread
From: Yu Peng @ 2026-11-24  2:48 UTC (permalink / raw)
  To: Greg Kroah-Hartman, Jiri Slaby, Helge Deller
  Cc: Thomas Zimmermann, Nicolas Pitre, Ronan Pigott, linux-serial,
	linux-fbdev, dri-devel, linux-kernel, Yu Peng

vgacon_blank() returns false for VESA blanking even when
!vga_palette_blanked, so do_blank_screen() leaves vc->vc_origin in VRAM.
On unblank, vgacon_unblank() returns true and overwrites VRAM with the
stale vc->vc_screenbuf, losing output written while blanked.

Return !vga_palette_blanked so direct VESA blanking switches to
vc->vc_screenbuf immediately while palette blanking keeps VRAM.

Assisted-by: LLM
Signed-off-by: Yu Peng <pengyu@kylinos.cn>
---
 drivers/video/console/vgacon.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/video/console/vgacon.c b/drivers/video/console/vgacon.c
index 09f7c376b4689..3a706c1f1cb28 100644
--- a/drivers/video/console/vgacon.c
+++ b/drivers/video/console/vgacon.c
@@ -796,7 +796,7 @@ static bool vgacon_blank(struct vc_data *c, enum vesa_blank_mode blank,
 			vga_vesa_blank(&vgastate, blank);
 			vga_vesa_blanked = blank;
 		}
-		return false;
+		return !vga_palette_blanked;
 	}
 }
 
-- 
2.43.0


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH v2 0/2] vt/vgacon: Skip blanked hardware scroll and fix VESA blanking
  2026-11-24  2:48 [PATCH v2 0/2] vt/vgacon: Skip blanked hardware scroll and fix VESA blanking Yu Peng
  2026-11-24  2:48 ` [PATCH v2 1/2] vt: Skip hardware scrolling while blanked Yu Peng
  2026-11-24  2:48 ` [PATCH v2 2/2] vgacon: Switch to screenbuf on direct VESA blanking Yu Peng
@ 2026-11-24  2:58 ` sashiko-bot
  2 siblings, 0 replies; 4+ messages in thread
From: sashiko-bot @ 2026-11-24  2:58 UTC (permalink / raw)
  To: Yu Peng; +Cc: linux-serial

Sashiko has reviewed this 2-patch series and found no issues.

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20261124024811.305592-1-pengyu@kylinos.cn

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2026-11-24  2:58 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-11-24  2:48 [PATCH v2 0/2] vt/vgacon: Skip blanked hardware scroll and fix VESA blanking Yu Peng
2026-11-24  2:48 ` [PATCH v2 1/2] vt: Skip hardware scrolling while blanked Yu Peng
2026-11-24  2:48 ` [PATCH v2 2/2] vgacon: Switch to screenbuf on direct VESA blanking Yu Peng
2026-11-24  2:58 ` [PATCH v2 0/2] vt/vgacon: Skip blanked hardware scroll and fix " sashiko-bot

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox