Module Name: src Committed By: jmcneill Date: Sat Feb 12 19:20:44 UTC 2011
Modified Files: src/sys/arch/x86/x86: x86_autoconf.c Log Message: 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. To generate a diff of this commit: cvs rdiff -u -r1.56 -r1.57 src/sys/arch/x86/x86/x86_autoconf.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
Modified files: Index: src/sys/arch/x86/x86/x86_autoconf.c diff -u src/sys/arch/x86/x86/x86_autoconf.c:1.56 src/sys/arch/x86/x86/x86_autoconf.c:1.57 --- src/sys/arch/x86/x86/x86_autoconf.c:1.56 Wed Feb 9 15:02:00 2011 +++ src/sys/arch/x86/x86/x86_autoconf.c Sat Feb 12 19:20:44 2011 @@ -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) {