3D on the Linux desktop: a peek into the near future
By now, most of you know that Mac OS X includes advanced visual effects, powered by Display PostScript and accelerated 3D hardware. Contrary to most people's opinions, those effects do help in making the Mac user interface more aesthetically pleasing and usable. And Windows Vista is also including a variety of new visual effects in its user interface.
So, where do we stand in relation to our competition?
The two big efforts towards OpenGL on our open source desktops.
Indeed, the title of this article is misleading. I'm implying that 3D will be available on the Linux desktop. Nothing could be further from the truth. 3D acceleration is avaiable today. And 3D on the desktop will be available very soon, but not necessarily thanks to the magic of Linux (which, by the way, already does a lot in terms of providing a solid foundation of robustness and stability, thank you very much.).
3D on Linux will come thanks to the efforts behind the X Window System, namely the X.org variant.
As always, open source and free software produce different results, which end up competing on their unique technical merits and differentiators. 3D on the X Window System is no exception. Today, we have two competing efforts, and already one of them has taken advantage of the other's efforts (albeit in a minor way).
(Word to the wise: these efforts share common ground in the early work of Keith Packard and the X Window System, which was deemed "interesting but too primitive to consider for actual inclusion on production releases". So, don't be surprised if I only deal with the more mature efforts in this article.)
Xgl: the first effort, backed by Novell
Novell has several outstanding hackers working for them. And a select team, working nearly in skunkworks fashion, has finished what appears to be the first mature effort to bring 3D graphics to run-of-the-mill desktop computing everywhere. Xgl is the name of the effort.
Xgl has some outstanding merits. I won't bore you with the technical details, because:
- they are already on the Xgl Web page, linked from this article
- the technical details are far outstripped by the amazing videos available from Novell's Xgl page
Suffice it to say that Xgl incorporates a "composite manager" called compiz
. This composite manager is in charge of actually telling the server how to compose the image, based on the applications' rendered output. To the X server (which, as far as I know, runs as a client of the master X server), the application windows are textures. The composite manager has the ability to transform those textures through OpenGL commands. Thus, amazing (and nearly limitless in breadth and depth) visual effects are possible:
- Wobbly windows
- A desktop that responds entirely like a physical abstraction, with gravity, natural edge resistance, bumpiness, and more
- Natural and artifact-free shadows
- True (partly and fully) transparent windows
- Windows rendered as textures on a cube, sphere or any other curve-based surface
The two main criticisms against Xgl are, nonetheless, issues which are still to be worked out:
- Certain (important) community contributors are disgusted (to say the least) at the fact that Novell worked on this practically solo, without the constant back-and-forth code sharing and open communication which is taken for granted on every open source project. Novell "just pushed a product when it was nearly done".
- The architecture of Xgl is cumbersome to deploy and manage. Well, that might be a bit of an overstatement on my part. But it certainly adds complexity to the whole desktop.
Undaunted by the criticism, Novell plans to ship this on their next Linux releases.
AIGLX: the second effort, backed by the Fedora Project
I'm taking a snippet of text from the Fedora Project wiki to explain what AIGLX is about:
AIGLX is a project that aims to enable GL-accelerated effects on a standard desktop. We have a lightly modified X server (that includes a couple of extensions), an updated Mesa package that adds some new protocol support and a version of metacity with a composite manager. The end result is that you can use GL effects on your desktop with very few changes, the ability to turn it on and off at will, and you don't have to replace your X server in the process.
The Fedora Project people have gone to great lengths to show that they've "played nice with the community". I suspect this is deliberate — in order to pinpoint at the "flaws" of their "competitor", they've chosen to make the second paragraph on their AIGLX front page about this very discussion subject.
So, knowing that both projects aim to get 3D on Linux desktops, the best way to show what AIGLX is would be to compare it against Xgl:
- An updated Mesa library which allows for indirect rendering (in accelerated fashion). For those of you who don't know what Mesa is: it's a library which implements OpenGL non-accelerated rendering for cards that don't support 3D, and accelerated rendering for cards that do 3D just fine.
- An updated Metacity (the GNOME window manager) with a composite manager embedded. This composite manager will be enabled and disabled via a configuration key.
- An updated X server.
Basically, they've chosen to go the "revamp the stack" route. This means no modifications in the way components interact with each other, and no extra components. I did read a few hours ago that writing a composite manager into an existing window manager would be much easier than doing it the other way around. Were this true (I have no way of knowing, never having written a single line of window manager code), the Fedora guys would have a huge head start.
My take on the subject
I personally feel that the Fedora way is better. My limited knowledge of the matter still lets me see that extending the current software stack instead of having to rearrange the way components interact, is a far more workable solution over the long term. Sure, I'm well aware that some features may not be possible at all with the Fedora's AIGLX arrangement. Rendering on spheres and other curve-based surfaces spring to mind (but I'm sure I'll be corrected by a member of the community if I'm mistaken, that's the beauty of open source).
The other big issue comes down to hardware support. The Fedora project seem not to have support for the open source nv
driver for NVIDIA cards (though they say the next major release of the closed source driver will work just fine later on). That rules out a whole swath of cards that are out there and ready to be used. The Novell team boasts full accelerated functionality with most major graphic cards.
Conclusions
When there's an effort, there's usually criticism. I'd like to rescue a key point here, which seems to have been lost among the petty bickering and discussion. These two projects, however "incompatible" they may be (and, to a certain extent, are fully compatible) are great strides, setting the pace for the future (and mythical) Linux desktop. They've already shared, and continue to share code. It's just a matter of "seeing where the pieces fall", Tetris-style, on the base X.org distribution. I hope politics doesn't spoil the natural evolution of events. No, let me correct myself: actually, I'm pretty confident that won't happen. But it's important to recognize that these new pieces need to be pushed upstream, to X.org.
Remember that both efforts will be rolled out by major Linux distributions sometime later this year. Rest assured that they won't arrive at your desktop exactly as you see them in their technology showcases. You'll see much more refined work. You'll be able to control whether you want the effects active or not. But you'll definitely see increased desktop rendering performance, thanks to the 3D acceleration hardware present on all modern video cards.
Bottom line, the X Window System was in dire need of evolution. These efforts have shown that it is possible to evolve. And this evolution couldn't possibly have come at a better time.
So, where do we stand relative to our competitors? I'd say fairly well. These are exciting times to be involved in these efforts. Go Linux! Go open source! Go Free Software!