Linux hardware 3D acceleration Guide
1. Explanation
What is hardware 3D acceleration? Why do I need it?
With hardware 3D acceleration, 3D rendering will be performed using the graphics processor on the graphics card without occupying valuable CPU resources for 3D image rendering. It is also called "Hardware acceleration" rather than "Software Acceleration", because without this 3D acceleration, your CPU can only use the mesa software rendering library to draw all 3D images, this occupies a considerable amount of processor resources. Although Xorg generally supports 2D hardware acceleration, it often lacks hardware 3D acceleration. 3D hardware acceleration is of great value in scenarios where 3D objects need to be rendered, such as games, 3D CAD, and modeling.
How can I get hardware 3D acceleration?
In many cases, binary drivers and open-source drivers exist. We recommend that you use open-source drivers because we use Linux and open-source is one of its essential features. Sometimes binary drivers are the only choice, such as NVIDIA graphics cards. The binary driver has a x11-drivers/NVIDIA-drivers for NVIDIA graphics and a x11-drivers/Ati-drivers for ATI graphics.
What is dri?
Direct rendering infrastructure-Direct rendering architecture, also known as DRI, is an architecture that allows direct access to graphics card hardware in a secure and efficient manner. It includes changes to the X server and several client libraries and kernels. The first important application of DRI is to create a quick OpenGL implementation.
What is DRM and how does it relate to conventional Xorg?
DRM (direct rendering Manager-Direct rendering manager) is an improvement of Xorg. It adds 3D acceleration to the graphics card by adding the kernel modules necessary for direct rendering.
Purpose
This guide is intended for those who cannot perform direct rendering in Xorg. DRM works properly for the following drivers:
- 3dfx
- Intel
- Matrox
- Rage128
- Radeon
- Mach64
- Sis300
- Via
See the DRI homepage for more information and documentation.
Feedback
2. Install Xorg and configure the kernel
Install Xorg
Please read our Xorg Configuration Guide to configure and run Xorg.
Configure your Kernel
Detect your chipset and only enable this chipset
Code 2.1: Check your AGP chipset |
# Emerge pciutils; lspci | grep AGP. 0 PCI Bridge: Intel Corp. 440bx/ZX/DX-rj43bx/ZX/dx AGP bridge (Rev 03) (because of hardware differences, your output may be different from the above .) |
If your chipset is not supported by the kernel, you may be able to add the AGP = try_unsupported parameter to the kernel. This will use intel's general functions to act as the support for AGP. To add this parameter, modify your boot program configuration file!
Most, if not all, the kernel should have these options. The configuration here uses a standard Gentoo-sources kernel.
Code 2.2: configure the kernel |
# Ls-L/usr/src/Linux lrwxrwxrwx 1 Root 22/usr/src/Linux-> linux-2.6.18-gentoo-r4 (make sure the/usr/src/Linux connection points to your current Kernel .) # Cd/usr/src/Linux # Make menuconfig |
Code 2.3: Make menuconfig Option |
Processor type and features ---> <*> mtrr (memory type range register) supportdevice drivers ---> graphic support ---> <m>/dev/agpgart (AGP Support) ---> (the agpgart option does not exist in the 64-bit kernel. You only need to select your chipset support .) <M> intel systlx/BX/GX, i8xx and e7x05 support (enable your chipset instead of copying the above example .) <M> direct rendering Manager (xfree86 4.1.0 and higher dri Support) ---> <m> (select your video card from the list) |
Compile and install the kernel
Code 2.4: Compile and install the kernel |
# make && make modules_install |
Do not forget to set grub. conf or Lilo. conf and run/sbin/lilo if you use Lilo.
3. Configure direct Rendering
Configure Xorg. conf
Open/etc/X11/Xorg. conf in your text editor and edit it to enable dri and Glx.
Sample Code 3.1: Xorg. conf |
... Section "module" LOAD "dri" LOAD "Glx "... endsection... section "device" driver "radeon" (replace radeon with your driver name .) ... Endsection... section "dri" Mode 0666 endsection |
Modules. autoload. d
You need to add the name of the module used by your video card to/etc/modules. autoload. d/kernel-2.6 to ensure that this module can be automatically loaded when the system starts.
Code 3.2: edit/etc/modules. autoload. d/kernel-2.6 |
(Change to your module name) intel-AGP |
Note:If you compile agpgart into a module, you also need to add it to/etc/modules. autoload. d/kernel-2.6. |
4. Test 3D Acceleration
Restart to use the new kernel
Restart your computer to use your new kernel and Log On As a normal user. It's time to see if your direct rendering has been enabled and how powerful it is. Glxinfo and glxgears are part of the Mesa-progs package, so make sure they are installed before running these two commands.
Code 4.1: Test Rendering |
$ Startx (you do not need to load your driver's modules or agpgart, even if you compile them into modules .) (They will be automatically loaded .) $ Glxinfo | grep renderingdirect rendering: Yes (if "no" is displayed here, you do not have 3D acceleration .) $ Glxgears (use the default size window to test your FPS. This number should be much higher than before DRM configuration. Try to test when the CPU is idle .) |
Note:FPS may be limited by the update rate of your screen. Do not forget this if glxgears only displays FPS between and. Games-FPS/ut2004-demo or other 3D games are better testing tools that give you real-world performance results. |
Get the highest performance of direct Rendering
If you want to set more features for higher performance and other reasons, check the feature matrix on the DRI Web page or the feature list on SourceForge.