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/nvidia-kernel and media-video/nvidia-glx for nVidia cards, media-video/mgavideo for Matrox cards 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 who can't get direct rendering working with just
XFree. XFree-DRM works for 3dfx, gamma, i8x0, matrox, rage128, radeon, mach64
(as of xfree-drm-4.3.0-r7) and sis300 series drivers. Since the 2.4 kernels'
Direct Rendering Manager (DRM) doesn't support XFree 4.3, the xfree-drm package
is needed. If you're using a 2.6 kernel, its DRM supports XFree 4.3; Gentoo's
XFree-DRM package is not yet working on 2.6 kernels. See the
With 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) [M] 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. The number should be significantly higher than before installing xfree-drm. 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 checked your logs to verify it's not a configuration error, you might want to consider the CVS sources. There are also daily driver snapshots available if you do not wish to build the full CVS.
Check the DRI
Follow this guide through "Compile and install your kernel." Then continue with
this guide, which tracks 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 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 -WallFor i386: #define DefaultGcc2i386Opt -O2For 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
Note 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
It may also be necessary to do the following, depending on what you placed in host.def:
# 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
Install over your XFree86 installation. You may wish to back up xfree.
# quickpkg xfreeThis backs up your XFree86 package. # make install
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
Whenever you rebuild your kernel or switch to another kernel, you'll have to rebuild the kernel module. Note that you don't need to remerge xfree, but you will need to remerge xfree-drm.
Try
That's because you compiled agpgart into the kernel instead of as a module. Ignore it unless you're having problems.
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"