Xorg/Hardware 3D acceleration guide/zh-cn

This document is Article description::a guide to getting 3D acceleration working using the DRM with Xorg in Gentoo.

What is hardware 3D acceleration and why do I want it?
With hardware 3D acceleration, three-dimensional rendering uses the graphics processor on the 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 the 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.

Getting 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 the graphics card is so new that open source drivers have not yet been written to support its features. Binary drivers include for nVidia cards and  (used to be ) for older AMD/ATI cards,  for newer AMD 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.

Purpose
This guide is for people who can't get direct rendering working with just Xorg. The DRM works for the following drivers:


 * 3dfx
 * amdgpu
 * amdgpu-pro (closed source)
 * fglrx (closed source; deprecated)
 * intel
 * matrox
 * nouveau
 * nvidia-drivers (closed source)
 * rage128
 * radeon
 * radeonhd (deprecated)
 * mach64
 * sis300
 * via

See the DRI homepage for more info and documentation.

Install Xorg
Please read our Xorg Configuration Guide to get Xorg up and running.

Configure the kernel
Probe for the chipset and enable just that one.

The output may not match the above due to different hardware.

If the chipset is not supported by the kernel, some success may be obtained by passing  as a kernel parameter. This will use Intel's generic routines for AGP support. To add this parameter, edit the bootloader's configuration file.

Most, if not all, kernels should have these options. This was configured using a standard kernel.

Make sure links to the current kernel:

OR

Compile and install the kernel
Don't forget to set up or.

When using LILO, issue:

When using GRUB 2, run:

Add appropriate user(s) to the video group
Next, add the appropriate user(s) to the video group:

Configure Xorg
Hopefully just adding the appropriate user to the  group is sufficient to enable direct rendering. However, Xorg may need some additional configuration via the directory. New configuration files created in this directory may be named any alpha-numeric file name, as long as the file suffix ends in. Open up a favorite text editor and create a file with this inside it:

Replace  with the name of the appropriate driver.

Changes to automatic module loading
You will need to add the module name that your card uses to to ensure that the module is loaded automatically when the system starts up.

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. and  are part of the  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.

If it outputs "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.

Get the most out of direct rendering
If you want to set more features, for performance or other reasons, check out the feature matrix on the DRI web site or the features listing on Sourceforge.

Problem with rendering
Try  before you start the X server (replace   with the name of your driver). Also, try building agpgart into the kernel instead of as a module.

Failed to load kernel module agpgart when running startx
error: "[drm] failed to load kernel module agpgart" after invoking `startx` is caused by presents of compiled agpgart in the kernel instead of as a module. Ignore it unless you're having problems.

TV-Out on Radeon GPU
The drivers originally developed by the GATOS project have been merged into Xorg's codebase. You don't need anything special for TV-Out; will work just fine.

Compatibility for freshly released GPUs
Try out the binary drivers. For AMD cards, use. If those don't support it, use fbdev. It's slow, but it works.

PCI card doesn't work properly
Create a config file in ; name it anything you want as long as it ends in. Add the following to it:

External resources

 * Direct rendering (DRI) using X11-DRM HOWTO on the Gentoo forums
 * Radeon 7000-9700 DRI CVS Install Guide on the Gentoo forums
 * https://dri.freedesktop.org/