mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Helge Deller <deller@gmx.de>
To: Yu Peng <pengyu@kylinos.cn>,
	Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	Jiri Slaby <jirislaby@kernel.org>
Cc: Thomas Zimmermann <tzimmermann@suse.de>,
	Nicolas Pitre <nico@fluxnic.net>, Ronan Pigott <ronan@rjp.ie>,
	linux-serial@vger.kernel.org, linux-fbdev@vger.kernel.org,
	dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] vt: Skip hardware scrolling while blanked and fix VESA blanking
Date: Mon, 23 Nov 2026 17:31:18 +0100	[thread overview]
Message-ID: <2b118db7-cdaf-49f5-b870-24415b66f3d9@gmx.de> (raw)
In-Reply-To: <20261123101151.414436-1-pengyu@kylinos.cn>

Hello Yu,

On 11/23/26 11:11, Yu Peng wrote:
> 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.

The patch looks ok, but can you please split it up into two patches and resend?
The part below (vgacon_blank) is independend of the scrolling part.

Thanks!
Helge

> In vgacon_blank(), return !vga_palette_blanked for VESA blanking so
> direct VESA blanking switches vc->vc_origin to vc->vc_screenbuf
> immediately instead of losing output on unblank.

  
> Assisted-by: LLM
> Signed-off-by: Yu Peng <pengyu@kylinos.cn>
> ---
>   drivers/tty/vt/vt.c            | 7 ++++---
>   drivers/video/console/vgacon.c | 2 +-
>   2 files changed, 5 insertions(+), 4 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;
>   	}
> 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;
>   	}
>   }
>   


      reply	other threads:[~2026-11-23 16:32 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-23 10:11 Yu Peng
2026-11-23 16:31 ` Helge Deller [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=2b118db7-cdaf-49f5-b870-24415b66f3d9@gmx.de \
    --to=deller@gmx.de \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=gregkh@linuxfoundation.org \
    --cc=jirislaby@kernel.org \
    --cc=linux-fbdev@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-serial@vger.kernel.org \
    --cc=nico@fluxnic.net \
    --cc=pengyu@kylinos.cn \
    --cc=ronan@rjp.ie \
    --cc=tzimmermann@suse.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®