Some characters always display highlighted on VGA console.

Bug #392795 reported by Norm Pierce
8
This bug affects 1 person
Affects Status Importance Assigned to Milestone
usplash (Ubuntu)
Invalid
Undecided
Unassigned

Bug Description

Binary package hint: usplash

Ubuntu 8.10
Linux 2.6.27-14-generic #1 SMP Wed Apr 15 18:59:16 UTC 2009
linux-image-2.6.27-14-generic, Version: 2.6.27-14.33
usplash, Version 0.5.25

After booting a recent kernel with usplash ("splash") and no frame buffer ("nofb"), when using 512-character console fonts (like Uni1-Fixed16), glyphs in the second half of the font are always displayed highlighted (that is, bright white, not dull white). This can best be seen by switching to the console immediately after booting and running showconsolefont. (If you have not patched the kernel to fix the font corruption issue with the 512-character fonts, you may need to first run setfont Uni1-Fixed16 to see all of the characters.)

Some background: Normally, in text mode, the VGA hardware can only display 256 unique characters, since only 8 bits are available for each character in text memory. In order to display 512 unique characters, a bit must be "stolen" from the attribute memory, which normally is used for the character's foreground and background colors. The bit that is "stolen" is normally used to define the brightness of the character's foreground color. In fact, thanks to this bug, we see that it still can affect the character's brightness even after it has been "stolen". In order to get all 512 characters to be displayed at the same intensity, the kernel clears a bit in the VGA's Color Plane Enable Register to disable the corresponding bit plane. Now when a binary 1111 (bright white) is passed to the color palette, only 0111 (dull white) gets through.

At boot time, console-setup is run very early, even before usplash. If the font loaded by console-setup is a 512-character font, the kernel clears the necessary bit, as discussed above. Then usplash runs, switches to a graphics mode, does its thing, then exits. When it exits it puts the console back into text mode and restores the font to the VGA memory, but it never restores the VGA registers. Most of the VGA registers are set up fine, just by switching to text mode, but not the one we are interested in here.

Oddly enough, usplash does save the VGA registers -- it just never restores them. It did up until a few years ago, but that was changed.

I am including a couple of patches for consideration. Either one should fix the problem. One patch, "restore_all_regs.patch", simply restores the code that restores all of the VGA registers. The other patch, "restore_cpe_reg.patch", restores only the Color Plane Enable Register -- the one register that relates to this bug. I think the first patch is probably the better patch, and could make usplash a little more robust by possibly preventing other bugs from cropping up in the future due to registers that were not restored. On the other hand, there is something to be said for making the smallest change necessary to fix a bug, and thus reduce the chances of creating others, which is why I've included the second patch.

This problem is mentioned by Uwe Geuder in a comment to LP:355057:
https://bugs.launchpad.net/ubuntu/+source/linux/+bug/355057/comments/12

Reports for other bugs that also happen to mention a similar problem which may or may not be related to this bug:
https://bugs.launchpad.net/bugs/303561
https://bugs.launchpad.net/bugs/159053

Note that this problem does not occur when booting the 8.10 Live CD. This is only because there was a problem with an initramfs script which prevented the font from being loaded before usplash was run. That problem was fixed last November. So you need a kernel newer than that to test this.

To reproduce:

1. grep CODESET /etc/default/console-setup
2. If CODESET is not a 512-character codeset (like Uni1, Uni2, or Uni3), run
    sudo dpkg-reconfigure console-setup
    to change it.
3. Ensure that the /boot/initrd... file that you boot with was the one that was
    updated by dpkg-reconfigure (it isn't always)
4. Boot using the nofb and splash options. (You have a recent kernel, right?)
5. Wait for system to fully boot up, then switch to a text console and log-in.
6. showconsolefont
7. Ignore the garbage between the columns of characters -- that's another bug.
8. If the 256 characters on the right are missing or trashed, run
    setfont Uni1-Fixed16
9. If the 256 characters on the right are brighter than the 256 on the left,
    you have this bug.

Revision history for this message
Norm Pierce (npierce-at2a) wrote :
Revision history for this message
Norm Pierce (npierce-at2a) wrote :
description: updated
Revision history for this message
Norm Pierce (npierce-at2a) wrote :

Another bug resulting from the fact that usplash doesn't restore the VGA registers is LP:395374.

Either of the two patches that I attached to that bug report should fix both that bug and this one. The first patch above will also fix both bugs, but the second, "Patch to make usplash restore Color Plane Enable Register", will only fix this bug, so one of the other patches is preferred.

All patches have worked fine for me, but whichever patch, if any, is used, I hope that someone who knows the code better than I do will look it over to see if any handshaking is necessary to prevent usplash and the kernel from trying to write to the VGA registers at the same time.

(By the way, the "garbage" mentioned in step 7 above, that is displayed by showconsolefont with some recent kernels, should be eliminated by kernel 2.6.30. See http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=528357 for details.)

Revision history for this message
Norm Pierce (npierce-at2a) wrote :

Be aware, when testing this, that other problems can also cause this symptom.

If you are using a Radeon X1600 video card, these patches may not work for you. When using this card (at least the one that I borrowed) the Color Plane Enable register is apparently ignored. Not only does changing the register from 0xF to 0x7 fail to mask bright colors, changing it to zero, in an attempt to disable all color planes, still allows all sixteen colors to be displayed.

This is true whether or not usplash is run.

Thinking that there might be a control bit in some extended register that causes the Color Plane Enable register to be bypassed, and that some other boot-time software was modifying it and not restoring it, I looked through the somewhat limited documentation available for this card, searching for such a bit. But I came up empty handed.

By then I was beginning to think that this might simply be a VGA compatibility issue. ("VGA Compatible" is a term sometimes used loosely by manufacturers.) So I wrote a snippet of code to a boot floppy, to be executed immediately at boot-time. This code wrote 0x7 to the Color Plane Enable register and succeeded in masking the bright colors on all the machines I booted with it, except for the one with the Radeon X1600.

So it looks like there may be a hardware problem with the X1600. I can't really say for sure. I suppose it is possible that the PC's BIOS is messing with the registers on the Radeon before passing control to the boot floppy, but it seems unlikely. Or the X1600 I used could be defective.

I would be interested to hear from any other X1600 or other Radeon users who are experiencing similar problems, or not. A quick test to run is this:

setfont Lat15-Fixed16 ; setfont Uni1-Fixed16 ; showconsolefont

This should show all 512 glyphs of the Uni1-Fixed16 font, all of the same color and intensity. (This works even if you booted with usplash.) If this is what you see, your video card is working properly (or at least its Color Plane Enable logic is). If the glyphs on the right are a different color or intensity than those on the left, you may possibly have the same problem I found when using the Radeon X1600.

I could supply the test boot floppy image if the above test fails for anyone, and further testing is desired.

Revision history for this message
Phillip Susi (psusi) wrote :

The usplash package has been superseded by plymouth and has been removed from the Ubuntu archive. Closing all related bugs.

Changed in usplash (Ubuntu):
status: New → Invalid
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.