Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/arch/x86/x86 x86 genfb: when switching back to the conso...



details:   https://anonhg.NetBSD.org/src/rev/74e9225cc34a
branches:  trunk
changeset: 761983:74e9225cc34a
user:      jmcneill <jmcneill%NetBSD.org@localhost>
date:      Sat Feb 12 19:20:44 2011 +0000

description:
x86 genfb: when switching back to the console, if vga_post is present use it
to reset the video mode. gives us a chance of survival if the X server
crashes or the video driver fails to restore the console properly.

diffstat:

 sys/arch/x86/x86/x86_autoconf.c |  29 ++++++++++++++++++++++-------
 1 files changed, 22 insertions(+), 7 deletions(-)

diffs (66 lines):

diff -r a87014a8dfd5 -r 74e9225cc34a sys/arch/x86/x86/x86_autoconf.c
--- a/sys/arch/x86/x86/x86_autoconf.c   Sat Feb 12 19:13:30 2011 +0000
+++ b/sys/arch/x86/x86/x86_autoconf.c   Sat Feb 12 19:20:44 2011 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: x86_autoconf.c,v 1.56 2011/02/09 15:02:00 bouyer Exp $ */
+/*     $NetBSD: x86_autoconf.c,v 1.57 2011/02/12 19:20:44 jmcneill Exp $       */
 
 /*-
  * Copyright (c) 1990 The Regents of the University of California.
@@ -35,7 +35,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: x86_autoconf.c,v 1.56 2011/02/09 15:02:00 bouyer Exp $");
+__KERNEL_RCSID(0, "$NetBSD: x86_autoconf.c,v 1.57 2011/02/12 19:20:44 jmcneill Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -93,6 +93,10 @@
 #ifdef VGA_POST
 static struct vga_post *vga_posth = NULL;
 #endif
+#if NGENFB > 0 && NACPICA > 0 && defined(VGA_POST)
+extern int acpi_md_vbios_reset;
+extern int acpi_md_vesa_modenum;
+#endif
 
 struct disklist *x86_alldisks;
 int x86_ndisks;
@@ -111,9 +115,24 @@
 x86_genfb_setmode(struct genfb_softc *sc, int newmode)
 {
 #if NGENFB > 0
-       if (newmode == WSDISPLAYIO_MODE_EMUL)
+       static int curmode = WSDISPLAYIO_MODE_EMUL;
+
+       switch (newmode) {
+       case WSDISPLAYIO_MODE_EMUL:
                x86_genfb_mtrr_init(sc->sc_fboffset,
                    sc->sc_height * sc->sc_stride);
+#if NACPICA > 0 && defined(VGA_POST)
+               if (curmode != newmode) {
+                       if (vga_posth != NULL && acpi_md_vesa_modenum != 0) {
+                               vga_post_set_vbe(vga_posth,
+                                   acpi_md_vesa_modenum);
+                       }
+               }
+#endif
+               break;
+       }
+
+       curmode = newmode;
 #endif
        return true;
 }
@@ -129,10 +148,6 @@
 {
 #if NGENFB > 0
        struct pci_genfb_softc *psc = device_private(dev);
-#if NACPICA > 0 && defined(VGA_POST)
-       extern int acpi_md_vbios_reset;
-       extern int acpi_md_vesa_modenum;
-#endif
 
 #if NACPICA > 0 && defined(VGA_POST)
        if (vga_posth != NULL && acpi_md_vbios_reset == 2) {



Home | Main Index | Thread Index | Old Index