February 20, 2009 posted by Jared McNeill
The i386-specific vesafb(4) framebuffer driver has been superseded by the generic genfb(4) driver. Due to this change, framebuffer console support is now available on amd64 as well as i386.
On i386, generic framebuffer console support was provided by the device driver. This driver used the KVM86 subsystem to switch from protected mode to real mode to perform VESA BIOS calls. There were however numerous problems with this approach:
- The KVM86 subsystem was not used by any other code in the GENERIC kernel, and was thus not adequately tested and prone to crashing. It is also only available on i386.
- KVM86 APIs rely on struct trapframe, which meant that a driver written for KVM86 on i386 could not be easily ported to amd64 even if the subsystem was available.
- There was no method of specifying a desired video mode outside of compile-time options.
- Early console support (for userconf(4)) was not available.
- Unnecessary code duplication from other ports.
On NetBSD -current, things have changed. The x86 boot(8) has been enhanced to allow setting VESA video modes, and can now pass this information on to the kernel. This is similar to how other platforms work (sparc64, macppc, etc); the firmware initializes the framebuffer and the kernel can ask for information such as the location of video memory and screen parameters. This allowed us to easily piggy-back on the existing genfb(4) driver to provide framebuffer console services with minimal code in the kernel; the only MD hooks being the ability to pass the screen information to the device driver, and a callback for setting DAC palette registers when in 8bpp mode.
The GENERIC kernel now includes support for this by default, so with an updated kernel and /boot, one can simply specify in boot.cfg:
menu=Boot NetBSD:vesa 1280x800;boot netbsd
menu=Boot NetBSD (VGA):boot netbsd