|
|
Subscribe / Log in / New account

LPC: The future of Linux graphics

By Jonathan Corbet
September 24, 2008
On the final day of the Linux Plumbers Conference, Keith Packard ran a microconference dedicated to future displays. A number of topics were discussed there, but the key session had to do with the near-term future of Linux video drivers. Longtime LWN readers will be more than familiar with the story: Linux has multiple subsystems charged with managing graphics hardware, the user-space driver model adopted by XFree86 leads to all kinds of problems, support for 3D graphics is not what it should be, etc. That whole story was recounted here, but with a notable difference: solutions are in the final stabilization stages, and these problems will soon be history.

[Display session] There are two major components to the work which is being done: graphics memory management and kernel-based mode setting. A contemporary graphics processor (GPU) is really a CPU in all respects, including the possession of a sophisticated memory management unit. Managing the sharing of memory between user space, the kernel, and the GPU is fundamental to the implementation of correct, high-performance graphics. One year ago, the TTM subsystem looked like the solution to the memory management problem, but TTM grew increasingly unworkable as the understanding of the problem improved. So now the Graphics Execution Manager (GEM) code looks like the way forward; it is currently being prepared for merging into the mainline kernel.

Kernel-based mode setting, instead, is meant to get user-space code out of the business of messing around directly with the hardware. Putting the kernel in charge of the configuration of the video adapter has a long list of advantages. Suspend and resume have a much better chance of working, for example. Once the X server stops accessing hardware directly, it no longer needs to run as root; having that much untrusted code running with full privileges has made people nervous for many years. In the current scheme, the kernel cannot change the graphics mode if it needs to; that means that, for example, if the system panics, a graphical user will never see the message. With kernel-based mode setting, the kernel can switch to a different mode and allow the user to frantically try to read the message before it scrolls off the screen. Kernel-based mode setting will also make fast user switching work much better, without the need to use a separate virtual terminal for each user session.

One of the first topics of discussion was: how does the kernel decide when to switch to the panic screen to show the user an important message? There are quite a few different paths by which the kernel can indicate distress; should a kernel message be presented every time a WARN_ON() condition is encountered? There would appear to be a need to unify the error paths in the kernel to help simplify this kind of decision. Linus Torvalds Jesse Barnes suggested that the kernel could simply switch on every message emitted with printk(), on the theory that such a policy would lead to a rapid and welcome reduction in kernel verbosity.

The real debate in this session, though, had to do with development process. As has been discussed previously on LWN, much of the video driver work is done outside of the mainline kernel tree. We are now seeing a big chunk of that work being prepared for a merge. But the new mode setting interface is a big API change which will require adjustments from user space; a new kernel expecting to handle mode setting may not give the best results when run with an older user space X server. So there will be a big flag day of sorts when everything changes and all of the new code gets run for the first time.

Linus is not pleased with the notion of a video graphics flag day; he made a long appeal for a more incremental approach to fixing the video driver work. In his opinion, the flag day will lead to a whole bunch of untested code being made active all at once; there will certainly be design mistakes which show up, and the whole thing will fail to work properly. At which point another flag day will be required. Linus was not impressed by the claim that Fedora users have selflessly been testing this code for everybody; in his view, the kernel developers are not doing this testing. He sees the whole thing as a recipe for disaster.

The real problem - and the reason for the out-of-tree development - is that all of this work requires the creation of a number of new, complex user-space ABIs. That is true for both mode setting and memory management, and the two cannot be easily separated from each other. Until the combination as a whole is seen to work, the video driver developers simply cannot commit themselves to a stable user-space interface - and that means that their code cannot be merged.

As an example, TTM was cited. Had that code been pushed when it looked like the right solution, there would now be even bigger problems to solve.

