From 92762d566e2482f06f05844b9398f809250165b7 Mon Sep 17 00:00:00 2001 From: Aleksandr Rybalko Date: Wed, 8 Jan 2014 14:42:26 +0000 Subject: [PATCH] Restore VGA mode on vt switch. It fix VESA mode left by Xorg on exit. Sponsored by: The FreeBSD Foundation --- sys/dev/vt/hw/vga/vga.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/sys/dev/vt/hw/vga/vga.c b/sys/dev/vt/hw/vga/vga.c index f658dc5ec960..6d4eb5e86506 100644 --- a/sys/dev/vt/hw/vga/vga.c +++ b/sys/dev/vt/hw/vga/vga.c @@ -75,12 +75,14 @@ static vd_init_t vga_init; static vd_blank_t vga_blank; static vd_bitbltchr_t vga_bitbltchr; static vd_putchar_t vga_putchar; +static vd_postswitch_t vga_postswitch; static const struct vt_driver vt_vga_driver = { .vd_init = vga_init, .vd_blank = vga_blank, .vd_bitbltchr = vga_bitbltchr, .vd_putchar = vga_putchar, + .vd_postswitch = vga_postswitch, .vd_priority = VD_PRIORITY_GENERIC, }; @@ -602,3 +604,13 @@ vga_init(struct vt_device *vd) return (CN_INTERNAL); } + +static void +vga_postswitch(struct vt_device *vd) +{ + + /* Reinit VGA mode, to restore view after app which change mode. */ + vga_initialize(vd, (vd->vd_flags & VDF_TEXTMODE)); + /* Ask vt(9) to update chars on visible area. */ + vd->vd_flags |= VDF_INVALID; +}