Gentoo Linux nVidia Guide

1.  Introduction

The nVidia drivers in the tree are released by nVidia and are built against theLinux kernel. They contain a binary blob that does the heavy lifting for talkingto the card. The drivers consist of two parts, a kernel module, and an X11driver. Both parts are included in a single package. Due to the way nVidia hasbeen packaging their drivers, you will need to make some choices before youinstall the drivers.

The nvidia-drivers package contains the latest drivers from nVidia withsupport for all cards, with several versions available depending on howold your card is. It uses an eclass to detect what kind of card you're runningso that it installs the proper version.

2.  Driver compatibility

Which version?

The nvidia-drivers package supports the full range of available nVidiacards. Multiple versions are available for installation, depending on thecard(s) you have.

Newer cards such as the GeForce 400, 300, 200, 100, 9, 8, 7, and 6 series shoulduse the latest drivers.

Older cards such as the GeForce FX 5 series should use the 173.x drivers, suchas nvidia-drivers-173.14.15. For these cards, you should mask>=x11-drivers/nvidia-drivers-174.00 in your/etc/portage/package.mask file. This will prevent newer versions ofthe driver which are incompatible with your card from being installed.

Old cards such as the GeForce 3 or GeForce 4 series require the 96.x drivers.For these cards, you should mask >=x11-drivers/nvidia-drivers-97.00 inyour /etc/portage/package.mask file.

The oldest NV2x-based cards (such as TNT, TNT2, GeForce, and GeForce 2) are nolonger supported by nvidia-drivers. Instead, use an open-source driver:xf86-video-nouveau (recommended) or xf86-video-nv (old,deprecated).

You can check for driver compatibility for your card at to determine whichdriver supports it by viewing the README at its appropriate x86 or x86-64release page.

3.  Configuring your Card

Kernel Configuration

As mentioned above, the nVidia kernel driver installs and runs against yourcurrent kernel. It builds as a module, so it makes sense that your kernel mustsupport the loading of kernel modules. If you used genkernel all toconfigure the kernel for you, then you're all set. If not, double check yourkernel configuration so that this support is enabled:

Code Listing 3.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 3.2: Enabling MTRR

Processor and Features --->
  [*] MTRR (Memory Type Range Register) support

Also, if you have an AGP graphics card, you can optionally enableagpgart support to your kernel, either compiled in or as a module. Ifyou do not use the in-kernel agpgart, then the drivers will use their ownagpgart implementation, called NvAGP. On certain systems, thisperforms better than the in-kernel agpgart, and on others, it performs worse.You will need to evaluate this on your own system to get the best performance.If you are unsure what to do, use the in-kernel agpgart:

Code Listing 3.3: Enabling agpgart

Device Drivers --->
Graphics Support --->
-*- /dev/agpgart (AGP Support) --->

Note: On amd64, the IOMMU controls the agpgart setting.

Arch-specific notes

Important: For x86 and AMD64 processors, the in-kernel driver conflicts with the binarydriver provided by nVidia. If you will be compiling your kernel for these CPUs,you must completely remove support for the in-kernel driver as shown:

Code Listing 3.4: Remove the in-kernel driver

Device Drivers --->
Graphics Support --->
<*> Support for frame buffer devices --->
< >   nVidia Framebuffer Support
< >   nVidia Riva support

A framebuffer alternative is uvesafb, an advancedframebuffer. Note that you can choose to compile it into your kernel, oras a module. The following example compiles uvesafb into the kernel.

Code Listing 3.5: Enable uvesafb support

Device Drivers --->
Graphics Support --->
<*> Support for frame buffer devices --->
<*>   Userspace VESA VGA graphics support

Or you can try VESA:

Code Listing 3.6: Enable VESA support

Device Drivers --->
Graphics Support --->
<*> Support for frame buffer devices --->
[*]   VESA VGA graphics support

For more information, you can look up the documentation for your chosenframebuffer in /usr/src/linux/Documentation/fb/.

