Just moozing

Before you can check your notes, you must make them…

3D acceleration (or how intel failed and nvidia worked)

leave a comment »

Once, when I thought I had time to play with CUDA, I bought an Nvidia graphics card. I never did make it work, and never did find time to use CUDA. Now I want to do FreeCad, and it requires more 3D that x.org’s software emulation on the build-in graphics card.

I have been booting my disk less desktop PC for a long time now, and it has mainly been used for planet rock and wesnoth. It also holds a better graphics card than my laptop, so I found it natural to test 3D stuff on it.

The graphics cards

3D acceleration in x.org is about direct rendering aka. DRI. If it is turned on, it will move a lot of processing from the CPU to the GPU.

To check if DRI is enable do

glxinfo | grep DRI


glxinfo | grep rendering

On my laptop, I get

$ glxinfo  | grep DRI
OpenGL renderer string: Mesa DRI Intel(R) 945GME x86/MMX/SSE2
$ glxinfo | grep rendering
direct rendering: Yes

As a pointer for the efficiency of 3D stuff I run glxgears. On the laptop I get around 60 fps and almost no CPU usage. To people used to look at glxgears values, it is ridiculously low and, yes, it is a cheap non-gamer laptop.

The graphics cards

The desktop is an old Fujitsu Siemens desktop PC with most stuff build in. It works nicely with PXE booting and 2gb of RAM.  The graphics hardware:

$ lspci | grep VGA
00:02.0 VGA compatible controller: Intel Corporation 82845G/GL[Brookdale-G]/GE Chipset Integrated Graphics Device (rev 01)
03:00.0 VGA compatible controller: nVidia Corporation G98 [GeForce 8400 GS] (rev a1)

So I have an old intel card, and a “small” GeForce card. I actually bough that specific nvidia card because I could find it as a PCI card, as opposed to AGP or PCI-E.

Intel graphics card fun

As part of my effort, I updated Debian to squeeze/testings and starting having issues with X.org. In Xorg.0.log, I started getting stuff like this

(EE) intel(0): Detected a hung GPU, disabling acceleration.

and x that kept on crashing after a couple of minutes. After some googling, I found this link and concluded that my graphics card is old, and DRI should be disabled. After creating the xorg.xonf file as suggested in entry #2 in the forum post, it is stable. I could now go back to planet rock and wesnoth 🙂

Just for comparison, I tried glxgears

$ glxgears
Xlib:  extension "GLX" missing on display ":0.0".
Error: couldn't get an RGB, Double-buffered visual

So all stuff 3D is out on this card.

# cat /var/log/Xorg.0.log|grep glx
[ 14749.369] (II) LoadModule: "glx"
[ 14749.369] (II) Loading /usr/lib/xorg/modules/linux/libglx.so
[ 14749.452] (II) Module glx: vendor="NVIDIA Corporation"

The glx driver that I installed to get nvidia running, is not compatible with my old intel card. I guess that is ok.

Just for the record, old glxgears timing values before I upgraded to squeeze/testing, said 140 fps and 100% CPU processor load.

Nvidia graphics card (more) fun

I followed the “official” Debian guide from the wiki and went with the DKMS (it is a Dell thing, I didn’t know that) way of doing it. DKMS is the thing to use with virtualbox, when you want easy update of drivers when you update the kernel.

apt-get install nvidia-kernel-dkms</pre>

This requires amongst others the packages build-essential and module-assistant. Use it, is is simple and it is described in the wiki mentioned above.

I had a lot of issues with the xorg.conf. gdm3 does some odd stuff with gsm-simple-slave when you have errors in xorg.conf. Check the logs, both Xog.0.log and /var/log/gdm/* and you get good pointers.

In order to use both the DVI and the VGA output on the card, use Twinview. That way both monitors are connected to the nvidia card – it is apparently the recommended way.

Glxgears shows 2200 fps (!) and 100% processing power. The “glxinfo | grep DRI” is not working for nvidia, but “glxinfo | grep rendering” tell that direct rendering is enabled. I find it odd with the 100% CPU usage, but we’ll stop here for now.

Bonus information: look at the packages nvidia-xconfig and nvidia-settings for xorg.conf configurators.

Final configuration

The xorg.conf ended up like this.

# nvidia-xconfig: X configuration file generated by nvidia-xconfig
# nvidia-xconfig:  version 295.20  (buildd@murphy)  Wed Feb 15 23:13:56 UTC 2012

Section "ServerLayout"
    Identifier     "Default Layout"
    Screen         "nvidia screen" 0 0
    #    Screen         "intel screen" 0 0
    InputDevice    "Keyboard0" "CoreKeyboard"
    InputDevice    "Mouse0" "CorePointer"

Section "InputDevice"
    # generated from default
    Identifier     "Keyboard0"
    Driver         "keyboard"

Section "InputDevice"
# generated from default
    Identifier     "Mouse0"
    Driver         "mouse"
    Option         "Protocol" "auto"
    Option         "Device" "/dev/psaux"
    Option         "Emulate3Buttons" "no"
    Option         "ZAxisMapping" "4 5"

Section "Device"
    Identifier     "NVidia Geforce 8400"
    Driver         "nvidia"
    BusID       "PCI:3:0:0"

Section "Screen"
    Identifier     "nvidia Screen"
    Option "TwinView " "on"
    Option "TwinViewOrientation" "RightOf"
    Device         "NVidia Geforce 8400"
    SubSection     "Display"
        Modes      "nvidia-auto-select"

Section "Device"
    Identifier     "Intel buildin"
    Driver         "intel"
    Option "DRI" "false"
    BusId       "PCI:0:2:0"

Section "Screen"
    Identifier     "intel screen"
    Device         "Intel buildin"

If I want to use the intel card again at some point, it will include a second “ServerLayout” entry and starting it on DISPLAY=:1. I am not sure how to do it, but I think that I did it once so I must the notes somewhere 🙂


Written by moozing

April 2, 2012 at 09:00

Posted in Tech

Tagged with , ,

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s

%d bloggers like this: