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 Mesa-based DRI drivers used to be hosted in the DRI tree (which is basically a copy of the XFree86 tree). Since the Mesa-based DRI drivers are moreso "Mesa drivers" than "XFree86 drivers" and the fact that with some work, the drivers could be used without X, the driver code was moved into the Mesa tree.
So now the DRI drivers can be compiled for two different environments: fbdev and XFree86. To build the drivers for XFree86, one has to download/build the DRI source tree. Eventually, we'd like to be able to build the drivers for XFree86 outside of the XFree86/DRI trees.
First, you'll need the DRM (Direct Rendering Manager) kernel module sources. They're found in a module of the DRI CVS tree. To obtain the code do the following:
cvs -d:pserver:anonymous@pdx.freedesktop.org:/cvs/dri login
Press Enter/Return when prompted for a password. Then,
cvs -d:pserver:anonymous@pdx.freedesktop.org:/cvs/dri co drm
Compile the DRM kernel modules:
cd drm/linux make
Note: you may need to be root in order to make a few symlinks.
When compilation is done, you should have at least the following kernel modules:
gamma.o i810.o i830.o mach64.o mga.o r128.o radeon.o savage.o sis.o tdfx.o via.o
You'll probably want to copy/move them into your kernel module directory
(for example: /lib/modules/2.4.18-14/kernel/drivers/char/drm/
).
Begin by editing the Mesa/configs/default
file to set
the DRM_SOURCE_PATH
variable.
Set it to the location where the DRM module sources are located.
For example, if your current directory in step 2.1 was /home/fred/
set DRM_SOURCE_PATH to /home/fred/drm
Next, 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:
libGL.so.1.2
- the client-side OpenGL library
(and a few symlinks to it).
libGLU.so.1.1
- the GLU library (and a few symlinks to it).
libglut.so.3.7
- the GLUT library (and a few symlinks to it).
mga_dri.so
- DRI driver for Matrox G200/G400 cards.
r128_dri.so
- DRI driver for ATI Rage 128 cards.
r200_dri.so
- DRI driver for ATI R200 Radeon cards.
radeon_dri.so
- DRI driver for original ATI Radeon cards.
i810_dri.so
- DRI driver for Intel i810/i815 chips.
i830_dri.so
- DRI driver for Intel i830/i845 chips.
mga_dri.so
- DRI driver for Matrox G200/G400 cards.
sis_dri.so
- DRI driver for SIS cards.
tdfx_dri.so
- DRI driver for 3dfx Voodoo 3/4/5 cards.
gamma_dri.so
- DRI driver for 3Dlabs gamma cards.
fb_dri.so
- software-only fbdev driver.
miniglx.conf
- configuration file for the MiniGLX interface
If XFree86 is currently running, exit/stop the X server so you're working from the console.
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 (from step 2.1).
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
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.
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.
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.
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.