In summary, the graphics developers believe that the approach they are taking is as incremental as they can make it. Whether they convinced Linus of that fact is unclear, but he eventually seemed to accept the plan. He did ask for them to push the mode setting code upstream first, but that code cannot work without memory management support. So GEM will go into the mainline ahead of kernel-based mode setting. Once everything is in the kernel, it will be possible to boot a system with either kernel-based or user-space mode setting, so both new and old distributions will be supported. Someday, in the distant future, support for mode setting in user space can be removed. Much sooner than that, though, we should all be running much-improved graphics code and will have long since forgotten how things used to be.

Index entries for this article
KernelDevice drivers/Video
KernelTranslation table maps (TTM)
ConferenceLinux Plumbers Conference/2008


(Log in to post comments)

LPC: The future of Linux graphics

Posted Sep 25, 2008 4:39 UTC (Thu) by deater (subscriber, #11746) [Link]

So 10 years after the big flame-war, we're finally going to get a KGI-like layer? I wonder how much better things would have been if Linus had been more reasonable back then.

LPC: The future of Linux graphics

Posted Sep 25, 2008 5:47 UTC (Thu) by elanthis (guest, #6227) [Link]

Hindsight is 20/20. :)

LPC: The future of Linux graphics

Posted Sep 25, 2008 6:17 UTC (Thu) by dlang (guest, #313) [Link]

given that the graphics folks have drasticly changed their mind about what the best solution is within the last year, I doubt if the 10 year old design would have worked well

LPC: The future of Linux graphics

Posted Sep 25, 2008 13:41 UTC (Thu) by deater (subscriber, #11746) [Link]

Well in that case, why won't they change their mind again? If we had started 10 years ago, maybe X11 would be ready by now. Instead we had 10 years of X11 being able to lock up the machine from userspace.

In any case, http://lwn.net/1998/0226/#kernel shows that the issues haven't really changed that much over the years.

LPC: The future of Linux graphics

Posted Sep 25, 2008 15:56 UTC (Thu) by ortalo (guest, #4654) [Link]

Agreed. But well... late better than never?
Hopefully, one day, graphics hardware manufacturer will open up all their specs too.

PS: Wow, it was already 10 years ago that I wrote that CL-GD546x driver!! ;-)

LPC: The future of Linux graphics

Posted Oct 2, 2008 19:59 UTC (Thu) by oak (guest, #2786) [Link]

Oh, KGI brings back memories... I ran a KGI patched kernel for a while in
90's because working with the framebuffer was so much nicer with it (I
just needed to patch it to get "dead keys" working). KGI MGA driver was
superior to what was in kernel and KGI drivers were nicely modularized
unlike the default kernel gfx code at that time. I was really disappointed
that KGI didn't get in, I had gotten used to nice graphical text consoles
with earlier Atari & Amiga and at some uni machines and x86 Linux text
console was a step backwards.

(Or at least that's what I remember from it. :-))

LPC: The future of Linux graphics

Posted Sep 25, 2008 20:33 UTC (Thu) by jsbarnes (guest, #4096) [Link]

IIRC it was me who suggested switching on every printk. :) Also my name is
spelled w/o an 'i': Jesse not Jessie, hope it's not too late to correct the
photo caption.

Corrections made

Posted Sep 25, 2008 20:41 UTC (Thu) by corbet (editor, #1) [Link]

Sigh. Sorry for the screwups, things have been corrected now.

3.0

Posted Sep 27, 2008 18:20 UTC (Sat) by liamh (guest, #4872) [Link]

This seems like a change of sufficient magnitude to merit a major version number increment. "Linux 3.0" would be a good alert to everyone about the major changes and could develop in parallel with the 2.6 series for a while.

LPC: The future of Linux graphics

Posted Oct 2, 2008 19:30 UTC (Thu) by klossner (subscriber, #30046) [Link]

This article covers the technical issues. Jesse's blog entry gives a good feel for the atmosphere at that meeting.


Copyright © 2008, Eklektix, Inc.
This article may be redistributed under the terms of the Creative Commons CC BY-SA 4.0 license
Comments and public postings are copyrighted by their creators.
Linux is a registered trademark of Linus Torvalds