Tuesday, 24 May 2005

Configuring Linux to use NVIDIA graphics card

My new machine contains an NVIDIA GeForce2 MX/MX 400 graphics card with 64MB RAM. I had installed Fedora core 2 on my machine and even though it had detected the graphics card right, was using a generic driver - the result being choppy graphics especially when running software making use of OpenGL libraries. I visited the NVIDA website and found that Nvida does support Linux platform actively. In fact, there was a latest version of the driver for GeForce2 MX/MX 400 card available for download. I selected the type of graphics card and the platform from its website and started the download. There was only one file called NVIDIA-Linux-x86-1.0-7174-pkg1.run to download which was around 9 MB size.
After downloading the file, I logged in as 'root' and started the installation as follows:
# sh NVIDIA-Linux-x86-1.0-7174-pkg1.run
IMPORTANT: Do not run the above command while in the GUI mode - ie while running X. Always run it while in run level 3 - ie: text console only mode. For starting Linux in console mode, modify a single line in the file /etc/inittab from:
id:5:initdefault:
to
id:3:initdefault:
And then reboot your machine. There is an easier way though; which is to fire up a terminal and as root, enter the command:
# init 3
to log in to runlevel 3 or console mode.
Coming back to our topic, the .run file is a self-extracting archive. When the NVIDIA-Linux-x86-1.0-7174-pkg1.run file is executed, it extracts the contents of the archive, and runs the contained `nvidia-installer` utility, which will walk you through installation of the NVIDIA driver.Once the installation starts, the installer will first check if it has a precompiled kernel interface for the kernel you are using. I have a 2.6 kernel which obviously had a precompiled kernel interface and so the installation went smoothly. But if it is otherwise, then the installer will check if there is one on the NVIDIA ftp site - provided you are connected to the Internet - and download it. If no matching precompiled kernel interface is found, the installer will compile the kernel interface for your machine.
NOTE: Foreseeing the latter eventuality, It is advisable to install the kernel source on your machine before starting the driver installation.
Once the installation is completed, the next step is to change the settings in the configuration file /etc/X11/xorg.conf of the X.org server to point to the nvidia driver. Below I have shown relevant section of my /etc/X11/xorg.conf file.
#File: /etc/X11/xorg.conf
...
Section "Module"
...
Load "glx"
# Load "dri" ---- Comment out this line
# Load "GLcore" ---- Comment out this line
...
EndSection
...
# portions cut for brevity
...
Section "Device"
Identifier "Videocard0"
Driver "nvidia"
# Driver "nv" ---- Comment out this line
VendorName "Videocard vendor"
BoardName "NVIDIA GeForce 2 MX (generic)"
EndSection
...
As seen above, I have shown those parts that needs to be changed for X to start using the nvidia drivers. First in the Module section comment out the lines Load "dri" and Load "GLcore" and make sure you have the line Load "glx". Next move to the Device section and comment out the line Driver "nv" (or Driver "vesa" ) and in its place insert the line Driver "nvidia" . This asks the X server to use nvidia drivers instead of nv or vesa drivers.
After making these changes, save and exit the /etc/X11/xorg.conf file. Now we can start the X server which will start using the newly installed nvidia drivers and make full use of the graphics card.
Note: If you have changed the runlevel to 3 by editing the /etc/inittab file as explained above, now is the right time to change it back to the original value. To move to runlevel 5 from the console, just type the following at the command prompt by logging in as root.
# init 5
Epilogue
Once I restarted X using the newly installed nvidia driver, my system saw huge performance gains. I tried playing ChromiumBSU game and it ran very smoothly at around 50 fps. And most of the games using OpenGL like TuxRacer and Tuxkart started running as smooth as silk.Of course, games are not the only ones relying on a graphics card. There are a lot of programs (3ddesktop comes to my mind here) which rely on OpenGL which in turn requires a graphics card to harness its real power.

No comments:

Post a Comment