One of the many things I work on is UEFI support. It’s an interesting thing to
work on, in part because there’s a lot of new development and it’s at a fairly
low level, which is just the sort of thing I like.
Often during UEFI development, we’ll see a bug and need to diagnose whether
it’s a problem with the hardware, the firmware, the bootloader, the OS kernel,
or even a userland program. One case of this is when console graphics don’t
work right.
A recent bug reported that console graphics weren’t working due to an invalid
pixel format being chosen. While diagnosing this problem, there are a couple
of things that could go wrong. The firmware driver could be reporting the
wrong modes, the bootloader could have a bug where it’s querying the modes
incorrectly or misinforming the kernel as to the mode chosen, or the kernel
could have a bug where it uses the mode incorrectly. It’s also possible that
the console works until a KMS driver - that is, a native driver for the card -
is loaded.
In UEFI, console graphics involves every part of the stack. The system firmware
provides an API known as Graphics Output Protocol, or GOP. The
algorithm used by the bootloader basically looks like this somewhat simplified
function: