summaryrefslogtreecommitdiff
path: root/hw/xfree86/vgahw
diff options
context:
space:
mode:
authorEgbert Eich <eich@suse.de>2005-01-14 18:42:26 +0000
committerEgbert Eich <eich@suse.de>2005-01-14 18:42:26 +0000
commit16f9d2d72a2378470e9c5b31c59fa6c9a00892d6 (patch)
treee1b79c5fec7e1b9c1c48dd92a0fd223e55f4f2b7 /hw/xfree86/vgahw
parent6c0b03a2362f33ae24a2f6845ed1418c9af4b8bc (diff)
Let the OS instead of X save/restore text console fonts on Linux. So far we
relied on the generic VGA layer to restore text console fonts for us when shutting down the server or VT switching back to the text console. This has worked rather well but it has some downsides on Linux: a. Many people use fbdev as console text mode. In this case it is not necessary to save/restore console fonts as the console is running in graphics mode anyway. b. Some architectures don't have a fbdev console but require a full POST of even the primary card (ie. IA64). This posting has to take place before we even have a chance to save anything. Therefore the fonts we save are the once written to the chip by POST, not what has been programmed by the user. c. Certain chipsets utilize the BIOS to perform mode setting. This may interfer with the vga save/restore font function in a strange way. It would therefore be preferrable to let the OS - which has been used to set up the font in the first place - take care of saving/restoring the data. I will attach a patch which will do so for Linux. To make this fully functional a small patch needs to be applied to the Linux kernel. To disable this feature add: #define DoOSFontRestore NO to your host.def. (Bugzilla #2277)
Diffstat (limited to 'hw/xfree86/vgahw')
-rw-r--r--hw/xfree86/vgahw/vgaHW.c34
1 files changed, 16 insertions, 18 deletions
diff --git a/hw/xfree86/vgahw/vgaHW.c b/hw/xfree86/vgahw/vgaHW.c
index 2e12f00ac..1ede4e731 100644
--- a/hw/xfree86/vgahw/vgaHW.c
+++ b/hw/xfree86/vgahw/vgaHW.c
@@ -25,7 +25,7 @@
#include "xf86cmap.h"
#ifndef SAVE_FONT1
-#define SAVE_FONT1
+#define SAVE_FONT1 1
#endif
/*
@@ -36,10 +36,10 @@
#define NEED_SAVED_CMAP
#endif
#ifndef SAVE_TEXT
-#define SAVE_TEXT
+#define SAVE_TEXT 1
#endif
#ifndef SAVE_FONT2
-#define SAVE_FONT2
+#define SAVE_FONT2 1
#endif
/* bytes per plane to save for text */
@@ -51,11 +51,11 @@
#if 0
/* Override all of these for now */
#undef SAVE_FONT1
-#define SAVE_FONT1
+#define SAVE_FONT1 1
#undef SAVE_FONT2
-#define SAVE_FONT2
+#define SAVE_FONT2 1
#undef SAVE_TEST
-#define SAVE_TEST
+#define SAVE_TEST 1
#undef FONT_AMOUNT
#define FONT_AMOUNT 65536
#undef TEXT_AMOUNT
@@ -720,13 +720,12 @@ vgaHWSeqReset(vgaHWPtr hwp, Bool start)
void
vgaHWRestoreFonts(ScrnInfoPtr scrninfp, vgaRegPtr restore)
{
+#if SAVE_TEXT || SAVE_FONT1 || SAVE_FONT2
vgaHWPtr hwp = VGAHWPTR(scrninfp);
int savedIOBase;
unsigned char miscOut, attr10, gr1, gr3, gr4, gr5, gr6, gr8, seq2, seq4;
Bool doMap = FALSE;
-#if defined(SAVE_TEXT) || defined(SAVE_FONT1) || defined(SAVE_FONT2)
-
/* If nothing to do, return now */
if (!hwp->FontInfo1 && !hwp->FontInfo2 && !hwp->TextInfo)
return;
@@ -782,7 +781,7 @@ vgaHWRestoreFonts(ScrnInfoPtr scrninfp, vgaRegPtr restore)
hwp->writeGr(hwp, 0x01, 0x00); /* all planes come from CPU */
}
-#ifdef SAVE_FONT1
+#if SAVE_FONT1
if (hwp->FontInfo1) {
hwp->writeSeq(hwp, 0x02, 0x04); /* write to plane 2 */
hwp->writeGr(hwp, 0x04, 0x02); /* read plane 2 */
@@ -790,7 +789,7 @@ vgaHWRestoreFonts(ScrnInfoPtr scrninfp, vgaRegPtr restore)
}
#endif
-#ifdef SAVE_FONT2
+#if SAVE_FONT2
if (hwp->FontInfo2) {
hwp->writeSeq(hwp, 0x02, 0x08); /* write to plane 3 */
hwp->writeGr(hwp, 0x04, 0x03); /* read plane 3 */
@@ -798,7 +797,7 @@ vgaHWRestoreFonts(ScrnInfoPtr scrninfp, vgaRegPtr restore)
}
#endif
-#ifdef SAVE_TEXT
+#if SAVE_TEXT
if (hwp->TextInfo) {
hwp->writeSeq(hwp, 0x02, 0x01); /* write to plane 0 */
hwp->writeGr(hwp, 0x04, 0x00); /* read plane 0 */
@@ -828,7 +827,7 @@ vgaHWRestoreFonts(ScrnInfoPtr scrninfp, vgaRegPtr restore)
if (doMap)
vgaHWUnmapMem(scrninfp);
-#endif /* defined(SAVE_TEXT) || defined(SAVE_FONT1) || defined(SAVE_FONT2) */
+#endif /* SAVE_TEXT || SAVE_FONT1 || SAVE_FONT2 */
}
@@ -906,13 +905,12 @@ vgaHWRestore(ScrnInfoPtr scrninfp, vgaRegPtr restore, int flags)
void
vgaHWSaveFonts(ScrnInfoPtr scrninfp, vgaRegPtr save)
{
+#if SAVE_TEXT || SAVE_FONT1 || SAVE_FONT2
vgaHWPtr hwp = VGAHWPTR(scrninfp);
int savedIOBase;
unsigned char miscOut, attr10, gr4, gr5, gr6, seq2, seq4;
Bool doMap = FALSE;
-#if defined(SAVE_TEXT) || defined(SAVE_FONT1) || defined(SAVE_FONT2)
-
if (hwp->Base == NULL) {
doMap = TRUE;
if (!vgaHWMapMem(scrninfp)) {
@@ -961,21 +959,21 @@ vgaHWSaveFonts(ScrnInfoPtr scrninfp, vgaRegPtr save)
hwp->writeGr(hwp, 0x05, 0x00); /* write mode 0, read mode 0 */
hwp->writeGr(hwp, 0x06, 0x05); /* set graphics */
-#ifdef SAVE_FONT1
+#if SAVE_FONT1
if (hwp->FontInfo1 || (hwp->FontInfo1 = xalloc(FONT_AMOUNT))) {
hwp->writeSeq(hwp, 0x02, 0x04); /* write to plane 2 */
hwp->writeGr(hwp, 0x04, 0x02); /* read plane 2 */
slowbcopy_frombus(hwp->Base, hwp->FontInfo1, FONT_AMOUNT);
}
#endif /* SAVE_FONT1 */
-#ifdef SAVE_FONT2
+#if SAVE_FONT2
if (hwp->FontInfo2 || (hwp->FontInfo2 = xalloc(FONT_AMOUNT))) {
hwp->writeSeq(hwp, 0x02, 0x08); /* write to plane 3 */
hwp->writeGr(hwp, 0x04, 0x03); /* read plane 3 */
slowbcopy_frombus(hwp->Base, hwp->FontInfo2, FONT_AMOUNT);
}
#endif /* SAVE_FONT2 */
-#ifdef SAVE_TEXT
+#if SAVE_TEXT
if (hwp->TextInfo || (hwp->TextInfo = xalloc(2 * TEXT_AMOUNT))) {
hwp->writeSeq(hwp, 0x02, 0x01); /* write to plane 0 */
hwp->writeGr(hwp, 0x04, 0x00); /* read plane 0 */
@@ -1002,7 +1000,7 @@ vgaHWSaveFonts(ScrnInfoPtr scrninfp, vgaRegPtr save)
if (doMap)
vgaHWUnmapMem(scrninfp);
-#endif /* defined(SAVE_TEXT) || defined(SAVE_FONT1) || defined(SAVE_FONT2) */
+#endif /* SAVE_TEXT || SAVE_FONT1 || SAVE_FONT2 */
}
void