Continuing with Kernel Configuration

The nvidia-drivers ebuild automatically discovers your kernel versionbased on the /usr/src/linux symlink. Please ensure that you havethis symlink pointing to the correct sources and that your kernel is correctlyconfigured. Please refer to the "Configuring the Kernel" section of the Installation Handbook for details on configuringyour kernel.

First, you'll need to choose the right kernel source using eselect. Ifyou are using gentoo-sources-2.6.34-r1, your kernel listing might looksomething like this:

Code Listing 3.7: Check your /usr/src/linux symlink

# eselect kernel list
Available kernel symlink targets:
  [1]   linux-2.6.34-gentoo-r1 *
  [2]   linux-2.6.33-gentoo-r2
  [3]   linux-2.6.32.9
(Verify that the right kernel is marked with an asterisk

In the above output, you'll notice that the linux-2.6.34-gentoo-r1 kernelis marked with an asterisk (*) to show that it is the symlinked kernel.

If the symlink is not pointing to the correct sources, you must update the linkby selecting the number of your desired kernel sources, as in the exampleabove.

Code Listing 3.8: Create/Update /usr/src/linux symlink

(Select the correct kernel)
# eselect kernel set 1

Installing the Appropriate Drivers

Now it's time to install the drivers. You can do this by first following theX Server Configuration HOWTO andsetting VIDEO_CARDS="nvidia" in /etc/make.conf. When youinstall the X server, it will then install the right version ofnvidia-drivers for you.

Note: The drivers can be installed with the gtk USE flag set in/etc/make.conf. This will installmedia-video/nvidia-settings, a handy graphical tool for monitoring andconfiguring several aspects of your nVidia card.

Important: Every time you compile a new kernelor recompile the current one, you will need to reinstall the nVidia kernelmodules. An easy way to keep track of modules installed by ebuilds (such asnvidia-drivers) is to install sys-kernel/module-rebuild. Onceyou've installed it, simply run module-rebuild populate to populate itsdatabase with a list of packages to be rebuilt. Once you've finished compilingor recompiling a kernel, just run module-rebuild rebuild to rebuild thedrivers for your new kernel.

Once the installation has finished, run modprobe nvidia to load thekernel module into memory. If this is an upgrade, you should remove theprevious module first.

Code Listing 3.9: Loading the kernel module

# lsmod | grep nvidia && rmmod nvidia
# modprobe nvidia

To prevent you having to manually load the module on every bootup, you probablywant to have this done automatically each time you boot your system, so edit/etc/conf.d/modules and add nvidia to it.

Important: If you compiled agpgart as a module, you will need to add it to/etc/conf.d/modules as well.

Configuring the X Server

Once the appropriate drivers are installed you need to configure your X Serverto use the nvidia driver instead of the default nv driver.

Open /etc/X11/xorg.conf with your favorite editor (such asnano or vim) and go to the Device section. In thatsection, change the Driver line:

Code Listing 3.10: Changing nv to nvidia in the X Server configuration

Section "Device"
  Identifier "nVidia Inc. GeForce2"
  Driver     "nvidia"
  VideoRam   65536
EndSection

Then go to the Module section and make sure the glx module getsloaded while the dri module doesn't:

Code Listing 3.11: Updating the Module section

Section "Module"
  (...)
  # Load  "dri"
  Load  "glx"
  (...)
EndSection

Next, in section Screen, make sure that either the DefaultDepthdirective is set to 16 or 24, or that you only have Display subsectionswith Depth settings of 16 or 24. Without it, the nVidia GLX extensionswill not start.

Code Listing 3.12: Updating the Screen section

Section "Screen"
  (...)
  DefaultDepth 16
  Subsection "Display"
  (...)
EndSection

Run eselect so that the X Server uses the nVidia GLX libraries:

Code Listing 3.13: Running eselect

# eselect opengl set nvidia

Adding your Users to the video Group

You have to add your user to the video group so he has access to thenVidia device files:

Code Listing 3.14: Adding your user to the video group

# gpasswd -a youruser video

This might not be totally necessary if you aren't using udev but itdoesn't hurt either and makes your system future-proof.

Testing your Card

To test your nVidia card, fire up X and run glxinfo, which is part of themesa-progs package. It should say that direct rendering is activated:

Code Listing 3.15: Checking the direct rendering status

$ glxinfo | grep direct
direct rendering: Yes

To monitor your FPS, run glxgears.

Enabling nvidia Support

Some tools, such as mplayer and xine-lib, use a local USE flagcalled xvmc which enables XvMCNVIDIA support, useful when watching highresolution movies. Add in xvmc in your USE variable in/etc/make.conf or add it as USE flag to media-video/mplayerand/or media-libs/xine-lib in /etc/portage/package.use.

There are also some applications that use the nvidia USE flag, so youmay want to add it to /etc/make.conf.

Then, run emerge -uD --newuse world to rebuild the applications thatbenefit from the USE flag change.

Using NVidia Settings Tool

nVidia also provides you with a settings tool. This tool allows you to monitorand change graphical settings without restarting the X server and is availablethrough Portage as media-video/nvidia-settings. As mentioned earlier, itwill be pulled in automatically if you install the drivers with the gtkUSE flag set in /etc/make.conf or in/etc/portage/package.use.

4.  Troubleshooting

Getting 2D to work on machines with 4Gb or more memory

If you are having troubles with the nVidia 2D acceleration it is likely thatyou are unable to set up a write-combining range with MTRR. To verify, checkthe contents of /proc/mtrr:

Code Listing 4.1: Checking if you have write-combining enabled

# cat /proc/mtrr

Every line should contain "write-back" or "write-combining". If you see a linewith "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 "CPUSettings"). Change the setting from "continuous" to "discrete" and boot backinto Linux. You will now find out that there is no "uncachable" entry anymoreand 2D acceleration now works without any glitches.

When I attempt to load the kernel module I receive a "no such device"

This usually occurs when you don't have a matching video card. Make sure thatyou have an nVidia-powered graphical card (you can double-check this usinglspci).

If you are confident that you have an nVidia card, check your BIOS and see ifthe directive Assign IRQ to VGA is set.

5.  Expert Configuration

Documentation

The nVidia driver package also comes with comprehensive documentation. This isinstalled into /usr/share/doc and can be viewed with the followingcommand:

Code Listing 5.1: Viewing the NVIDIA documentation

$ less /usr/share/doc/nvidia-drivers-*/README.gz

Kernel module parameters

The nvidia kernel module accepts a number of parameters (options) whichyou can use to tweak the behaviour of the driver. Most of these are mentioned inthe documentation. To add or change the values of these parameters, edit thefile /etc/modprobe.d/nvidia.conf. Remember to run update-modules aftermodifying this file, and bear in mind that you will need to reload thenvidia module before the new settings take effect.

Code Listing 5.2: Adjusting nvidia options

(Edit /etc/modprobe.d/nvidia.conf in your favourite editor)
# nano -w /etc/modprobe.d/nvidia.conf
(Update module information)
# update-modules
(Unload the nvidia module...)
# modprobe -r nvidia
(...and load it once again)
# modprobe nvidia

Advanced X configuration

The GLX layer also has a plethora of options which can be configured. Thesecontrol the configuration of TV out, dual displays, monitor frequency detection,etc. Again, all of the available options are detailed in the documentation.

If you wish to use any of these options, you need to list them in the relevantDevice section of your X config file (usually /etc/X11/xorg.conf). Forexample, suppose I wanted to disable the splash logo:

Code Listing 5.3: Advanced nvidia configuration in the X configuration

Section "Device"
  Identifier "nVidia Inc. GeForce2"
  Driver     "nvidia"
  Option     "NoLogo" "true"
  VideoRam   65536
EndSection

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值