vt: Add con_unblank callback to struct consw

Add struct consw.con_unblank as inverse operation to con_blank.

If implemented invoke con_blank to turn the console from blanked to
unblanked. Also update the semantics of con_blank in this case: The
blank parameter of con_blank receives a VESA blank mode from enum
vesa_blank_mode instead of the hybrid unblank/blank values it has
used so far.

With con_unblank not implemented, invoke con_blank for blanking and
unblanking as before.

The old semantics of con_blank will be removed when all consoles
implement con_unblank.

Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
Signed-off-by: Helge Deller <deller@gmx.de>
This commit is contained in:
Thomas Zimmermann 2026-10-23 15:16:11 +02:00 committed by Helge Deller
parent 21a7f44fd0
commit dc2f8fbbe8
2 changed files with 30 additions and 10 deletions

View File

@ -4788,7 +4788,10 @@ void do_blank_screen(int entering_gfx)
if (console_blanked) {
if (blank_state == blank_vesa_wait) {
blank_state = blank_off;
vc->vc_sw->con_blank(vc, vesa_blank_mode + 1, 0);
if (vc->vc_sw->con_unblank)
vc->vc_sw->con_blank(vc, vesa_blank_mode, 0);
else
vc->vc_sw->con_blank(vc, vesa_blank_mode + 1, 0);
}
return;
}
@ -4797,7 +4800,10 @@ void do_blank_screen(int entering_gfx)
if (entering_gfx) {
hide_cursor(vc);
save_screen(vc);
vc->vc_sw->con_blank(vc, VESA_VSYNC_SUSPEND, 1);
if (vc->vc_sw->con_unblank)
vc->vc_sw->con_blank(vc, VESA_NO_BLANKING, 1);
else
vc->vc_sw->con_blank(vc, VESA_VSYNC_SUSPEND, 1);
console_blanked = fg_console + 1;
blank_state = blank_off;
set_origin(vc);
@ -4818,8 +4824,12 @@ void do_blank_screen(int entering_gfx)
save_screen(vc);
/* In case we need to reset origin, blanking hook returns 1 */
i = vc->vc_sw->con_blank(vc, vesa_off_interval ? VESA_VSYNC_SUSPEND :
(vesa_blank_mode + 1), 0);
if (vc->vc_sw->con_unblank)
i = vc->vc_sw->con_blank(vc, vesa_off_interval ? VESA_NO_BLANKING :
vesa_blank_mode, 0);
else
i = vc->vc_sw->con_blank(vc, vesa_off_interval ? VESA_VSYNC_SUSPEND :
(vesa_blank_mode + 1), 0);
console_blanked = fg_console + 1;
if (i)
set_origin(vc);
@ -4870,9 +4880,15 @@ void do_unblank_screen(int leaving_gfx)
}
console_blanked = 0;
if (vc->vc_sw->con_blank(vc, VESA_NO_BLANKING, leaving_gfx))
/* Low-level driver cannot restore -> do it ourselves */
update_screen(vc);
if (vc->vc_sw->con_unblank) {
if (vc->vc_sw->con_unblank(vc, leaving_gfx))
/* Low-level driver cannot restore -> do it ourselves */
update_screen(vc);
} else {
if (vc->vc_sw->con_blank(vc, VESA_NO_BLANKING, leaving_gfx))
/* Low-level driver cannot restore -> do it ourselves */
update_screen(vc);
}
if (console_blank_hook)
console_blank_hook(0);
set_palette(vc);

View File

@ -55,9 +55,12 @@ enum vc_intensity;
* Invoked by csi_M and printing to the console.
* @con_switch: notifier about the console switch; it is supposed to return
* true if a redraw is needed.
* @con_blank: blank/unblank the console. The target mode is passed in @blank.
* @mode_switch is set if changing from/to text/graphics. The hook
* is supposed to return true if a redraw is needed.
* @con_blank: blank the console. The preferred VESA blank mode is passed in
* @blank. @mode_switch is set if changing from/to text/graphics.
* The hook is supposed to return true if a redraw is needed.
* @con_unblank: unblank the console. The hook is supposed to return true if
* a redraw is needed. @mode_switch is set if changing from/to
* text/graphics.
* @con_font_set: set console @vc font to @font with height @vpitch. @flags can
* be %KD_FONT_FLAG_DONT_RECALC. (optional)
* @con_font_get: fetch the current font on @vc of height @vpitch into @font.
@ -99,6 +102,7 @@ struct consw {
bool (*con_switch)(struct vc_data *vc);
bool (*con_blank)(struct vc_data *vc, enum vesa_blank_mode blank,
bool mode_switch);
bool (*con_unblank)(struct vc_data *vc, bool mode_switch);
int (*con_font_set)(struct vc_data *vc,
const struct console_font *font,
unsigned int vpitch, unsigned int flags);