Contents

Building the DRI with X.org and Mesa

This is a basic guide to building DRI from source. This guide only covers building the client-side 3D drivers. Since the transition to the modular X.org build, building an X-server and 2D drivers is beyond the scope of this document. That information can be found in the X.org Modular Developer Guide. You will most probably need to (re)compile also at least the keyboard and mouse drivers, in addition to a video card 2D driver.

The 2D drivers with DRI support, server-side GLX support and the GL library capable of loading DRI 3D drivers are developed in X.org's CVS. The 3D drivers, though, live in the Mesa tree, so you will have to check out the Mesa git tree. You should also get the DRM git tree for up-to-date kernel modules. The following instructions will guide you through the process step by step.

Warning: In case you didn't notice, you are about to compile and install experimental software. This will allow you to test the latest features and bug fixes. It may, however, also introduce new bugs. Be prepared for problems every now and then.

Dependencies

You need a current version (7.4, ie. xserver 1.5 as of this writing) of X.org (core and development packages) installed on your system. In particular, you need these X.org components:

  • proto/glproto 1.4.14 or git://anongit.freedesktop.org/git/xorg/proto/glproto
  • proto/xf86vidmodeproto git://anongit.freedesktop.org/git/xorg/proto/xf86vidmodeproto
  • lib/libXxf86vm git://anongit.freedesktop.org/git/xorg/lib/libXxf86vm
  • lib/libXmu git://anongit.freedesktop.org/git/xorg/lib/libXmu
  • dri2proto git://anongit.freedesktop.org/xorg/proto/dri2proto

On Debian/Ubuntu

If you are using Debian or Ubuntu you can install the packages with:

apt-get build-dep libdrm mesa
apt-get install linux-headers-`uname -r`
apt-get install libxi-dev libxmu-dev x11proto-xf86vidmode-dev
apt-get install git autoconf automake libtool

Getting Mesa

The clean Mesa source tree takes about 32MB of disk space.

git clone git://anongit.freedesktop.org/git/mesa/mesa

Building Mesa 3D drivers

The DRI 3D drivers are now built from the Mesa source.

cd mesa
./autogen.sh

Note: mesa installs to /usr/local/lib by default. To install in /usr/lib run:

./configure --prefix=/usr

Choose the right configure options depending on the hardware architecture you're compiling for.
See http://www.mesa3d.org/autoconf.html for more information about configuring mesa or read the output from:

./configure --help

Now you're ready to compile it:

make

Installing the 3D drivers

After compiling the Mesa tree, the 3D drivers can be found in mesa/lib. There are two ways of using them: installing them in the destined place, or telling X where to find them.

  1. Install the drivers to /usr/lib/:

Run as root, to install:

make install
  1. Or set the environment variable LIBGL_DRIVERS_PATH to point to <path to Mesa>/lib, and also preload the newly built libGL.so:

    export LIBGL_DRIVERS_PATH=/lib export LD_PRELOAD=/lib/libGL.so.1

To make these settings persistent, you'll have to add them to .bashrc or a similar login script.