Tuesday, August 01, 2006

nVidia drivers

Reference http://www.gentoo.org/doc/en/nvidia-guide.xml
  • Make sure the kernel is configured correctly for the proprietary nVidia driver
    • genkernel --menuconfig all
    • Confirm: Loadable module support -> [*] Enable loadable module support
    • Confirm: Processor type and features -> [*] MTRR (Memory Type Range Register) support
    • Update: Device Drivers -> Character devices -> <*> /dev/agpgart (AGP Support)
    • Confirm: Device Drivers -> Graphics Support -> < > nVidia Framebuffer Support
    • Confirm: Device Drivers -> Graphics Support -> < > nVidia Riva support
    • Confirm: Device Drivers -> Graphics Support -> <*> VESA VGA graphics support
    • Update: Device Drivers -> Graphics Support -> VESA driver type (vesafb-tng)
  • Reboot
  • Make sure the /usr/src/linux symlink is pointing to the correct sources: ls -l /usr/src/linux
  • Install the drivers (nvidia-kernel & nvidia-glx). Since nvidia-glx depends on nvidia-kernel, installing nvidia-glx is sufficient: emerge nvidia-glx
NOTE: Every time you compile a new kernel or recompile the current one, you have to run "emerge nvidia-kernel" to reinstall the nvidia modules. nVidia-glx is unaffected by a kernel change and doesn't even need to be rebuilt when you recompile/upgrade X.
  • Load the kernel module into memory
    • modprobe nvidia
    • FATAL: Error inserting nvidia (/lib/modules/2.6.16-gentoo-r13/video/nvidia.ko): Unknown symbol in module, or unknown parameter (see dmesg)
    • dmesg
      • nvidia: Unknown symbol remap_page_range
      • nvidia: Unknown symbol pci_find_class
  • Supposedly the "stable" nvidia drivers in portage are really old. It's better to use the "testing" drivers. See http://gentoo-wiki.com/HOWTO_Unmask_Nvidia_Drivers
    • Unmask the driver packages
      • edit /etc/portage/package.keywords
      • media-video/nvidia-kernel
      • media-video/nvidia-glx
    • Emerge the new version and confirm: emerge -av nvidia-glx
    • Unload the old kernel module: rmmod nvidia
    • Load the new kernel module: modprobe nvidia
  • Success! Reboot to be sure... :)
  • Configure X
    • edit /etc/X11/xorg.conf
    • Change the Driver line in the Device section from "nv" to "nvidia"
    • Change the Module section and make sure that glx gets loaded and dri does not
    • Make sure that in the Screen section, the DefaultDepth directive is set to 24
  • Run eselect so that X uses the nvidia glx libraries: eselect opengl set nvidia
  • Add user to the video group so he has access to the nvidia device files: gpasswd -a video
  • Test the card
    • startx
    • glxinfo | grep direct
    • should say that direct rendering is activated
    • test FPS: glxgears
  • Enable nvidia support for apps
    • edit /etc/make.conf and add "nvidia" to the USE flags
    • rebuild the apps that benefit from the USE flag change: emerge -uD --newuse world
    • Error: device conflicts. Ignore for now. Maybe I'll come back & rebuild apps later
  • Install nvidia settings tool:
    • emerge media-video/nvidia-settings
    • 1 config file needs updating, so find it: find /etc -iname '._cfg*'
    • /etc/modules.d/._cfg0000_nvidia
    • diff /etc/modules.d/nvidia /etc/modules.d/._cfg0000_nvidia
    • minor differences, so just replace the original config with the new: mv /etc/modules.d/._cfg0000_nvidia /etc/modules.d/nvidia
  • Run nvidia-settings to configure graphics
  • Resolution is way too small.
    • edit /etc/X11/xorg.conf
    • delete "1280x1024" mode from Screen/Display/Depth=24 section. New default becomes "1024x768".
    • reboot. Only fixes resolution in X.
    • edit /boot/grub/grub.conf, change video statement to use 1024x768
    • reboot
    • much better!