Grub2BootFramebuffer

Summary

GRUB2 supports programming a VBE mode in the boot loader and telling the kernel about it, causing the kernel to use a framebuffer at boot. With Linux 2.6.34, vesafb/efifb can hand over smoothly to a KMS driver, allowing us to assemble all of this into something very close to a flicker-free boot splash process.

Release Note

Ubuntu now enters graphical mode in the boot loader, and remains in graphical mode for the duration of the startup process.

Rationale

We would like to get to the point where users can be in graphical mode throughout the entire boot, particularly to cover the several seconds (sometimes more) of blank screen before Plymouth.

We currently come up in text mode, but have to switch to graphics before we can go to splash. A high-resolution console is preferable as early as possible as we can then do it only once, and therefore do *less*. If we always had a framebuffer, we would have to do this exactly once, so we could always do graphics: win. We would also have better fallback options available: X could fall back to the framebuffer. It should be noted that almost all other architectures are framebuffer from the start, so this would bring x86 into line with them.

In the process of all of this, we want to not break all the fiddly stuff - non-KMS, suspend/resume, etc.

While trying to do this in Ubuntu 10.10, we found that KMS drivers were not able to program the card correctly from anything other than VGA modes on many machines. While this was not entirely unexpected, it forced us to back out this feature and reconsider it for Ubuntu 11.04.

Design

Kernel

Linux 2.6.34 deals with much of this. We also need something like https://patchwork.kernel.org/patch/19287/ to get fbcon to preserve the initial framebuffer contents on startup.

fbcon needs to be built-in on all architectures (already done on ports). vesafb needs to be built-in on x86.

Note that we will likely require a mode change to a non-VESA native mode at some point in the proceedings, at least on KMS, so we will still have the same number of mode switches. For the time being, this is inevitable and probably worth it: almost any plausible graphical mode is better than a black screen with a blinking cursor. (If OEMs can arrange for appropriate VBE modes to be available, this will very likely mitigate this problem.)

Bugs from the attempt at implementing this blueprint in the 10.10 cycle include:

We will need to organise responsive triaging of this category of bugs, and give graphics upstreams a heads-up about a likely influx of bug reports.

GRUB

We will fix GRUB to program vesafb rather than efifb in the boot parameters structure on x86, following guidance from kernel developers. We will then change GRUB's packaging to use vesafb by default provided that we have a new enough kernel.

The default video mode will be a VBE mode, which GRUB can handle natively. There has been some suggestion of importing KMS drivers into GRUB; while this would be an interesting future enhancement, for now we should probably keep things reasonably simple.

We will reuse Plymouth's logo file as a GRUB background image, being aware of scaling/centring issues (it may be possible to do this on the fly in GRUB), and set appropriate foreground/background colours. The background image will be shown even if we aren't showing the menu. (Tentative amendment for Natty: we will simply display a flat background matching the background colour of the Plymouth logo. This avoids scaling/centring issues entirely and still looks reasonable.)

MichaelFrey believes that GRUB fails to set VESA modes on some hardware. We will need to test early, and hunt-and-destroy such problems.

Once everything is in place, it should be feasible to once again pause briefly to allow access to GRUB.

To handle machines where this breaks, we must have the ability to blacklist/whitelist machines; initially, we will blacklist PCI IDs of video cards with problems, and around feature freeze we will consider whether breakage is still widespread enough that we need to switch to a whitelist approach instead. The blacklist needs to be done at GRUB loader time, because if we do it in grub-mkconfig then swapping video cards may result in inability to boot.

Since we will now need to scan the PCI bus, we will need to fix 641259 properly, rather than merely working around it as we did in 10.10.

Plymouth

Plymouth needs to cope with the framebuffer mode changing during boot, as it currently produces garbled output. This is probably just a bug fix (Scott thinks Plymouth's design is already sufficient).

Suspend/resume

We will quirk pm-utils to do VBE state/mode save/restore when using efifb or vesafb. We will be relying on quirking here and VT switching to ensure that suspend/resume will restore the video. This is an area where bugs are likely and early testing will be beneficial.

(Update: This seems to have already been done upstream, or perhaps we misunderstood the code when we read through it initially. pm-utils enables VBE state/mode save/restore if it doesn't know any better, and only turns it off if explicitly instructed or for various special cases, which do not include efifb or vesafb.)

X

The current failsafe X system can be simplified in light of this specification, since fbdev will always be available. We should ensure that a visual indication is displayed in the event that X falls back from some other driver to fbdev.

Modern NVIDIA cards can set modes, but can't restore them after resume. Fortunately, these cards are supported by both nouveau and nvidia-glx, but this means that this wouldn't work with the nv driver. Further feedback is welcome.

Test/Demo Plan

It's important that we are able to test new features, and demonstrate them to users. Use this section to describe a short plan that anybody can follow that demonstrates the feature is working. This can then be used during testing, and to show off after release. Please add an entry to http://testcases.qa.ubuntu.com/Coverage/NewFeatures for tracking test coverage.

This need not be added or completed until the specification is nearing beta.


CategorySpec

FoundationsTeam/Grub2BootFramebuffer (last edited 2010-12-15 15:12:08 by cjwatson)