Modernizing the OpenBSD Console
cambus.net
cambus.net
While it's not quite related to consoles, I've noticed that the non-GUI interface to a lot of operating systems often don't get a lot of love. Linux has had a fairly nice boot scroll, but I think part of that is because it's become an icon and as such is part of the public face of the OS; but on macOS for example it's an tiny awful experience because the text doesn't scale to 2x (you'd think Apple would be the first one to fix this…) and the output isn't well formatted at all–it's just the various subsystems spewing text as they start up. And a lot of modern systems use kind of old fonts that in many cases seemed to be picked as an afterthought…
Carmack has been aware of and actively involved in UNIX systems for a long time now. This isn't a recent discovery. However it has been recently noticed that he's committing to OpenBSD.
To be fair, they have one of the very few terminal apps that support double-width/height characters and that passes the VT torture test with flying colors.
here are the VT100 ansi escape codes: https://espterm.github.io/docs/VT100%20escape%20codes.html
Bold, Underline, Double height, double width, etc... are all there. VT100, from 1978.
In my dreams, when switching to Tek mode, the framebuffer would have a dark green background, the lines would have a brighter green, and drawing would push the HDR for the brightest green it'd be able to do (because to store a vector in a Tektronix DVST, you flash it with a high energy beam). Erasing the screen would flash it light green and there would be no scrolling.
Awesome
A better optimization comes with the realization, as MacOS people had many years ago, that copying from system memory to video memory is slow. So one instead pre-loads the glyphs into off-screen video memory, possibly on-demand, and then uses the display hardware to blit them into the on-screen part.
Of course, this requires that code know about blitter hardware, which does not necessarily exist. If one is doing an in-kernel terminal emulator, such as wscons in OpenBSD here, then one can rely upon the fact that the EFI Graphics Output Protocol provides a Blt() function that is supposed to abstract away the hardware. Indeed, EFI GOP can in theory not provide direct framebuffer access in the first place and require that everything be blitted (PixelBltOnly).
We who write application-mode terminal emulators are not so fortunate. (-:
But if one is looking at PCI device IDs, then one is already at the level of the code having detailed knowledge of the specific hardware (even if only via some "miniport"-like system) and the point stands.
Any design that depends from "you'd probably get lucky" is not a wise one. (-:
> In framebuffer however, to fill a 4K UHD-1 (3840x2160) screen in 32bpp mode we need to send 3840 * 2160 * 4 bytes of data, which is 33177600 bytes (approximately 33 MB).
but I don't know if that is in fact the definition a "framebuffer console" versus a terminal that uses character addressing.
That's a different issue that actually supporting 32-bit ANSI codes, but I think it's an indication of the scope of a an effort to update the console implementation.
The diffs that are attributed to Carmack seem to deal with this. scr->rs_bs[off].uc and scr->rs_bs[off].attr appear to represent the gylph and attributes/color respectively.
So I would expect that would severely limit the amount of colors available to the input buffer. OTOH I just found the declaration in the code and the attributes are 32 bits wide which is more than the 8 that VGA provides:
struct wsdisplay_charcell {
u_int uc;
uint32_t attr;
};
Note I would expect the 32 bits of attr to be divided between fg and bg color, and it seems like they carved out bits for things like underline.Edit: after reading some more it seems like the color values range from 0-7.
Factor in things like the KiTTY underlining system, invisible, the little-recognized new (sic!) ECMA-48:1991 graphic renditions (encircled, framed, and overlined), and strikethrough; and one actually needs 13 to 14 bits (depending from how far one takes the KiTTY underlining system).
Moreover: No-one doing this style of terminal emulator really does Unicode properly. To do so actually involves having a string of one or more code points per cell, not simply exactly one. Some of the terminal emulators based upon external GUIs (e.g. X11) do do that, or approach it. (Although at the same time they take a giant leap backwards from video terminal semantics to paper terminal semantics, so it is a matter of swings and roundabouts. See https://unix.stackexchange.com/a/593613/5132 .)
Yes, and as I mentioned you need to divide between FG and BG colors.
All a little moot because it seems to me like the code uses 3 bits for color.
> No-one doing this style of terminal emulator really does Unicode properly
Indeed, both multi-char and multi-codepoint glyphs. I also think the whole "matrix of glyphs" thing breaks down pretty severely when you want BiDi support for instance. The article mentions someone working on UTF-8 support. I wonder what that looks like.
* https://itu.int/rec/T-REC-T.416
As M. Kochkov will attest, supporting 24-bit RGB (or even 32-bit ARGB) colour involves (a) recognizing and processing the new (sic!) control sequences from the 1990s, and (b) actually supporting having the display hardware in a non-palettized true colour mode (as opposed to using a 256-colour palettized mode and pretending).
The definition of a framebuffer virtual terminal is, rather, that the display hardware is in its graphics mode rather than its text mode. (This was the norm for some architectures, which didn't even have text mode display hardware. But the MDA/Hercules/CGA/EGA/VGA on the IBM PC and compatibles did.) The operating system, that is providing the virtual terminal, draws the glyphs by manipulating pixels, rather than relying upon "character generation" hardware to do it in the video output stage of the adapter.
Armorlogic, Calyptix Security, GeNUA, RTMX, and .vantronix make network appliances based on the complete OS.
HSMs from nCipher used to run on top of (a slightly modified, IIRC) OpenBSD. Just as JunOS (the OS on (some) Juniper network devices) runs on FreeBSD, I'm sure there are many other commercial products built on OpenBSD as well -- we just don't hear about them very much.
---
Related (from the same author as this submission): "Why OpenBSD?" [0].
---
In some cases, the font is way too small. Changing the font size is confusing, because it isn't clear what size of text you will end up with.
And on some of the systems I have, the framebuffer scrolls so slow!!!!! Drives me up a wall. If it takes more than a tiny fraction of a second to display an entire screen of text, that is too slow!!!! Hate it, hate it, hate it.
glances at the VT-320 hooked to the OBSD firewalls
I'm personally after a small HP terminal that was nicknamed the "munchkin" for its diminutive size. My chances of finding one that can be shipped here are slim, but from the US you could have a better chance.