Text consoles and framebuffer consoles in Linux

June 10, 2022

If you've been running x86 Linux servers for long enough, you've probably noticed two changes in the kernel's text console. On the one hand, the text console has gotten substantially bigger, sporting sizes like 128x40 instead of the much smaller old sizes, for example 80x25. On the other hand, text output to the console has generally gotten slower, usually much slower than you would expect for the change in console size. These two changes are not unrelated, because they are both part of a fundamental change in how the kernel console normally worked and works on x86 hardware.

For a long time, the Linux kernel text console on x86 hardware used VGA text mode (also). The important thing about VGA text mode is that what the kernel wrote into display memory in order to show things was not pixels but characters (okay, 8-bit codepoints). The actual text buffer used two bytes in order to add colour and attributes, but that's only a small change. The important thing is that manipulating an 80x25 buffer of 16-bit objects is quite fast. Completely repainting the entire screen requires writing only 4,000 bytes.

When we got kernel mode setting, this VGA text mode way to display console text went away. Instead, once the kernel sets the mode it switches over to a framebuffer console. The framebuffer 'text' console is text rendering done on top of a fully pixel-addressable framebuffer (or these days on top of the kernel's DRM system and a suitable graphics driver). As you may have noticed, the kernel's framebuffer console implementation is not the fastest thing in the world (for whatever reason).

(I believe that the framebuffer console driver on x86 hardware emulates VGA text mode, but it's only an emulation and the actual display of text is done by directly copying font bitmaps around and otherwise manipulating the framebuffer on a pixel by pixel basis.)

I'm not certain how the console works these days if you use the 'nomodeset' kernel parameter. Some things in Fedora 36: A brave new (DRM/KMS only) world suggest that the kernel may now always uses some sort of framebuffer and framebuffer console rendering, not VGA text mode rendering (even on systems without the Fedora 36 change). On the other hand, an Ubuntu 22.04 machine booted with 'nomodeset' reports 'Console: colour VGA+ 80x25' (and no additional console messages, such as, eg, 'Console: switching to colour frame buffer device 128x48'). Energetic people may get more from the kernel's Console Drivers documentation than I did.

Written on 10 June 2022.
« How we wound up with Linux's kernel mode setting ('KMS')
Linux kernel mode setting on servers (and Ubuntu 22.04) »

Page tools: View Source, Add Comment.
Login: Password:
Atom Syndication: Recent Comments.

Last modified: Fri Jun 10 22:49:32 2022
This dinky wiki is brought to you by the Insane Hackers Guild, Python sub-branch.