A Preview Of Kernel-Based Mode-Setting

Written by Michael Larabel in Display Drivers on 19 April 2008 at 04:14 PM EDT. Page 1 of 4. 9 Comments.

There are many new and innovative features brewing within the X.Org development community right now -- among the many are Gallium3D, the TTM memory manager, and MPX (Multi-Pointer X) -- but one of the features that has risen towards the top of the list and delivers visible benefits to the end-user is kernel-based mode-setting. As implied by its name, kernel mode-setting involves moving the mode-setting code for video adapters from the user-space X server drivers into the Linux kernel. This may seem like an uninteresting topic for end-users, but having the mode-setting done in the kernel allows for a cleaner and richer boot process, improved suspend and resume support, and more reliable VT switching (along with other advantages). Kernel mode-setting isn't yet in the mainline Linux kernel nor is the API for it frozen, but Fedora 9 shipping next month will be the first major distribution carrying this initial support. In this article we're looking more closely at kernel mode-setting with the Intel X.Org driver as well as showing videos of kernel-based mode-setting in action.

There is currently work underway in porting the Radeon driver to do kernel mode-setting (the driver is named radeon_ms), but for Fedora 9 the only X.Org driver with this support is the open-source Intel driver. Support for the kernel mode-setting interaction isn't in the mainline xf86-video-intel driver, but the Fedora 9 Intel driver is based upon the intel-kernelmode branch. The intel-kernelmode branch is in turn based upon the intel-batchbuffer branch. Intel-batchbuffer is also the branch that contains the initial DRI2 support, TTM memory management, Render improvements, and other bleeding-edge advancements. Other drivers will turn to using kernel mode-setting once the API is stabilized and can be found in the mainline Linux kernel. On the Mesa/DRM side is a modesetting-101 branch.

Suspend and resume support is improved with kernel mode-setting as the kernel no longer relies upon external resources for restoring the graphics adapters. With the process now being in-kernel, it's able to restore the mode automatically and more quickly. Likewise, virtual terminal switching is also improved as a result. Kernel mode-setting will also allow for an improved debugging experience, as this will eliminate the "hard hang" and make it possible to display a graphical error message (think the "Blue Screen of Death" for Linux). This technology leads to a flicker-free boot experience by only needing to set the video mode once, instead of turning on and off when starting the boot process (in the case of Fedora, with Red Hat Graphical Boot) and then properly initializing the device when the X server has finally started and loading the GNOME Display Manager. Kernel mode-setting has been one of the items on Keith Packard's (Intel) list of features for a happy Linux desktop.

The kernel mode-setting components ship by default with Fedora 9, but the Intel kernel mode-setting isn't enabled by default. In order to make the switch, i915.modeset=1 must be set as one of the kernel command line arguments through GRUB on boot or modifying /boot/grub/grub.conf. Until kernel mode-setting is used by default, this command is necessary to let the system know to use this method as opposed to mode-setting via the user-space X driver.


Related Articles