DRI Beginner's Guide

By Frank Worsley


1. Introduction

1.1 Intended Audience
1.2 What is the DRI?
1.3 Why do I need the DRI?
1.4 What is OpenGL, GL, GLU, GLUT etc.?

2. Setting up the DRI

2.1 Is my hardware supported?
2.2 What other software do I need?
2.3 Installing the DRI drivers
2.4 Configuring XFree86
2.5 Testing your setup

3. Troubleshooting

1.0 Introduction

1.1 Intended Audience

This guide is aimed at beginners who do not have any previous experience using the DRI or setting it up. It will attempt to be a rough guide through all the steps neccessary to install the DRI and get it working. Instead of explaining every step in detail this guide will point you to other documentation that is already provided.

It is not meant to replace the DRI User Guide. Refer to the User Guide for more detailed information.

Advanced users will probably not find this guide very helpful.

1.2 What is the DRI?

The technical description from the DRI website describes it as follows:

The direct rendering infrastructure, also known as the DRI, is a framework for allowing direct access to graphics hardware in a safe and efficient manner. It includes changes to the X server, to several client libraries, and to the kernel. The first major use for the DRI is to create fast OpenGL implementations.

What this means is that the DRI is a framework for allowing programs to speak directly to your graphics card. For example, games or graphics programs can send commands directly to your card and let it perform fast, hardware-accelerated rendering producing high-quality visuals. At the same time your CPU is free to do other work. This is known as direct rendering.

Without the DRI programs have to perform the rendering using software. This ties up your CPU and results in much lower framerates since software is slower than hardware. This is know as indirect rendering.

1.3 Why do I need the DRI?

The previous section should have already answered that question.

You will need the DRI if you want to play 3D games (like Quake 3), use 3D modelling software or do anything else that requires fast 3D rendering.

1.4 What is OpenGL, GL, GLU, GLUT etc.?

For an explanation of other terms surrounding the DRI check out the DRI Term Glossary.

2. Setting up the DRI

2.1 Is my hardware supported?

Before you start setting up the DRI you have to find out if your graphics card is even supported.

Go to the DRI website and consult the status page to see if your graphics hardware is listed. If it is then you can proceed with the setup. If not then you will have to wait until drivers for your card are developed.

Note that some of the drivers only support AGP graphics cards. If you have a PCI card and see your chipset listed you should just give it a shot and see if it works.

2.2 What other software do I need?

The DRI requires a working installation of XFree86 version 4.0.0 or later.

You can download the latest XFree86 sourcecode from xfree86.org and then compile and install XFree86 manually. Preferably you should download and install binary packages specific to your distribution (for example RPMs from Redhat). You should also note that most current distributions of Linux already include XFree86 4.

Furthermore the DRI requires at least a Linux 2.4.0 kernel or later.

You can download the latest kernel source from kernel.org and then compile and install it yourself. However, it would be easiest for you to download a binary package specific to your distribution (for example RPMs from Redhat). Again, most recent distributions of Linux already include a 2.4 kernel.

For instructions on how to do the above consult the related documentation. Explaining how to compile a kernel or install XFree86 is outside the scope of this guide.

2.3 Installing the DRI drivers

Unless you are interested in DRI development you should download the binary DRI driver packages and install them.

Go to the downloads page and download the latest package that matches your operating system, architecture and hardware. Then extract the package and run the install script to install the drivers.

For more detailed instructions on how to do this check out the install readme file.

2.3 Configuring XFree86

This is the largest section of the guide and explains how to configure XFree86 to actually use the DRI.

STEP 1: First of all you have to modify your XFree86 config file so it loads the dri and glx modules. The config file is usually located at /etc/X11/XF86Config (on Redhat Linux it is /etc/X11/XF86Config-4).

To begin login as the root user and open the config file using your favorite text editor. Locate the Module section in the file:

Section "Module"

This section defines which modules will be loaded by XFree86 on startup. Make sure the glx and dri modules are listed:

Load "glx"
Load "dri"

If you do not see the above two lines in the Module section add them and then save the file.

STEP 2: Next you have to configure the Device section to load the correct driver for your graphics card.

Again, open the config file with your favorite text editor and locate the Device section:

Section "Device"

Inside the Device section there will be a Driver line listing the driver to use for the graphics device:

Driver "XXX"

Depending on your graphics card you have to enter a different driver:

Card Manufacturer Driver Name
ATI ati
Matrox mga
3dfx tdfx
Intel i810

After changing the Driver value save the file.

STEP 3: This is a very basic explanation of the setup steps required. You should read the DRI User Guide for a more detailed explanation. The guide also explains how to change the AGP mode of a driver and other options.

Testing your setup

After making the changes start your X server as usual (if you use X to login restart the computer).

Next run the glxinfo program. This program will print out information relating to the DRI/GLX setup. Specifically look for the following:

direct rendering: yes
OpenGL vendor string: VA Linux Systems, Inc.
OpenGL renderer string: Mesa DRI Rage128 20010405 Pro AGP 4x x86/MMX/3DNow!
OpenGL version string: 1.2 Mesa 3.4.1

This will list the current renderer being used (in this case a Rage 128 Pro), the OpenGL vendor (which should be VA Linux Systems) and most importantly if direct rendering is enabled.

If you do not see the bold line above then something is wrong with your setup. Make sure you have followed all steps in this guide. If you need more help consult the other documentation, the FAQ or send a message to the dri-users mailing list.

3. Troubleshooting

This section will explore the solutions to three common problems.

1. My X server wont start after following this guide because ...

Solution: The problem is most likely that you have an outdated X server binary. To solve the problem download the Extras package matching your system from the DRI website. Then re-install the DRI drivers. See the install readme for more information.

2. I run glxinfo or another OpenGL program and it crashes right away!

Solution: Most likely you have a problem with libGL not being linked correctly. The easiest solution is to re-install the DRI drivers using the force option. See the install readme for more information.

You can also manually re-link the libGL library. Look at this FAQ item for more information.

3. I run an OpenGL program after following this guide but it runs reeeeally slowly!

Solution: First off all, go and run glxinfo and make sure direct rendering is enabled. If it is not then you did something else wrong along the way. Go back and make sure you have followed every step in this guide.

If direct rendering is enabled you probably have a libGL problem, follow the solution to the question above.

And most importantly, if you have other problems read the FAQ or send a message to the mailing lists.