KMSCON: A DRM-Based Terminal Emulator

Written by Michael Larabel in Free Software on 28 March 2012 at 09:22 AM EDT. 7 Comments
FREE SOFTWARE
Announced yesterday was the release of kmscon, a terminal emulator for Linux that's similar to what's offered inside the kernel, but instead it's in user-space and relies upon the kernel's DRM interfaces as well as Mesa.

Last year Jesse Barnes of Intel wrote a Linux guide to hacking with EGL and KMS as a means of using EGL and KMS with OpenGL directly and not having any X.Org Server rest in-between. In that blog post guide, he also wrote "Both on dri-devel and at the most recent Kernel Summit, the idea of a KMS based console program came up yet again. So in the interest of facilitating the lazyweb to write one, I thought I’d provide a review of what it takes to write a simple KMS program that ties in with GL, just in case anyone wants to port the VTE widget and give me my VTs on a cube. :) The ideal situation would be one where a distro could set CONFIG_VT=n and have userspace provide all console services, including support for the various types of input and output that exist in the wild today. The only thing that ought to be left to the kernel is spitting out panic information somehow. That means having a very simple text drawing layer remain, and a way for the kernel to flip to the latest kernel console buffer (today these functions are provided by fbcon and the DRM KMS layer, but if a userspace console service existed, we could likely clean them up quite a bit, and remove the need for the full VT and fb layers to be compiled in)."

Someone has finally gone through and has done what Jesse and many others have desired: created kmscon. The kmscon program was announced by David Herrmann, a relatively unheard of independent contributor to the Linux graphics stack but has been involved in other parts of Linux and was formerly a Google Summer of Code student working on the open-source Nintento Wiimote support under Linux.

Herrmann wrote in his mailing list message, "Motivated by Jesse's letter to the lazyweb [1] I worked on a kmscon program. It provides a terminal-emulator similar to the in-kernel terminal-emulator based on DRM. It is written from scratch and needs as external dependencies only mesa (libdrm, libgbm, libEGL, libGLESv2), udev, xproto (build-time dep), libxkbcommon, freetype2 and currently glib (only for unicode support)."

Herrmann's kmscon terminal emulator for DRM drivers currently has support for multiple displays (including hot-plugging of displays), full input support through the XKB common library, opens a separate VT that can be run together with other displays (such as an X.Org Server or Wayland), the VTE layer is currently very limited but under active development, and only one terminal is currently supported that's cloned across all outputs/displays.

David mentions, "It needs some more work in the VTE layer and on the UI but it's getting close to a first release."

Hopefully the kmscon program will be able to take off and thrive as a new terminal emulator relying upon the modern Linux graphics stack capabilities. The code along with other information is available from its GitHub repository.
Related News
About The Author
Michael Larabel

Michael Larabel is the principal author of Phoronix.com and founded the site in 2004 with a focus on enriching the Linux hardware experience. Michael has written more than 20,000 articles covering the state of Linux hardware support, Linux performance, graphics drivers, and other topics. Michael is also the lead developer of the Phoronix Test Suite, Phoromatic, and OpenBenchmarking.org automated benchmarking software. He can be followed via Twitter, LinkedIn, or contacted via MichaelLarabel.com.

Popular News This Week