With hardware 3D acceleration, three-dimensional rendering uses the graphics processor on your video card instead of taking up valuable CPU resources drawing 3D images. It's also referred to as "hardware acceleration" instead of "software acceleration" because without this 3D acceleration your CPU is forced to draw everything itself using the Mesa software rendering libraries, which takes up quite a bit of processing power. While XFree86 typically supports 2D hardware acceleration, it often lacks hardware 3D acceleration. Three-dimensional hardware acceleration is valuable in situations requiring rendering of 3D objects such as games, 3D CAD and modeling.
In many cases, both binary and open-source drivers exist. Open-source drivers are preferable since we're using Linux and open source is one of its underlying principles. Sometimes, binary drivers are the only option, like with nVidia's cards. Binary drivers include media-video/mgavideo for Matrox and media-video/ati-drivers for ATI cards. Other open-source drivers include media-video/kyro-kernel for KyroII cards and media-video/ati-gatos for ATI cards, which aim to support ATI's video capabilities more fully.
The Direct Rendering Infrastructure (
XFree-DRM is an
This guide is for people that can't get direct rendering working with just XFree. XFree-DRM works for 3dfx, gamma, i8x0, matrox, rage128, radeon and sis drivers. There's also some support for mach64 in the CVS sources -- check out
For suggestions, questions, etc., e-mail
# emerge x11-base/xfree
Probe for your chipset and enable just that one.
# emerge pciutils; lspci | grep AGP # 00:01.0 PCI bridge: Intel Corp. 440BX/ZX/DX - 82443BX/ZX/DX AGP bridge (rev 03)Your output may not match the above due to different hardware.
Most, if not all, kernels should have these options. This was configured using gentoo-sources-2.4.20-r5.
# ls -l /usr/src/linux lrwxrwxrwx 1 root root 22 May 29 18:20 /usr/src/linux -> linux-2.4.20-gentoo-r5Make sure # cd /usr/src/linux # make menuconfig/usr/src/linux links to your current kernel.
Processor type and features ---> <*> MTRR (Memory Type Range Register) support Character devices ---> <*> /dev/agpgart (AGP Support) [*] Intel 440LX/BX/GX and I815/I820/I830M/I830MP/I840/I845/I850/I860 supportEnable your chipset instead of the above. [ ] Direct Rendering Manager (XFree86 DRI support)
Make sure the Direct Rendering Manager (DRM) is
# make dep && make clean bzImage modules modules_install
# mount /boot
# cp arch/i386/boot/bzImage /boot
If you want your kernel to be named something other than bzImage, be sure to copy to /boot/yourname instead. Don't forget to set up grub.conf or lilo.conf and run /sbin/lilo if you use LILO.
# ACCEPT_KEYWORDS="~x86" emerge xfree-drm
Open
...
Section "Module"
Load "dri"
Load "glx"
...
EndSection
...
Section "Device"
Driver "radeon"
...
EndSection
...
Section "DRI"
Mode 0666
EndSection
If you are using a different driver, replace "radeon" with yours.
Reboot your computer to your new kernel. It's time to see if you have direct rendering and how good it is.
# startxNo need to load modules for your driver or agpgart, if you compiled agpgart as a module. They will be loaded automatically. # glxinfo | grep rendering direct rendering: YesIf it says "No," you don't have 3D acceleration. # glxgearsTest your frames per second (FPS) at the default size. Do this while the CPU is as idle as possible.
First you have to check whether the xfree-drm package works. If it doesn't and you have a very new card, you might want to consider the CVS sources. The xfree-drm package currently supports at least the Radeon 9000.
Check the DRI
Follow this guide through "Compile and install your kernel." Then we'll move to step 6 of the
Create a directory to store the CVS files:
# cd ~ # mkdir DRI-CVS
Check out the CVS sources
# cd ~/DRI-CVS # cvs -d:pserver:anonymous@cvs.dri.sourceforge.net:/cvsroot/dri login(hit ENTER when prompted for a password) # cvs -z3 -d:pserver:anonymous@cvs.dri.sourceforge.net:/cvsroot/dri co xcThe -z3 flag causes compression to be used in order to reduce the download time.
In the future you'll want to occasionally update your local copy of the DRI source code to get the latest changes. This can be done with:
# cd ~/DRI-CVS # cvs -z3 update -dA xcThe -d flag causes any new subdirectories to be created. The -A flag causes most recent trunk sources to be fetched, not branch sources.
Rather than placing object files and library files right in the source tree, they're instead put into a parallel
# cd ~/DRI-CVS # ln -s xc XFree40 # mkdir build; cd build # lndir -silent -ignorelinks ../XFree40
The build tree will be populated with symbolic links which point back into the CVS source tree. Advanced users may have several build trees for compiling and testing with different options.
The
#define DefaultCCOptions -Wall
For i386:
#define DefaultGcc2i386Opt -O2
For Alpha:
#define DefaultGcc2AxpOpt -O2 -mcpu=ev6 (or similar)
For all architectures
#define LibraryCDebugFlags -O2
#define BuildServersOnly YES
#define XF86CardDrivers vga tdfx mga ati i810
#define LinuxDistribution LinuxRedHat
#define DefaultCCOptions -ansi GccWarningOptions -pipe
#define BuildXF86DRI YES
/* Optionally turn these on for debugging */
/* #define GlxBuiltInTdfx YES */
/* #define GlxBuiltInMga YES */
/* #define GlxBuiltInR128 YES */
/* #define GlxBuiltInRadeon YES */
/* #define DoLoadableServer NO */
#define SharedLibFont NO
The ProjectRoot variable specifies where the XFree86 files will be installed. We recommend installing the DRI files over your existing XFree86 installation - it's generally safe to do and less error-prone. This policy is different from what we used to recommend.
If XFree86 4.x is not installed in
#define ProjectRoot pathToYourXFree86installationNote the XF86CardDrivers line to be sure your card's driver is listed. If you want to enable 3DNow! optimizations in Mesa and the DRI drivers, you should add the following: #define MesaUse3DNow YESYou don't have to be using an AMD processor to enable this option. The DRI will look for 3DNow! support at runtime and only enable it if applicable.
If you want to enable SSE optimizations in Mesa and the DRI drivers, you must upgrade to a Linux 2.4.x kernel. Mesa will verify that SSE is supported by both your processor and your operating system, but to build Mesa inside the DRI you need to have the Linux 2.4.x kernel headers in
#define MesaUseKatmai YES
To compile the complete DRI tree:
# cd ~/DRI-CVS/build/xc/ # make World >& world.log
One user suggests it may also be necessary to do the following:
# cd ~/DRI-CVS/build/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel # make -f Makefile.linux radeon.oReplace radeon with your driver.
With the default compilation flags it's normal to get a lot of warnings during compilation. Building will take some time so you may want to go check your email or visit slashdot.
Using your text editor, examine world.log for errors by searching for the pattern ***.
Verify that the DRI kernel module(s) for your system were built:
# cd ~/DRI-CVS/build/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel; ls
For the 3dfx Voodoo, you should see
Copy all of your driver files to your XFree86 installation. You may wish to back up replaced files. This is an example using a Radeon card. If you have another card, copy the appropriate files. If you don't know what they are, check the directory to which you're going to copy them to see what's there.
# cd ~/DRI-CVS/build/xc/exports/lib/modules/ # cp dri/r200_dri.so /usr/X11R6/lib/modules/dri/ # cp drivers/atimisc_drv.o /usr/X11R6/lib/modules/drivers/ # cp drivers/radeon_drv.o /usr/X11R6/lib/modules/drivers/ # cp extensions/libdri.a /usr/X11R6/lib/modules/extensions/ # cp linux/libdrm.a /usr/X11R6/lib/modules/linux/
Follow the "Configure XF86Config" section above.
To load the appropriate DRM module in your running kernel, copy the kernel module to
A few options may increase performance by up to 30 percent (or more) over the default. Set them in
Section "Device"
Option "AGPMode" "4"
This increased FPS from 609 to 618.
Option "AGPFastWrite" "True"
This had no measurable effect, but it may increase instability of your computer.
You may also need to set it in your BIOS.
Option "EnablePageFlip" "True"
This improved FPS from 618 to 702. It also is "risky" but few people have reported problems.
...
EndSection
If you want to set even more features, check out the
Try
That's because you compiled agpgart into the kernel instead of as a module. Ignore it.
You aren't using the xfree-drm driver. Check if you compiled DRM and the driver into the kernel; you shouldn't have.
Check out ati-gatos drivers.
Try out the binary drivers. For ati-drivers, a listing is at
In section "Device" enable ForcePCIMode.
Option "ForcePCIMode" "True"