tech-kern archive

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

Re: amd64 9.1, pre-wscons text colours?



On Wed, Nov 11, 2020 at 05:20:53AM -0000, Michael van Elst wrote:
 > >But WS_KERNEL_FG=WSCOL_LIGHT_BROWN (I wanted yellow, that looks like
 > >the closeset available approximation) and WS_KERNEL_BG=WSCOL_BLUE?
 > >Once wscons switches, everything is as I would expect - but, before
 > >that, it's white on black!
 > 
 > >So there's clearly something I don't understand going on.  What?
 > 
 > 
 > VGA has only 8 colors and an intensity attribute. You cannot select
 > the "light" ANSI colors. The VGA driver will fail attempts to
 > allocate such color attributes, so you get white on black instead.
 > 
 >         if (__predict_false((unsigned int)fg >= sizeof(fgansitopc) ||
 >             (unsigned int)bg >= sizeof(bgansitopc)))
 >                 return (EINVAL);
 > 
 > 
 > When DRM takes over, such hardware limitations no longer apply.
 > The framebuffer code can handle more colors.

VGA hardware has 16 colors in text mode, eight each bright and dim.
The "intensity attribute" is the upper of the four color selection
bits and picks the bright colors.

You can't use the bright colors as _backgrounds_ without poking a
register somewhere: by default the top background color bit causes
blinking instead. It's reasonable we might not have code to do that,
just in case someone tries to boot on a machine with an EGA card or
something that doesn't have the register.

But if we can't use all 16 foreground colors, it's because of a driver
problem; it's not a hardware limitation.

-- 
David A. Holland
dholland%netbsd.org@localhost


Home | Main Index | Thread Index | Old Index