December 23, 2009

Nouveau: A 2.6.33 Surprise

Article Source Linux Weather Forecast Blog
December 23, 2009, 11:35 am

Linus has released the 2.6.33-rc1 prepatch, closing the merge window for this development cycle. This kernel has a few features which will shake things up, with dynamic tracing being near the top as far as I am concerned. But, perhaps, the most interesting addition is one that almost nobody expected: a reverse-engineered driver for NVIDIA graphics chipsets called “Nouveau.”

Once upon a time, finding hardware which worked with Linux could be a real challenge, especially for certain classes of machines, like laptop computers. We had especially severe problems with 3D graphics as the result of two separate problems: development on the X Window System went into hibernation for many years, and graphics vendors had little interest in helping the community to develop free drivers for their products.

The good news is that those dark days are mostly behind us. We have a reenergized X development team and much more cooperative vendors; Intel, which employs much of that team, can take a large part of the credit for both changes, but the good works go well beyond Intel. At this point, we have free support for most hardware out there - though, it must be said, a good chunk of this code is still a work in progress. We might not have quite reached the end of the tunnel, but the increasing light suggests that we’re getting close.

The big exception to this story is NVIDIA, which still refuses to work with the development community. NVIDIA does provide closed-source drivers, but those are undesirable for all of the usual reasons; this hardware needs to be supported with free software.

The development community is of two minds when it deals with companies like NVIDIA. One approach is to reverse engineer the hardware, figuring out how it works so that a free driver can be written; that is what the Nouveau project has been doing for the last few years. Others, though, say that the best way to deal with uncooperative companies is to simply not buy their products. Why, they ask, should companies support the development community when that community will eventually provide drivers (and buy their hardware) anyway?

The reverse engineering community appears to have come out on top, by virtue of actually having done the work. The Nouveau driver, while not yet being perfect, supports a subset of NVIDIA’s hardware nicely. Some distributors have been shipping it, which leads to the second half of the story.

The kernel community works by a rule which is often expressed as “upstream first.” This rule states that code should be merged into the mainline kernel before it is shipped to customers. Doing so helps to ensure that the best code is in the mainline where all have access to it; it also lets the community resolve any problems with the code before customers become dependent on it. Failure to follow this rule can lead to divergence between kernels and long-term trouble for customers, so the distributors are fairly good about following it.

In the case of Nouveau, though, some distributors have been shipping it for a long time without working to get it upstream. There are a lot of reasons for that, including unstable user-space APIs and uncertainty about some firmware which must be loaded by the driver. But, when 2.6.33 came around, Linus Torvalds decreed that he had waited for long enough. A quick scramble by the Nouveau developers led to a version being put up for merger into the mainline, and Linus took it.

The end result is that the 2.6.33 will have support - at some level - for most of the graphics chipsets available; the biggest remaining problem appears to be the integrated GPUs aimed at handheld systems. Beyond that, experience shows that merger into the mainline will increase the visibility of Nouveau, enlarging the development community and increasing the pace of improvement. This can only be a good thing.

Back in 2006, an NVIDIA manager claimed that “It’s so hard to write a graphics driver that open-sourcing it would not help.” He also said that there was no interest in open-source drivers. The Linux development community, undaunted by that condescending attitude, has proved that it is able to handle the complexity of graphics drivers - which are, after all, only a small piece of the much larger system we have built. Nouveau also shows that there is great interest in free drivers - enough to figure out how to build them the hard way, if that is the only way available.