Mesa fbdev/DRI Drivers

1. Introduction

The fbdev/DRI sub-project within Mesa brings hardware accelerated OpenGL rendering to the Linux fbdev environment. The X Window System / XFree86 is not needed.

Basically, the DRI drivers for hardware accelerated OpenGL for XFree86 have been ported to fbdev so that X is not needed. This means fbdev/DRI works in full-screen mode only.

DRI driver writers may find this simplified environment easier to work in, compared to the full XFree86/DRI environment.

Much of the work for this project has been done by Jon Smirl and Keith Whitwell.

To use fbdev/DRI, you'll need a Linux 2.4 or 2.6 kernel.

The fbdev/DRI Mesa code is in the Mesa CVS trunk (to be released as Mesa 5.1 in the future).

2. Compilation

Assuming you're starting with a fresh Mesa CVS checkout, do the following:

   make linux-solo

If you previously built the source tree, run make realclean first to remove the old object files.

When this is finished, check the Mesa/lib directory to verify that the following files were made:

3. Using fbdev/DRI

If XFree86 is currently running, exit/stop the X server so you're working from the console.

3.1 Kernel Modules

You'll need to load kernel modules specific to your graphics hardware. The following kernel modules should be included with your kernel.

If you have ATI Radeon/R200 hardware, run as root:

   modprobe agpgart            # the AGP GART module
   modprobe radeonfb           # the Radeon fbdev driver
   modprobe radeon             # the Radeon DRI kernel module

If you have ATI Rage 128 hardware, run as root:

   modprobe agpgart            # the AGP GART module
   modprobe aty128fb           # the Rage 128 fbdev driver
   modprobe r128               # the Rage 128 DRI kernel module

If you have Matrox G200/G400 hardware, run as root:

   modprobe agpgart            # the AGP GART module
   modprobe mgafb              # the Matrox fbdev driver
   modprobe mga                # the Matrox DRI kernel module

Then run lsmod to be sure the modules are loaded. For a Radeon card, you should see something like this:

Module                  Size  Used by    Not tainted
radeon                110308   0  (unused)
radeonfb               21900   0  (unused)
agpgart                43072   1 

If the driver complains that the radeon/mga/etc/ kernel module is too old, you'll have to compile/install a newer one from the DRI project.

3.2 Configuration File

The Mesa/lib/miniglx.conf file should be installed in /etc/.

Edit /etc/miniglx.conf to be sure it's set up correctly for your hardware. Comments in the file explain the options.

3.3 Running fbdev/DRI Programs

Make sure your LD_LIBRARY_PATH environment variable is set to the Mesa/lib/ directory.

Change to the Mesa/progs/miniglx/ directory and start the sample_server program in the background:

   ./sample_server &

Then try running the miniglxtest program:

   ./miniglxtest

You should see a rotating quadrilateral which changes color as it rotates. It will exit automatically after a bit.

If you run other tests in the miniglx/ directory, you may want to run them from a remote shell so that you can stop them with ctrl-C.

4.0 Troubleshooting

If you try to run miniglxtest and get the following:

   [miniglx] failed to probe chipset
   connect: Connection refused
   server connection lost

It means that the sample_server process is not running.

5.0 Programming Information

The full OpenGL API is available with fbdev/DRI.

OpenGL/Mesa is interfaced to fbdev via the MiniGLX interface. MiniGLX is a subset of Xlib and GLX API functions which provides just enough functionality to setup OpenGL rendering and respond to simple input events.

Since MiniGLX is a subset of the usual Xlib and GLX APIs, programs written to the MiniGLX API can also be run on full Xlib/GLX implementations. This allows some degree of flexibility for software development and testing.

However, the MiniGLX API is not binary-compatible with full Xlib/GLX. Some of the structures are different and some macros/functions work differently. See the GL/miniglx.h header file for details.