Xorg/Hardware 3D acceleration guide
This document is a guide to getting 3D acceleration working using the DRM with Xorg in Gentoo.
- 1 Introduction
- 2 Install Xorg and configure your kernel
- 3 Configure direct rendering
- 4 Test 3D acceleration
- 5 Troubleshooting
- 5.1 It doesn't work. I don't have rendering, and I can't tell why.
- 5.2 When I startx, I get this error: "[drm] failed to load kernel module agpgart"
- 5.3 I have a Radeon, and I want TV-Out.
- 5.4 It doesn't work. My card is so incredibly new and cool that it isn't supported at all.
- 5.5 I have a PCI card and it doesn't work. Help!
- 6 External resources
What is hardware 3D acceleration and why do I want it?
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 Xorg 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.
How do I get hardware 3D acceleration?
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, especially if your graphics card is so new that open source drivers have not yet been written to support its features. Binary drivers include x11-drivers/nvidia-drivers for nVidia cards and x11-drivers/ati-drivers for AMD/ATI cards.
What is DRI?
The Direct Rendering Infrastructure, also known as the DRI, is a framework for allowing direct access to graphics hardware in a safe and efficient manner. It includes changes to the X server, to several client libraries and to the kernel. The first major use for the DRI is to create fast OpenGL implementations.
What is the DRM and how does it relate to regular Xorg?
The DRM (Direct Rendering Manager) is an enhancement to Xorg that adds 3D acceleration for cards by adding the kernel module necessary for direct rendering.
This guide is for people who can't get direct rendering working with just Xorg. The DRM works for the following drivers:
See the DRI homepage for more info and documentation.
Install Xorg and configure your kernel
Please read our Xorg Configuration Guide to get Xorg up and running.
Configure your kernel
Probe for your chipset and enable just that one.
emerge --ask 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.
If your chipset is not supported by the kernel you might have some success by passing
agp=try_unsupported as a kernel parameter. This will use Intel's generic routines for AGP support. To add this parameter, edit your bootloader configuration file!
Most, if not all, kernels should have these options. This was configured using a standard sys-kernel/gentoo-sources kernel.
ls -l /usr/src/linux
lrwxrwxrwx 1 root root 22 2007-02-14 20:12 /usr/src/linux -> linux-2.6.18-gentoo-r4
Make sure /usr/src/linux links to your current kernel.
Processor type and features ---> <*> MTRR (Memory Type Range Register) support Device drivers ---> Graphics support ---> <M> /dev/agpgart (AGP Support) ---> (The agpgart option is not present on 64-bit kernels; just choose your chipset support.) <M> Intel 440LX/BX/GX, I8xx and E7x05 support (Enable your chipset instead of the above.) <M> Direct Rendering Manager (XFree86 4.1.0 and higher DRI support) ---> <M> (Select your graphics card from the list)
Compile and install your kernel
make && make install && make modules_install
Don't forget to set up grub.conf or lilo.conf and run
/sbin/lilo if you use LILO. Run
grub-mkconfig -o /boot/grub/grub.cfg if you have GRUB 2.
Add your user to the video group
Next, add your user(s) to the video group:
gpasswd -a $USER video
Configure direct rendering
Hopefully just adding your user to the
video group is sufficient to enable direct rendering. However, you may also need to create a file in /etc/X11/xorg.conf.d/. You can name it anything you like; just make sure it ends in .conf. Open up your favorite text editor and create a file with this inside it:
Section "Device" Driver "radeon" EndSection Section "dri" Mode 0666 EndSection
radeon with the name of your driver.
Changes to /etc/conf.d/modules
You will need to add the module name that your card uses to /etc/conf.d/modules to ensure that the module is loaded automatically when the system starts up.
modules="intel-agp" # Substitute with your driver
If you compiled
agpgartas a module, you will also need to add it to /etc/conf.d/modules.
Test 3D acceleration
Reboot to the new kernel
Reboot your computer to your new kernel and login as a normal user. It's time to see if you have direct rendering and how good it is.
glxgears are part of the x11-apps/mesa-progs package, so make sure it is installed before you attempt to run these commands.
No need to load modules for your driver or agpgart, even if you compiled them as a module. They will be loaded automatically.
glxinfo | grep rendering
direct rendering: Yes
If it says "No", you don't have 3D acceleration.
Test your frames per second (FPS) at the default size. The number should be significantly higher than before configuring DRM. Do this while the CPU is as idle as possible.
FPS may be limited by your screen's refresh rate, so keep this in mind if
glxgearsreports only about 70-100 FPS. games-fps/xonotic or other 3D games are better benchmarking tools, as they give you real-world performance results.
Get the most out of direct rendering
It doesn't work. I don't have rendering, and I can't tell why.
modprobe radeon before you start the X server (replace
radeon with the name of your driver). Also, try building agpgart into the kernel instead of as a module.
When I startx, I get this error: "[drm] failed to load kernel module agpgart"
That's because you compiled agpgart into the kernel instead of as a module. Ignore it unless you're having problems.
I have a Radeon, and I want TV-Out.
It doesn't work. My card is so incredibly new and cool that it isn't supported at all.
Try out the binary drivers. For AMD cards, use
ati-drivers. If those don't support it, use fbdev. It's slow, but it works.
I have a PCI card and it doesn't work. Help!
Create a config file in /etc/X11/xorg.conf.d/; name it anything you want as long as it ends in .conf. Add the following to it:
Section "Device" Option "ForcePCIMode" "True" EndSection
- Direct rendering (DRI) using X11-DRM HOWTO on the Gentoo forums
- Radeon 7000-9700 DRI CVS Install Guide on the Gentoo forums
This page is based on a document formerly found on our main website gentoo.org.
The following people contributed to the original document: Donnie Berkholz (dberkholz), peesh, Joshua Saddler (nightmorph)
They are listed here because wiki history does not allow for any external attribution. If you edit the wiki article, please do not add yourself here; your contributions are recorded on each article's associated history page.