problem reading VGA text fonts

Harald Koenig (
Tue, 19 Nov 1996 10:01:45 +0100 (MET)


I spent a lot of time trying to find out why XF86_S3 doesn't restore
the text font correctly for DEC ALpha/AXP when switching back to text mode
but I still don't know why and now I need your help and ideas.
tests (see below) show that the font gets corrupted when trying to read/save
it from the VGA card when starting X11.

NOTE that his problem only shows up for Alpha/AXP, I never saw any
text font corruption for any of my cards (all S3) with my Intel PC.

first I thougt it's a problem only with the ViRGE card but it happens
too with S3 864, Trio64V+ and 968. also I got a report that it's not
only my XL266 box but at least also a problem with a PC64/300 box with S3 cards.

does anyone else have problems with text font corruption ?
since the save/restore code is the same for all VGA cards I'd like
to know if this only happens for S3 or for other cards too
(it's always Xserver/hw/xfree86/vga256/vga/vgaHW.c).

this doesn't happen all the time but starting X several times
probably will show it; e.g. use

n=1; while [ $n -le 20 ] ; do xinit & sleep 5 ; killall xterm ; n=$[ $n+1 ] ; done

if you see any corruption, please mention card and chip, which alpha
architecture, cpu etc. and which type of corruption.

I see 3 different types of font corruptions:

- some few ramdom pixels set (sometimes cleared) in the character glyph
- completely trashed glygh (random pattern)
- block of 16 characters/glyphs is "shifted", e.g. very often ASCII
0x30-0x3f (digits etc. up to '?') displays glyphs for ASCII 0x20-0x2f
so pressing '1' I see a '!'
since one character glyph is 32 bytes when saved/restored, the size
of such a "shifted" block is always 512 bytes. any idea about this size?

looking at the code of vgaHWsave() in vgaHW.c I tried lots of things:

- writing the font/text areas to a file directly after copying it from
the card shows that here it's already bad (if font gets corrupted when leaving X)

- tried to use outb() instead of outw()

- tried lots of different copy routines (tried memcpy() too) and delays
in/after slowbcopy (slowbcopy does a mem_barrier() after every single
byte copied when calling outb(0x80, 0x00))

- changed the order of the SAVE_FONT1, SAVE_FONT2 and SAVE_TEXT blocks
(text is never corrupted; maybe this is restored by the Linux kernel
vc switching ?)

- added some code to do a syncronous reset on SR like in linux kernel code
in linux/drivers/char/vga.c

- tried to copy area multiple times and compare destinantions;
they are always the same

any idea what might explain these types of corruptions?

what's the "magic" about 512 byte font blocks? why are always 16 characters
overwritten by some "shifted" glyphs (always 16glyph-aligned) ?

what's different between AXP and x86 ?

what should be tested/checked next ?

thanks for any idea,


All SCSI disks will from now on                     ___       _____
be required to send an email notice                0--,|    /OOOOOOO\
24 hours prior to complete hardware failure!      <_/  /  /OOOOOOOOOOO\
                                                    \  \/OOOOOOOOOOOOOOO\
                                                      \ OOOOOOOOOOOOOOOOO|//
Harald Koenig,                                         \/\/\/\/\/\/\/\/\/
Inst.f.Theoret.Astrophysik                              //  /     \\  \                     ^^^^^       ^^^^^

To unsubscribe: send e-mail to with
'unsubscribe' as the subject.  Do not send it to

Feedback | Store | News | Support | Product Errata | About Us | Linux Info | Search | JumpWords
No Frames | Show Frames

Copyright © 1995-1997 Red Hat Software. Legal notices