benchmarking XRender performance, how to file nvidia bugs

Blauzahl asks where to file
bugs we encounter in the nvidia drivers. Last night, after my
previous blogentry
Fredrik told me he disagreed that it’s hard to find nvidia engineers
that can help with this kind of performance problems. It seems some hang out in
#xorg-devel, and our planet admin Chris Lee is currently working on the NVidia
Linux team as well. Fredrik pointed me to a benchmark that measures the performance
of various XRender calls. Running it shows that most of the tests are
very fast (1 – 20 milliseconds) or very slow (most between 8 and 16 seconds).
That means lots of operations take 400 times as long as others. On my notebook’s
ati x1300 using the fglrx driver, I get results of 20 milliseconds for the ‘faster’
operations. Not a single test takes more than 2.5 seconds. So nvidia is faster
, but only for some tests. Overall, ATI performs better in these tests. And then
maybe those operations can be accelerated in the driver. xrenderbenchmark
takes ~13 minutes on my nvidia 7600GS
and 1:45 on my ati x1300, a fairly low-end laptop chip. In order to compile
xrenderbenchmark, first “qmake xrenderbenchmark.pro” (make sure you use Qt4’s
qmake). Then run make, and xrenderbenchmark.

So if you encounter those performance problems,
get Zack’s
benchmark
and provide the data to the nvidia developers. The problems should
be filed as a bug on the product xorg, component “Driver/nVidia (proprietary)” on bugs.freedesktop.org. I’ve
filed the performance issues here,
along with some my logfiles.

Update: I’m not the first finding out about this.
Nice pictures showing the performance
problems and lots of reports on the
Phoronix forums. All
reporting abominable 2d performance with NVidia graphics cards and drivers.

How NVidia impedes Free Desktop adoption.

There has been quite some discussion about Free and closed drivers and documentation
of hardware lately. Kernel
developers demand
open drivers, docs and development
processes, NVidia refuses to open
their drivers, arguing that the technical quality
is not a problem, and that the driver contains intellectual property they wish
to protect. Now ATI/AMD has shown that the intellectual property argument is at least not
universally applicable to graphics hardware vendors. Let’s also clear up a misconception about
the technical quality of nvidia.ko: The NVidia driver is the single component in a KDE4 /
Free Operating system stack causing us most of the hard-to-solve problems. In other
words, nvidia.ko has grave technical shortcomings.

The most considerate article in my opinion is James Bottomley’s essay on
“Linux Graphics, an essay about
three drivers”
. James puts NVidia’s position into the context of Free Software developers
and Linux kernel developers more specifically. I’d like to reiterate some of his points and
provide additional insight into how this looks like from the point of view of a KDE developer.
With NVidia just confirming that they won’t open up their process, this sadly appears necessary.
Let me start with some problems of NVidia’s closed driver model:

  • With an unclear licensing situation of those blobs, most distributors don’t dare
    shipping nvidia.ko in their default install, spoiling the out of the box user experience
    that Linux is able to deliver otherwise.
  • Performance and stability problems as we see them with KDE4 (and apparently
    Cairo-based rendering as well) spoil the user experience even more (see below).
  • Triaging bugs caused by those issues is hard to do and takes a lot of our precious time.
    Even worse, NVidia doesn’t seem to have the process in place to listen to those reports.
    nvforums seems to be the only way to reach NVidia people, it’s hard to tell where to go
    with specific questions or technical issues. As a result, interchange between Free Software
    people and NVidia engineers leaves much to be desired
  • Users suffering from those problems will likely just blame Linux and try to not burn
    their fingers on Free Desktop systems anymore, let alone recommend it to others.
  • Not being able to help users with their problems caused by nvidia.ko is very
    frustrating, both for users who end up with a screwed system and developers not being able to
    help those users and still getting all the bad press.

Let’s not forget to pin down at least some of the technical problems as detailed as possible.
Two of the most annoying problems I am myself able to reproduce:

  • Temporary screen
    lockups
    . Suffering from this myself, I’ve done some research on the web. There were
    suggestions around that NVidia locks the system for some seconds when switching between
    powerstates. Disabling powermanagement through a kernel module parameter should have done the
    trick, it didn’t do it here. Besides that, I would not feel comfortable with that, having a
    passively cooled video card and at least trying to not burn too much energy these days. Global
    climate change and local one (it’s already quite hot in this room) getting in the way.
  • Bad windows resizing performance.
    Resizing a transparent konsole window takes approximately 5 seconds here. It’s slightly better
    with a non-transparent mode (and other applications), but still far worse than on my ATI card,
    and also far worse than in KDE3. Switching virtual desktops here (composited or not) takes
    some seconds, just enough to break my flow of working.

(I’ve run into those problems with various different kernels, tried Ubuntu’s last couple of
release, same problems on OpenSuse). Currently, I’m now using the 177.13 driver, but I had the same
problems with older versions as well. According to some, a lot of those problems have
to do with the fact that NVidia drivers do not make use of the existing infrastructure in X
(XRender, XAA, EXA) and Qt uses those quite heavily, if available (Qt4 much more than Qt3
apparently). Now imagine someone wanted to merge a driver upstream which works around those
acceleration infrastructures. No way upstream developers accept it, and rightfully so. Why?
Well, check out the above list of problems. The conclusion here would be that NVidia not only doesn’t
play by the rule of the game regarding licenses (it’s still highly doubtful if nvidia.ko
has legal problems), or by the development process (no docs, no sources), they also just
write technically bad code (lacking support for those acceleration techniques, kernel oops
statistics from James’ essay).

Reading comments of users over the Internet, there seem to be two patterns in the responses:

  • My system works, so I don’t understand those complaining about their Freedom. It’s
    more important that it works than that it’s free.
  • It doesn’t work, Linux sucks, I’ll stick with Windows.

Both reactions show the problem from a very individual point of view — which is fair enough.
However, both opinions do not take into account the problems we, as Free Desktop developers
run into. We have to waste a lot of time and end up frustrated because we’re not able to
support our product as good as we would like to.

I can only guess about the reasons behind NVidia still being bone-headed as they are and
not moving a bit. James brings up that they simply do not have the resources to support their
product properly in a Free Software ecosystem. That seems the most logical explanation to me.
Now resources in a company like NVidia have a lot to do with priorities, in turn, those
priorities are often
a function of market share. In this light, we end up with a self-fulfilling prophecy. Market
share is kept low by Nvidia’s poor support for the Free Desktop, which in turn makes them
keep resources low for supporting those systems.

So how can we solve this problem of not being able to support our users properly? There are
in fact a number of ways:

  • NVidia’s engineers could be more approachable to us.
  • Nvidia’s engineers could pay more attention to the world outside their forums and
    actively engage with relevant developers to solve problems
  • We could recommend hardware from other vendors. Less nvidia cards around make for
    a smaller group of people running into those problems. Voting with your purse makes yourself
    a happier user and might, maybe, in the far-away future have people over at Nvidia read the
    writing on the wall.

As a Free Software developer, user and advocate, I feel screwed by NVidia, and as a customer,
even more so. I would recommend not buying NVidia hardware at this point. For both political
reasons, and for practical ones: Pretty much all other graphics cards around there work better
with KDE4 than those requiring nvidia.ko.