11 February 2012

Graphics cards on Ubuntu

Problem

My configuration: Lenovo T410, Ubuntu 11.10, Nvidia GT218.

OpenGL does not seem supported by default. Running nvidia-settings in a console says You do not appear to be using the NVIDIA X driver. Please edit your X configuration file (just run `nvidia-xconfig` as root), and restart the X server..

After following these steps, the environment does not show up anymore when rebooted - only a console-like frozen screen. An actual command-line console can be found using ctrl+alt+F1 to ctrl+alt+F6. Ctrl+alt+F7 goes back to the console-like frozen screen. The screen is frozen most likely because the x server did not start.

It turns out the actual problem is the hybrid graphic card configuration. Hybrid cards configurations for laptops have 2 cards: one for performance (e.g. Nvidia GT218), and one for battery life (usually integrated graphics, e.g. from Intel). The switching is supposed to be done automatically by Nvidia's Optimus software. But Ubuntu 11.10 does not support, by default, the switching between integrated graphics and Nvidia graphics.

Quick fix: to discard permanently the integrated graphics, in the BiOS (F1 at computer startup), pick Config > Graphics > Discrete. Problem: heavier battery consumption, and Windows, which is has no problem using Optimus, will now be forced to use only Nvidia. Not good.

Fixing the problem: Bumblebee

Bumblebee is a solution for Optimus on Ubuntu, and they have a tutorial to set it up. But in case it one day disappears, here are the steps.

1) Check hybrid config and support

Determine graphics card(s): lspci | grep VGA

00:02.0 VGA compatible controller: Intel Corporation Core Processor Integrated Graphics Controller (rev 02)
01:00.0 VGA compatible controller: nVidia Corporation GT218 [NVS 3100M] (rev ff)

So there's an Intel integrated card and an Nvidia GT218 card: that's a hybrid configuration. Check Nouveau's supported cards to see if the opensource driver supports your card. If it does not, maybe the proprietary Nvidia driver supports it?
Anyway, the next step is to check that the Nvidia card is not doing its part; run glxspheres. This outputs:

Polygons in scene: 62464
Visual ID of window: 0x97
Context is Direct
OpenGL Renderer: Mesa DRI Intel(R) Ironlake Mobile
21.494593 frames/sec - 23.987966 Mpixels/sec

21 frames/sec is quite lame, so Nvidia is most likely not picked.

2) Installing Bumblebee 3.0 (as of February 2012)

sudo add-apt-repository ppa:bumblebee/stable
sudo apt-get update
sudo apt-get install bumblebee bumblebee-nvidia
sudo usermod -a -G bumblebee $USER
sudo reboot

3) Testing

Any program to be run with the Nvidia card should be prefixed by optirun; for instance, optirun glxspheres outputs:

Polygons in scene: 62464
Visual ID of window: 0x21
Context is Direct
OpenGL Renderer: NVS 3100M/PCI/SSE2
101.341234 frames/sec - 113.096817 Mpixels/sec

Although it takes a tiny bit of delay for the program to start, it's much better than the 21 fps of earlier. Running optirun -c yuv glxspheres shows even better performance (145 FPS). But the CPU consumption remains high: Bumblebee only has the Nvidia card compute 60 frames per sec and send those frames to the Intel card anyway.

References

No comments:

Post a Comment

Note: Only a member of this blog may post a comment.