Installing Nouveau on your Linux computer

There are two ways of installing Nouveau on your Linux computer. The most recommended way is to use your distribution-provided packages. If those are outdated or buggy, you may also recompile Nouveau from source.

Nouveau is incompatible with NVIDIA's proprietary driver. If you want to use Nouveau, you first need to remove the proprietary driver from your system.

Using your distribution's packages

The following information are provided to the best of our knowledge. Please seek help on your distribution's wiki if you have any problem installing or uninstalling Nouveau.

Compiling Nouveau from source

Instead of using the distribution-provided binaries, you can also recompile Nouveau yourself. There are several reasons to want to compile Nouveau from source, here are the most common ones:

  • Testing the latest version on Nouveau;
  • Bug fixing - checking if a bug in a stable version is still present in the development branches or testing a patch;
  • Contributing code - Developers are expected to test and implement new code on the development branches.

Whatever your reason is, the development team thanks you for living on the edge. Please tell us as soon as possible when you encounter a bug!

Nouveau is split into 4 main parts:

  • Nouveau DRM : The privileged part of Nouveau, running in the kernel;
  • Libdrm : A library that wraps the DRM & Nouveau IOCTLs, it simplifies memory management and command submission;
  • xf86-video-nouveau : The device-dependent part of X (DDX) for NVIDIA cards whose role is to provide 2D acceleration (EXA) and some simple video acceleration (XV);
  • Mesa : It provides 3D, GPGPU and video acceleration to open source drivers. For more information, please read MesaDrivers.

Kernel

The kernel modules required by Nouveau (drm.ko, drm_kms_helper.ko, ttm.ko and nouveau.ko) are built from a Linux kernel tree. You have several options on how to download the source code (subsections of Section 1) and how to compile it (subsections of Section 2). See also KernelModeSetting for important KMS notes. Please, read carefully.

The Nouveau kernel git repository is called nouveau/linux-2.6 and contains one recommended branch: master. The repository name contains "2.6" because we never bothered to rename it to "3": that would either break a lot of people's git configs or we would have two names for the same repository, for no benefit. It does contain the Linux 3.x versions.

