Mesa fbdev/DRI Drivers

1. Introduction

The fbdev/DRI environment supports hardware-accelerated 3D rendering without the X window system. This is typically used for embedded applications.

Contributors to this project include Jon Smirl, Keith Whitwell and Dave Airlie.

Applications in the fbdev/DRI environment use the MiniGLX interface to choose pixel formats, create rendering contexts, etc. It's a subset of the GLX and Xlib interfaces allowing some degree of application portability between the X and X-less environments.

2. Compilation

You'll need the DRM and pciaccess libraries. Check with:

   pkg-config --modversion libdrm
   pkg-config --modversion pciaccess

You'll need fbdev header files. Check with:

   ls -l /usr/include/linux/fb.h

Compile Mesa with the 'linux-solo' configuration:

   make linux-solo

When complete you should have the following:

3. Using fbdev/DRI

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

3.1 Load Kernel Modules

You'll need to load the kernel modules specific to your graphics hardware. Typically, this consists of the agpgart module, an fbdev driver module and the DRM kernel module.

As root, the kernel modules can be loaded as follows:

If you have Intel i915/i945 hardware:

   modprobe agpgart            # the AGP GART module
   modprobe intelfb            # the Intel fbdev driver
   modprobe i915               # the i915/945 DRI kernel module

If you have ATI Radeon/R200 hardware:

   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:

   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:

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

To verify that the agpgart, fbdev and drm modules are loaded:

   ls -l /dev/agpgart /dev/fb* /dev/dri

Alternately, use lsmod to inspect the currently installed modules. If you have problems, look at the output of dmesg.

3.2 Configuration File

Copy the sample miniglx.conf to /etc/miniglx.conf and review/edit its contents. Alternately, the MINIGLX_CONF environment variable can be used to indicate the location of miniglx.conf

To determine the pciBusID value, run lspci and examine the output. For example:

   /sbin/lspci:
   00:02.0 VGA compatible controller: Intel Corporation 82915G/GV/910GL Express Chipset Family Graphics Controller (rev 04)

00:02.0 indicates that pciBusID should be PCI:0:2:0

3.3 Running fbdev/DRI Programs

Make sure your LD_LIBRARY_PATH environment variable is set to the location of the libGL.so library. You may need to append other paths to LD_LIBRARY_PATH if libpciaccess.so is in a non-standard location, for example.

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

  1. 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

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.