From: Thomas Zimmermann <tzimmermann@suse.de>
To: gregkh@linuxfoundation.org, jirislaby@kernel.org, deller@gmx.de,
James.Bottomley@HansenPartnership.com, simona@ffwll.ch
Cc: linux-kernel@vger.kernel.org, linux-serial@vger.kernel.org,
linux-fbdev@vger.kernel.org, linux-parisc@vger.kernel.org,
sashiko-reviews@lists.linux.dev,
Thomas Zimmermann <tzimmermann@suse.de>
Subject: [PATCH v2 6/7] vgacon: Implement struct consw.con_unblank
Date: Fri, 16 Oct 2026 11:11:56 +0200 [thread overview]
Message-ID: <20261016093357.33294-7-tzimmermann@suse.de> (raw)
In-Reply-To: <20261016093357.33294-1-tzimmermann@suse.de>
Implement con_unblank from struct consw with the VESA_NO_BLANKING
case from vgacon_blank(). The new function is called vgacon_unblank().
Remove the duplicated code from vgacon_blank().
Vgacon uses the global state vga_is_gfx in several places to test if
the console runs on text or graphics mode. Track the mode switches in
vgacon_blank() and vga_unblank(). As vgacon_unblank() does not have
a mode_switch parameter, derive the value from vga_is_gfx and vc_mode.
Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
---
drivers/video/console/vgacon.c | 53 ++++++++++++++++++++--------------
1 file changed, 31 insertions(+), 22 deletions(-)
diff --git a/drivers/video/console/vgacon.c b/drivers/video/console/vgacon.c
index 536e7fe4d142..7f52164c30af 100644
--- a/drivers/video/console/vgacon.c
+++ b/drivers/video/console/vgacon.c
@@ -800,39 +800,47 @@ static void vga_pal_blank(struct vgastate *state)
static bool vgacon_blank(struct vc_data *c, enum vesa_blank_mode blank,
bool mode_switch)
{
+ if (mode_switch)
+ vga_is_gfx = true;
+
switch (blank) {
- case VESA_NO_BLANKING: /* Unblank */
- if (vga_vesa_blanked) {
- vga_vesa_unblank(&vgastate);
- vga_vesa_blanked = VESA_NO_BLANKING;
- }
- if (vga_palette_blanked) {
- vga_set_palette(c, color_table);
- vga_palette_blanked = false;
- return 0;
- }
- vga_is_gfx = false;
- /* Tell console.c that it has to restore the screen itself */
- return 1;
- case VESA_VSYNC_SUSPEND: /* Normal blanking */
+ case VESA_NO_BLANKING: /* Normal blanking */
if (!mode_switch && vga_video_type == VIDEO_TYPE_VGAC) {
vga_pal_blank(&vgastate);
vga_palette_blanked = true;
- return 0;
+ return false;
}
vgacon_set_origin(c);
- scr_memsetw((void *) vga_vram_base, BLANK,
- c->vc_screenbuf_size);
- if (mode_switch)
- vga_is_gfx = true;
- return 1;
+ scr_memsetw((void *)vga_vram_base, BLANK, c->vc_screenbuf_size);
+ return true;
default: /* VESA blanking */
if (vga_video_type == VIDEO_TYPE_VGAC) {
- vga_vesa_blank(&vgastate, blank - 1);
+ vga_vesa_blank(&vgastate, blank);
vga_vesa_blanked = blank;
}
- return 0;
+ return false;
+ }
+}
+
+static bool vgacon_unblank(struct vc_data *c)
+{
+ bool mode_switch = vga_is_gfx && c->vc_mode == KD_TEXT;
+
+ if (mode_switch)
+ vga_is_gfx = false;
+
+ if (vga_vesa_blanked) {
+ vga_vesa_unblank(&vgastate);
+ vga_vesa_blanked = VESA_NO_BLANKING;
}
+
+ if (vga_palette_blanked) {
+ vga_set_palette(c, color_table);
+ vga_palette_blanked = false;
+ return false;
+ }
+
+ return true;
}
/*
@@ -1201,6 +1209,7 @@ const struct consw vga_con = {
.con_scroll = vgacon_scroll,
.con_switch = vgacon_switch,
.con_blank = vgacon_blank,
+ .con_unblank = vgacon_unblank,
.con_font_set = vgacon_font_set,
.con_font_get = vgacon_font_get,
.con_resize = vgacon_resize,
--
2.55.0
next prev parent reply other threads:[~2026-10-16 9:34 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-10-16 9:11 [PATCH v2 0/7] vt: Simplify console-blanking interface Thomas Zimmermann
2026-10-16 9:11 ` [PATCH v2 1/7] vt: Add con_unblank callback to struct consw Thomas Zimmermann
2026-10-16 9:44 ` sashiko-bot
2026-10-16 9:11 ` [PATCH v2 2/7] dummycon: Implement struct consw.con_unblank Thomas Zimmermann
2026-10-16 9:46 ` sashiko-bot
2026-10-16 9:11 ` [PATCH v2 3/7] fbcon: " Thomas Zimmermann
2026-10-16 10:01 ` sashiko-bot
2026-10-16 9:11 ` [PATCH v2 4/7] newport_con: " Thomas Zimmermann
2026-10-16 10:07 ` sashiko-bot
2026-10-16 9:11 ` [PATCH v2 5/7] sticon: " Thomas Zimmermann
2026-10-16 10:13 ` sashiko-bot
2026-10-16 9:11 ` Thomas Zimmermann [this message]
2026-10-16 10:26 ` [PATCH v2 6/7] vgacon: " sashiko-bot
2026-10-16 9:11 ` [PATCH v2 7/7] vt: Remove old-style con_blank Thomas Zimmermann
2026-10-16 10:38 ` sashiko-bot
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=20261016093357.33294-7-tzimmermann@suse.de \
--to=tzimmermann@suse.de \
--cc=James.Bottomley@HansenPartnership.com \
--cc=deller@gmx.de \
--cc=gregkh@linuxfoundation.org \
--cc=jirislaby@kernel.org \
--cc=linux-fbdev@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-parisc@vger.kernel.org \
--cc=linux-serial@vger.kernel.org \
--cc=sashiko-reviews@lists.linux.dev \
--cc=simona@ffwll.ch \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.