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.


Comments on this page:

The Fedora 36 DRM/KMS-only article says that the framebuffer console is still used. Therefore if no framebuffer driver is running, evidenced by a program like fbv failing with "Open /dev/fb0: No Such Device", yet a console is still displayed, one can conclude that the VGA text-mode console is in use. I've confirmed this with kernel 5.15, and would be surprised if it has changed in Fedora 36's kernel 5.17.

A perhaps more positive method of confirming the kernel's VGA text-mode console capability experimentally is to boot the same Linux live-CD (DVD, USB... actually it's still CDs with me) on PCs with different BIOS fonts and note the different font in which the console text is displayed. Obviously if the framebuffer console were in use, the same font would be used on all PCs because it comes from the OS instead of the BIOS. This again confirms VGA text-mode console functionality in kernel 5.15 based on my tests.

By Jon Smirl at 2022-06-20 18:42:14:

This may explain a few things... https://sites.google.com/site/jonsmirl/graphics

The purpose of that article was to kickstart Wayland development.

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, View Normal.
Search:
Login: Password:

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