Team LiB
Previous Section Next Section

Hack 100. Accelerate Your Gaming

As Linux use grows, more device manufacturers are creating official Linux drivers; this is particularly true of video card manufacturers. The benefit of having official drivers is that the manufacturer, which has complete access to all the hardware specifications, is able to write a definitive driver that makes the device as usable in Linux as it is in other operating systems. The flip side to this benefit, however, is that some commercial drivers for graphics cards are written as closed source software, and sometimes they incorporate incomplete or unstable features. Some drivers have been particularly reliable, such as those from NVIDIA, but you should browse the Internet to see how reliable other official drivers are. Sometimes a driver's stability changes between versions, but not always for the better. So, your Internet searches might reveal that the best driver is not the most recent one.

This hack shows you how to install the binary drivers provided by the manufacturer for recent-model video cards from ATI and NVIDIA.

11.10.1. Preparing for the Installation

Many official drivers require that specific versions of software be used to build and run the driver. This required software usually includes the kernel, the kernel header files (used to compile the kernel itself), the C compiler (gcc), and X. You need to ensure that all of these requirements are present on your system; a process that can involve installing some of the missing pieces where needed. As many users have never compiled anything before, it is quite common to need to install a copy of gcc.

Before proceeding, you should ensure that your versions of the required programs are compatible with the software requirements for your driver. Virtually every program can report its version number. To find out the version of your kernel, you can run this:

foo@bar:~$ uname -a

To find out the version of your kernel headers, you need to ensure that you have the kernel headers package on your system. To check this on an RPM-based system, run this:

foo@bar:~$ rpm -qa | grep kernel-source

To check the version of the kernel headers on a Debian/APT-based system, run this:

foo@bar:~$ dpkg -l kernel-header*

To find out your version of gcc, run this:

foo@bar:~$ gcc -v

Finally, to find out your version of X, run this:

foo@bar:~$ X -version

Before you begin to install your driver, you should back up your X configuration file, as it might be overwritten when you configure the binary driver. This file is called XF86Config or XF86Config-4 and is usually found in /etc/X11. You should copy the file to a safe place as a backup:

root@bar:~# cp /etc/X11/XF86Config* /root/xconfigbackup/

11.10.2. Installing the NVIDIA Driver

One of the most popular closed source graphics drivers in use is the unified NVIDIA driver. Many people have chosen NVIDIA cards for their impressive performance and driver support, and because the full range of features on the cards are available in the Linux driver. You can download a single unified driver that supports all NVIDIA cards at http://www.nvidia.com/linux.

Once you have downloaded the driver package, you need to make it executable so that you can run it. Type the following commands as root:

foo@bar:~# chmod a+x NVIDIA-Linux-x86-x.x-xxxx-pkg1.run

Before you run a graphics driver installer, you should ensure that you have exited X by logging out, and if you have a graphical login manager, you should shut this down, too. Using GDM as an example, you can do this in Debian with /etc/init.d/gdm stop. In Red Hat you can do the same with service gdm stop.


Then you can run the installer (make sure you are not in X):

foo@bar:~# ./NVIDIA-Linux-x86-x.x-xxxx-pkg1.run

The software compiles a driver on-the-fly and installs it to your system. The next step is to change your X configuration file to use the driver. For XFree86, you need to edit XF86Config or XF86Config-4, and for the Xorg version of X, you need to edit xorg.conf. Both configuration files are located in /etc or /etc/X11, and both use the same syntax.

Inside the file is a Device section, where you should change Driver "nv" to Driver "nvidia". In the Module section, you should add Load "glx" and comment the DRI and Glcore lines.

Now reboot or reload your modules and X to run the driver.

11.10.3. Installing the ATI Driver

ATI has made a number of drivers available for its Radeon range of cards. You install these closed source drivers in much the same way you install the NVIDIA drivers. You can download the drivers from http://www.ati.com/support/driver.html.

The drivers are available as RPM files, and you can install the RPM with this command:

foo@bar:~$ rpm -Uh --force driver.rpm

If you are on a system that does not use RPM as a package type, you can use Alien to convert the package to another type, such as a tarball or Debian package. Once you have opened the package, you can move to the directory that contains the driver and run the main tool that completes the installation for you:

foo@bar:~$ ./fglrxconfig

Within the program, you are asked numerous questions about how you want your video card configured (when in doubt, accept the default). Then you are asked if an XF86Config-4 file should be generated. Select Y to accept this action and the installation is complete. If you are running the Xorg server, you will need to rename this generated file to xorg.conf, and put it in /etc or /etc/X11 on your system. Then you can start X:

foo@bar:~$ startx

Now run the fglrxinfo utility; it should say this:

OpenGL vendor string: ATI Technologies Inc.

If this is the case, the driver installation process is complete.

    Team LiB
    Previous Section Next Section