You may not be able to compile the DRM modules against your current kernel, if it is too old (might need an -rc kernel or even Linus' git kernel). The possible errors include build failure and kernel modules that cannot be loaded. It is recommended to build your whole kernel from this branch (Section 2.1).

Since the DRM code is part of the kernel since 2.6.33, you can also use Linus' git kernel for Nouveau. However, the code in Linus' kernel will always be older than Nouveau's own git, and because there are no official Nouveau releases, you may encounter compatibility issues with user space parts (libdrm, DDX, Mesa).

This is a simplified tutorial. A more extensive tutorial is also available.

Getting the source code

You have multiple choices when it comes to downloading the source code:

  • Get the full Nouveau kernel tree, with full history : Best for developers and people willing to bisect regressions;
  • Get the full Nouveau kernel tree, without history: For continuous testers with a data cap on their internet plan;
  • Get a snapshot: For occasional testers with an internet data cap (out-of-the-tree compilation only).

In order to download the full Nouveau kernel tree, please run the following command (un-comment --depth=1 if you don't want the full history):

git clone git://anongit.freedesktop.org/nouveau/linux-2.6 # --depth=1

If you only want to download a snapshot, please run the following commands:

$ wget http://people.freedesktop.org/~pq/nouveau-drm/master.tar.gz
$ tar xf master.tar.gz

Full kernel compilation

This method cannot be applied if you only downloaded a snapshot of Nouveau. Please download a complete version of the Nouveau tree.

The configuration and installation parts are distribution-dependent. You can find some instructions for ArchLinux, Debian, Gentoo, Ubuntu or Fedora.

Please make sure CONFIG_DRM_NOUVEAU=m, otherwise Nouveau won't be compiled in the kernel.

Out-of-the-tree compilation

The out-of-the-tree builds are mostly used by developers or testers who recompile their kernel often with some custom patches. The out-of-the-tree build will only recompile the DRM part of the kernel which should be orders of magnitude faster than a full kernel recompilation.

In order to use the out-of-the-tree compilation, please go to the directory containing the Nouveau tree or a snapshot of it. Please then run the following commands:

$ mkdir nouveau
$ cd nouveau
$ wget http://nouveau.freedesktop.org/wiki/InstallNouveau/Makefile
$ make

Then, you should insmod all the drm modules that got compiled. It is also possible to install them but this isn't recommended.

WARNING: To use this technique, you will be required to be running at least the same major version of the kernel as one you want to compile out of the tree. If the kernel hasn't been released yet, please compile, install and reboot a kernel compiled from the full Nouveau tree before attempting again.

Run-time configuration

A list of the module parameters is available.

Userspace

The following tutorial will help you compile and install Nouveau in a user directory. This will lower your chances of messing up your whole system. Each package's instructions assume that you have the proper header files installed. If you're on a Debian-based distro (including Ubuntu), you can run apt-get build-dep mesa to make sure that this happens.

However, if you need to recompile xf86-video-nouveau and your distribution-provided libdrm isn't sufficient, you will need to set NVD to /usr and install libdrm, mesa and xf86-video-nouveau.

If you are not in this case, please source the following script (nouveau-env.sh) in every console where you need to do Nouveau development:

DEV_HOME=$HOME/nouveau/ # change this to another location if you prefer
NVD=$HOME/install       # change this to another location if you prefer
LD_LIBRARY_PATH=$NVD/lib
PKG_CONFIG_PATH=$NVD/lib/pkgconfig/:$NVD/share/pkgconfig/
ACLOCAL="aclocal -I $NVD/share/aclocal"

export DEV_HOME NVD LD_LIBRARY_PATH PKG_CONFIG_PATH ACLOCAL

Sourcing the file can be done by running command:

$ source nouveau-env.sh

Libdrm

Here are the commands to compile libdrm from git:

$ cd $DEV_HOME
$ git clone git://anongit.freedesktop.org/mesa/drm
$ cd drm
$ ./autogen.sh --prefix=$NVD
$ make
$ make install

Xf86-video-nouveau

Let's now recompile Nouveau's X.org driver (DDX) from git:

$ cd $DEV_HOME
$ git clone git://anongit.freedesktop.org/nouveau/xf86-video-nouveau
$ cd xf86-video-nouveau
$ ./autogen.sh --prefix=$NVD
$ make
$ make install

You'll then need to tell the X-server where to look for nouveau_drv.so. To do so, please create a configuration file at /etc/X11/xorg.conf.d/01-module-path.conf containing:

Section "Files"
    ModulePath "/same/path/as/NVD/lib/xorg/modules/drivers/"
EndSection

WARNING: Please replace /same/path/as/NVD/ by the path you set for $NVD.

WARNING2: If you managed to break your graphical interface. You can revert back to the previous ddx by deleting 01-module-path.conf.

Mesa

Mesa can be compiled by running the following commands:

$ cd $DEV_HOME
$ git clone git://anongit.freedesktop.org/mesa/mesa
$ cd mesa
$ ./autogen.sh                            \
      --prefix=$NVD                       \
      --enable-texture-float              \
      --enable-gles1                      \
      --enable-gles2                      \
      --enable-glx                        \
      --enable-gallium-egl                \
      --enable-gallium-llvm               \
      --enable-egl                        \
      --enable-gallium-egl                \
      --enable-shared-glapi               \
      --enable-gbm                        \
      --enable-glx-tls                    \
      --enable-dri                        \
      --enable-osmesa                     \
      --with-egl-platforms=x11,drm        \
      --enable-gbm                        \
      --enable-shared-glapi               \
      --with-gallium-drivers=nouveau      \
      --with-dri-drivers=nouveau          \
      --enable-vdpau
$ make
$ make install

LibVDPAU (optional, only useful for video decoding)

The libvdpau will look for libvdpau_nouveau.so in the same prefix as it was installed (regardless of LD_LIBRARY_PATH). We thus need to recompile libvdpau and install it to the same prefix as mesa in order for it to use the right libvdpau_nouveau.so.

$ cd $DEV_HOME
$ git clone git://people.freedesktop.org/~aplattner/libvdpau
$ cd libvdpau/
$ ./autogen.sh --prefix=$NVD
$ make
$ make install

Configuring the X server

When using Nouveau, the X-Server doesn't need configuration, the Nouveau driver should be loaded automatically. If it wasn't the case, you may want to try to force the X-server to load the Nouveau driver. To do so, please create the file /etc/X11/xorg.conf.d/20-nouveau.conf and write the following:

Section "Device"
    Identifier "n"
    Driver "nouveau"
EndSection

It is possible to give some options to the Nouveau DDX. Please have a look at our man page (man 4 nouveau). For more information, please follow the instructions found in the distribution-specific section.