Re: amd64 9.1, pre-wscons text colours?

2020-11-11 Thread Mouse
> you mean you don't get a graphic console right away on that machine?

For what value of "right away"?  Autoconf starts printing[%] in (what
looks like the) same text mode used by the bootloader - no visible
mode-change glitch (it's connected to a flatscreen on which mode-change
glitches are really obvious, about a half-second of blank screen).  It
takes a few seconds, and lots of lines of output[$], before DRMKMS
takes over and switches the hardware into graphics mode.  So, depending
on what "right away" means here, that might be yes or might be no.

[%] In whatever colours are selected (where light-brown-on-blue,
presumably among other colour combinations, gets mapped to
white-on-black by some mechanism, as discussed upthread).

[$] Based on comparing a very quick glimpse of the last output before
the mode switch against /var/run/dmesg.boot after it's up, about
320 lines.

> Is this BIOS related?

I don't know.  I saw someone saying something about it possibly being
UEFI-related.  The BIOS splash screen talks about UEFI, but the way the
disk is set up is plain old MBR, nary a GPT in sight, so presumably
it's booting via non-UEFI ("legacy") mechanisms.

/~\ The ASCII Mouse
\ / Ribbon Campaign
 X  Against HTMLmo...@rodents-montreal.org
/ \ Email!   7D C8 61 52 5D E7 2D 39  4E F1 31 3E E8 B3 27 4B


Re: amd64 9.1, pre-wscons text colours?

2020-11-11 Thread Michael van Elst
On Wed, Nov 11, 2020 at 09:32:26AM +0100, Reinoud Zandijk wrote:

> you mean you don't get a graphic console right away on that machine? Is this
> BIOS related?

With UEFI you start with genfb.

With BIOS there are three possibilities (ignoring the ega driver or
pcconsole):
- VGA text mode (the default)
- VGA graphics mode (if compiled with option VGA_RASTERCONSOLE)
- VESA graphics mode with genfb.


Greetings,
-- 
Michael van Elst
Internet: mlel...@serpens.de
"A potential Snark may lurk in every tree."


Re: amd64 9.1, pre-wscons text colours?

2020-11-11 Thread Reinoud Zandijk
On Wed, Nov 11, 2020 at 05:20:53AM -, Michael van Elst wrote:
> 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.
...
> When DRM takes over, such hardware limitations no longer apply.
> The framebuffer code can handle more colors.

you mean you don't get a graphic console right away on that machine? Is this
BIOS related?

Reinoud



Re: amd64 9.1, pre-wscons text colours?

2020-11-10 Thread David Holland
On Wed, Nov 11, 2020 at 05:20:53AM -, 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
dholl...@netbsd.org


Re: amd64 9.1, pre-wscons text colours?

2020-11-10 Thread Michael van Elst
mo...@rodents-montreal.org (Mouse) writes:

>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.

-- 
-- 
Michael van Elst
Internet: mlel...@serpens.de
"A potential Snark may lurk in every tree."


Re: amd64 9.1, pre-wscons text colours?

2020-11-10 Thread Mouse
>> What controls the colours used for console text output before wscons
>> takes over?  [...]

>> So there's clearly something I don't understand going on.  What?

> That's all wscons; drmkms taking over isn't the same step as wscons
> taking over.

Okay, that's _one_ thing I didn't understand :-)

> But anyway: my guess is that you can't use the bright colors.  I
> vaguely recall some issue with that long ago...

I just trawled for WSCOL_ in the kernel source tree.  The only thing I
see that could be responsible is this, in dev/rcons/rcons_subr.c:

/* Set ANSI colors */
void
rcons_setcolor(struct rconsole *rc, int fg, int bg)
{
int flg;

if (fg > WSCOL_WHITE || fg < 0)
return;

if (bg > WSCOL_WHITE || bg < 0)
return;

and the WSCOL_LIGHT_ colours are 8 higher than the non-LIGHT versions.
So if rcons is in use, this explains it.  (I'm not sure it is, but the
symptoms match, and I don't, offhand, see anywhere else that could be
responsible.  But I'm not at all certain I haven't missed something.)

Of course, the question now becomes _why_ that code is there.
According to cvsweb, it appeared in rev 1.3, on 1999-04-13, without any
indication what the purpose of it is; the commit message reads

| Many enchancements to rcons to support ANSI color and all attributes
| properly. All output now performed using a 'struct wsdisplay_emulops'.

(There are numerous other messages talking about "ANSI color", but I
_think_ it's actually ISO color; the SGR sequence is ANSI, but as I
understand it the colour-specifying arguments for it come from ISO
6429, not ANSI.  I've never found an authoritative source to say
whether this is a misunderstanding or not)

/~\ The ASCII Mouse
\ / Ribbon Campaign
 X  Against HTMLmo...@rodents-montreal.org
/ \ Email!   7D C8 61 52 5D E7 2D 39  4E F1 31 3E E8 B3 27 4B


Re: amd64 9.1, pre-wscons text colours?

2020-11-10 Thread David Holland
On Tue, Nov 10, 2020 at 06:39:53PM -0500, Mouse wrote:
 > NetBSD/amd64, 9.1.
 > 
 > What controls the colours used for console text output before wscons
 > takes over?  When I build a kernel with WS_KERNEL_FG=WSCOL_GREEN and no
 > WS_KERNEL_BG, I see green on black, both before and after the switch
 > from text mode to text-in-graphics mode.  WS_KERNEL_FG=WSCOL_BLACK and
 > WS_KERNEL_BG=WSCOL_BLACK, and both are black-on-black.
 > 
 > 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?

That's all wscons; drmkms taking over isn't the same step as wscons
taking over. But anyway: my guess is that you can't use the bright
colors. I vaguely recall some issue with that long ago...

-- 
David A. Holland
dholl...@netbsd.org