Gentoo Linux nVidia Guide
1. Configuring your Card
Installing the Appropriate Drivers
The nVidia drivers include kernel modules that must integrate in your current
kernel. To accomplish this, your kernel must support the loading of kernel
modules. If you used genkernel to configure the kernel for you then
you're all set. If not, double check your kernel configuration so that this
support is enabled:
Code Listing 1.1: Enabling the Loading of Kernel Modules
Loadable module support --->
[*] Enable loadable module support
You also need to enable Memory Type Range Register in your kernel:
Code Listing 1.2: Enabling MTRR
Processor and Features --->
[*] MTRR (Memory Type Range Register) support
nVidia's modules and libraries are combined in two packages: nvidia-glx
and nvidia-kernel. The former are the X11 GLX libraries while the latter
are the kernel modules. Since nvidia-glx depends on nvidia-kernel,
installing nvidia-glx is sufficient:
Code Listing 1.3: Installing the nVidia modules
# emerge nvidia-glx
Once the installation has finished, run modprobe nvidia to load the
kernel module into memory.
Code Listing 1.4: Loading the kernel module
# modprobe nvidia
You probably want to have this done each time you boot your system, so edit
/etc/modules.autoload.d/kernel-2.6 (or kernel-2.4) and
add nvidia to it. Don't forget to run modules-update afterwards!
Code Listing 1.5: Running modules-update
Configuring the X Server
Once the appropriate drivers are installed you need to configure your X Server
(XFree86 or Xorg) to use the nvidia driver instead of the default
Open /etc/X11/XF86Config (or /etc/X11/xorg.conf) with
your favorite editor (such as nano or vim) and go to the
Device section. In that section, change the Driver line:
Code Listing 1.6: Changing nv to nvidia in the X Server configuration
Identifier "nVidia Inc. GeForce2"
Then go to the Module section and make sure the glx module gets
loaded while the dri module doesn't:
Code Listing 1.7: Updating the Module section
# Load "dri"
Run opengl-update so that the X Server uses the nVidia GLX libraries:
Code Listing 1.8: Running opengl-update
# opengl-update nvidia
Testing your Card
To test your nVidia card, fire up X and run the glxinfo | grep direct
command. It should say that direct rendering is activated:
Code Listing 1.9: Checking the direct rendering status
$ glxinfo | grep direct
direct rendering: Yes
To monitor your FPS, run glxgears.
Getting 2D to work on machines with 4Gb or more memory
If you are having troubles with the nVidia 2D acceleration it is likely that you
are unable to set up a write-combining range with MTRR. To verify, check the
contents of /proc/mtrr:
Code Listing 2.1: Checking if you have write-combining enabled
# cat /proc/mtrr
Every line should contain "write-back" or "write-combining". If you see a line
with "uncachable" in it you will need to change a BIOS setting to fix this.
Reboot and enter the BIOS, then find the MTRR settings (probably under "CPU
Settings"). Change the setting from "continuous" to "discrete" and boot back
into Linux. You will now find out that there is no "uncachable" entry anymore
and 2D acceleration now works without any glitches.
I receive warnings about unsupported 4K stack sizes
nvidia-kernel packages older than 1.0.6106 only support kernels using
an 8K stack size. More recent kernels (2.6.6 and higher) have support for 4K
stack size's as well. Do not select 4K stack size in your kernel
configuration if you are using such an nvidia-kernelpackage. You can
find this option in the section Kernel Hacking.
The contents of this document are licensed under the Creative Commons - Attribution / Share Alike license.