| 1 |
<?xml version="1.0" encoding="UTF-8"?>
|
| 2 |
<!DOCTYPE guide SYSTEM "/dtd/guide.dtd">
|
| 3 |
<!-- $Header: /var/cvsroot/gentoo/xml/htdocs/doc/en/dri-howto.xml,v 1.45 2009/12/14 21:26:40 nightmorph Exp $ -->
|
| 4 |
|
| 5 |
<guide>
|
| 6 |
<title>Hardware 3D Acceleration Guide</title>
|
| 7 |
|
| 8 |
<author title="Author">
|
| 9 |
<mail link="dberkholz"/>
|
| 10 |
</author>
|
| 11 |
<author title="Editor">
|
| 12 |
<mail link="peesh"/>
|
| 13 |
</author>
|
| 14 |
<author title="Editor">
|
| 15 |
<mail link="nightmorph"/>
|
| 16 |
</author>
|
| 17 |
|
| 18 |
<abstract>
|
| 19 |
This document is a guide to getting 3D acceleration working using the DRM with
|
| 20 |
Xorg in Gentoo Linux.
|
| 21 |
</abstract>
|
| 22 |
|
| 23 |
<!-- The content of this document is licensed under the CC-BY-SA license -->
|
| 24 |
<!-- See http://creativecommons.org/licenses/by-sa/2.5 -->
|
| 25 |
<license/>
|
| 26 |
|
| 27 |
<version>2</version>
|
| 28 |
<date>2011-03-01</date>
|
| 29 |
|
| 30 |
<chapter>
|
| 31 |
<title>Introduction</title>
|
| 32 |
<section>
|
| 33 |
<title>What is hardware 3D acceleration and why do I want it?</title>
|
| 34 |
<body>
|
| 35 |
|
| 36 |
<p>
|
| 37 |
With hardware 3D acceleration, three-dimensional rendering uses the graphics
|
| 38 |
processor on your video card instead of taking up valuable CPU resources
|
| 39 |
drawing 3D images. It's also referred to as "hardware acceleration" instead of
|
| 40 |
"software acceleration" because without this 3D acceleration your CPU is forced
|
| 41 |
to draw everything itself using the Mesa software rendering libraries, which
|
| 42 |
takes up quite a bit of processing power. While Xorg typically supports 2D
|
| 43 |
hardware acceleration, it often lacks hardware 3D acceleration.
|
| 44 |
Three-dimensional hardware acceleration is valuable in situations requiring
|
| 45 |
rendering of 3D objects such as games, 3D CAD and modeling.
|
| 46 |
</p>
|
| 47 |
|
| 48 |
</body>
|
| 49 |
</section>
|
| 50 |
<section>
|
| 51 |
<title>How do I get hardware 3D acceleration?</title>
|
| 52 |
<body>
|
| 53 |
|
| 54 |
<p>
|
| 55 |
In many cases, both binary and open-source drivers exist. Open source drivers
|
| 56 |
are preferable since we're using Linux and open source is one of its underlying
|
| 57 |
principles. Sometimes, binary drivers are the only option, especially if your
|
| 58 |
graphics card is so new that open source drivers have not yet been written to
|
| 59 |
support its features. Binary drivers include <c>x11-drivers/nvidia-drivers</c>
|
| 60 |
for nVidia cards and <c>x11-drivers/ati-drivers</c> for AMD/ATI cards.
|
| 61 |
</p>
|
| 62 |
|
| 63 |
</body>
|
| 64 |
</section>
|
| 65 |
<section>
|
| 66 |
<title>What is DRI?</title>
|
| 67 |
<body>
|
| 68 |
|
| 69 |
<p>
|
| 70 |
The <uri link="http://dri.freedesktop.org/wiki/">Direct Rendering
|
| 71 |
Infrastructure</uri>, also known as the DRI, is a framework for allowing direct
|
| 72 |
access to graphics hardware in a safe and efficient manner. It includes changes
|
| 73 |
to the X server, to several client libraries and to the kernel. The first major
|
| 74 |
use for the DRI is to create fast OpenGL implementations.
|
| 75 |
</p>
|
| 76 |
|
| 77 |
</body>
|
| 78 |
</section>
|
| 79 |
<section>
|
| 80 |
<title>What is the DRM and how does it relate to regular Xorg?</title>
|
| 81 |
<body>
|
| 82 |
|
| 83 |
<p>
|
| 84 |
The DRM (Direct Rendering Manager) is an <e>enhancement</e> to Xorg that adds 3D
|
| 85 |
acceleration for cards by adding the kernel module necessary for direct
|
| 86 |
rendering.
|
| 87 |
</p>
|
| 88 |
|
| 89 |
</body>
|
| 90 |
</section>
|
| 91 |
<section>
|
| 92 |
<title>Purpose</title>
|
| 93 |
<body>
|
| 94 |
|
| 95 |
<p>
|
| 96 |
This guide is for people who can't get direct rendering working with just Xorg.
|
| 97 |
The DRM works for the following drivers:
|
| 98 |
</p>
|
| 99 |
|
| 100 |
<ul>
|
| 101 |
<li>3dfx</li>
|
| 102 |
<li>intel</li>
|
| 103 |
<li>matrox</li>
|
| 104 |
<li>nouveau</li>
|
| 105 |
<li>rage128</li>
|
| 106 |
<li>radeon</li>
|
| 107 |
<li>mach64</li>
|
| 108 |
<li>sis300</li>
|
| 109 |
<li>via</li>
|
| 110 |
</ul>
|
| 111 |
|
| 112 |
<p>
|
| 113 |
See the <uri link="http://dri.freedesktop.org/">DRI homepage</uri> for more info
|
| 114 |
and documentation.
|
| 115 |
</p>
|
| 116 |
|
| 117 |
</body>
|
| 118 |
</section>
|
| 119 |
</chapter>
|
| 120 |
|
| 121 |
<chapter>
|
| 122 |
<title>Install Xorg and configure your kernel</title>
|
| 123 |
<section>
|
| 124 |
<title>Install Xorg</title>
|
| 125 |
<body>
|
| 126 |
|
| 127 |
<p>
|
| 128 |
Please read our <uri link="/doc/en/xorg-config.xml">Xorg Configuration
|
| 129 |
Guide</uri> to get Xorg up and running.
|
| 130 |
</p>
|
| 131 |
|
| 132 |
</body>
|
| 133 |
</section>
|
| 134 |
<section>
|
| 135 |
<title>Configure your kernel</title>
|
| 136 |
<body>
|
| 137 |
|
| 138 |
<p>
|
| 139 |
Probe for your chipset and enable just that one.
|
| 140 |
</p>
|
| 141 |
|
| 142 |
<pre caption="Checking your AGP chipset">
|
| 143 |
# <i>emerge pciutils; lspci | grep AGP</i>
|
| 144 |
# <i>00:01.0 PCI bridge: Intel Corp. 440BX/ZX/DX - 82443BX/ZX/DX AGP bridge (rev 03)</i>
|
| 145 |
<comment>(Your output may not match the above due to different hardware.)</comment>
|
| 146 |
</pre>
|
| 147 |
|
| 148 |
<p>
|
| 149 |
If your chipset is not supported by the kernel you might have some succes by
|
| 150 |
passing <c>agp=try_unsupported</c> as a kernel parameter. This will use Intel's
|
| 151 |
generic routines for AGP support. To add this parameter, edit your bootloader
|
| 152 |
configuration file!
|
| 153 |
</p>
|
| 154 |
|
| 155 |
<p>
|
| 156 |
Most, if not all, kernels should have these options. This was configured using a
|
| 157 |
standard <c>gentoo-sources</c> kernel.
|
| 158 |
</p>
|
| 159 |
|
| 160 |
<pre caption="Configuring the kernel">
|
| 161 |
# <i>ls -l /usr/src/linux </i>
|
| 162 |
lrwxrwxrwx 1 root root 22 2007-02-14 20:12 /usr/src/linux -> linux-2.6.18-gentoo-r4
|
| 163 |
<comment>(Make sure /usr/src/linux links to your current kernel.)</comment>
|
| 164 |
# <i>cd /usr/src/linux</i>
|
| 165 |
# <i>make menuconfig</i>
|
| 166 |
</pre>
|
| 167 |
|
| 168 |
<pre caption="make menuconfig options">
|
| 169 |
Processor type and features --->
|
| 170 |
<*> MTRR (Memory Type Range Register) support
|
| 171 |
Device drivers --->
|
| 172 |
Graphics support --->
|
| 173 |
<M> /dev/agpgart (AGP Support) --->
|
| 174 |
<comment>(The agpgart option is not present on 64-bit kernels; just choose your chipset support.)</comment>
|
| 175 |
<M> Intel 440LX/BX/GX, I8xx and E7x05 support
|
| 176 |
<comment>(Enable your chipset instead of the above.)</comment>
|
| 177 |
<M> Direct Rendering Manager (XFree86 4.1.0 and higher DRI support) --->
|
| 178 |
<M> <comment>(Select your graphics card from the list)</comment>
|
| 179 |
</pre>
|
| 180 |
|
| 181 |
</body>
|
| 182 |
</section>
|
| 183 |
<section>
|
| 184 |
<title>Compile and install your kernel</title>
|
| 185 |
<body>
|
| 186 |
|
| 187 |
<pre caption="Compiling and installing kernel">
|
| 188 |
# <i>make && make modules_install</i>
|
| 189 |
</pre>
|
| 190 |
|
| 191 |
<p>
|
| 192 |
Don't forget to set up <path>grub.conf</path> or <path>lilo.conf</path> and run
|
| 193 |
<c>/sbin/lilo</c> if you use LILO.
|
| 194 |
</p>
|
| 195 |
|
| 196 |
</body>
|
| 197 |
</section>
|
| 198 |
</chapter>
|
| 199 |
|
| 200 |
<chapter>
|
| 201 |
<title>Configure direct rendering</title>
|
| 202 |
<section id="configure_xorg">
|
| 203 |
<title>Configure Xorg.conf</title>
|
| 204 |
<body>
|
| 205 |
|
| 206 |
<p>
|
| 207 |
Open <path>/etc/X11/xorg.conf</path> with your favorite text editor and edit
|
| 208 |
it to enable DRI and GLX.
|
| 209 |
</p>
|
| 210 |
|
| 211 |
<pre caption="xorg.conf">
|
| 212 |
...
|
| 213 |
Section "Module"
|
| 214 |
Load "dri"
|
| 215 |
Load "glx"
|
| 216 |
...
|
| 217 |
EndSection
|
| 218 |
...
|
| 219 |
Section "Device"
|
| 220 |
Driver "radeon"
|
| 221 |
<comment>(Replace radeon with the name of your driver.)</comment>
|
| 222 |
...
|
| 223 |
EndSection
|
| 224 |
...
|
| 225 |
Section "dri"
|
| 226 |
Mode 0666
|
| 227 |
EndSection
|
| 228 |
</pre>
|
| 229 |
|
| 230 |
</body>
|
| 231 |
</section>
|
| 232 |
<section>
|
| 233 |
<title>Changes to modules.autoload.d</title>
|
| 234 |
<body>
|
| 235 |
|
| 236 |
<p>
|
| 237 |
You will need to add the module name that your card uses to
|
| 238 |
<path>/etc/modules.autoload.d/kernel-2.6</path> to ensure that the module is
|
| 239 |
loaded automatically when the system starts up.
|
| 240 |
</p>
|
| 241 |
|
| 242 |
<pre caption="Editing /etc/modules.autoload.d/kernel-2.6">
|
| 243 |
<comment>(Change module name as required.)</comment>
|
| 244 |
intel-agp
|
| 245 |
</pre>
|
| 246 |
|
| 247 |
<note>
|
| 248 |
If you compiled <c>agpgart</c> as a module, you will also need to add it to
|
| 249 |
<path>/etc/modules.autoload.d/kernel-2.6</path>.
|
| 250 |
</note>
|
| 251 |
|
| 252 |
</body>
|
| 253 |
</section>
|
| 254 |
</chapter>
|
| 255 |
|
| 256 |
<chapter>
|
| 257 |
<title>Test 3D acceleration</title>
|
| 258 |
<section>
|
| 259 |
<title>Reboot to the new kernel</title>
|
| 260 |
<body>
|
| 261 |
|
| 262 |
<p>
|
| 263 |
Reboot your computer to your new kernel and login as a normal user. It's time to
|
| 264 |
see if you have direct rendering and how good it is. <c>glxinfo</c> and
|
| 265 |
<c>glxgears</c> are part of the <c>mesa-progs</c> package, so make sure it is
|
| 266 |
installed before you attempt to run these commands.
|
| 267 |
</p>
|
| 268 |
|
| 269 |
<pre caption="Testing rendering">
|
| 270 |
$ <i>startx</i>
|
| 271 |
<comment>(No need to load modules for your driver or agpgart, even if you compiled them as a module.)</comment>
|
| 272 |
<comment>(They will be loaded automatically.)</comment>
|
| 273 |
$ <i>glxinfo | grep rendering</i>
|
| 274 |
direct rendering: Yes
|
| 275 |
<comment>(If it says "No", you don't have 3D acceleration.)</comment>
|
| 276 |
$ <i>glxgears</i>
|
| 277 |
<comment>(Test your frames per second (FPS) at the default size. The number should be
|
| 278 |
significantly higher than before configuring DRM. Do this while the CPU is as idle as
|
| 279 |
possible.)</comment>
|
| 280 |
</pre>
|
| 281 |
|
| 282 |
<note>
|
| 283 |
FPS may be limited by your screen's refresh rate, so keep this in mind if
|
| 284 |
<c>glxgears</c> reports only about 70-100 FPS. <c>games-fps/ut2004-demo</c> or
|
| 285 |
other 3D games are better benchmarking tools, as they give you real-world
|
| 286 |
performance results.
|
| 287 |
</note>
|
| 288 |
|
| 289 |
</body>
|
| 290 |
</section>
|
| 291 |
<section>
|
| 292 |
<title>Get the most out of direct rendering</title>
|
| 293 |
<body>
|
| 294 |
|
| 295 |
<p>
|
| 296 |
If you want to set more features, for performance or other reasons, check out
|
| 297 |
the <uri link="http://dri.freedesktop.org/wiki/FeatureMatrix">feature
|
| 298 |
matrix</uri> on the DRI web site or the <uri
|
| 299 |
link="http://dri.sourceforge.net/doc/dri_driver_features.phtml">features
|
| 300 |
listing</uri> on Sourceforge.
|
| 301 |
</p>
|
| 302 |
|
| 303 |
</body>
|
| 304 |
</section>
|
| 305 |
</chapter>
|
| 306 |
|
| 307 |
<chapter>
|
| 308 |
<title>Troubleshooting</title>
|
| 309 |
<section>
|
| 310 |
<title>It doesn't work. I don't have rendering, and I can't tell why.</title>
|
| 311 |
<body>
|
| 312 |
|
| 313 |
<p>
|
| 314 |
Try <c>modprobe radeon</c> before you start the X server (replace <c>radeon</c>
|
| 315 |
with the name of your driver). Also, try building agpgart into the kernel
|
| 316 |
instead of as a module.
|
| 317 |
</p>
|
| 318 |
|
| 319 |
</body>
|
| 320 |
</section>
|
| 321 |
<section>
|
| 322 |
<title>When I startx, I get this error: "[drm] failed to load kernel module agpgart"</title>
|
| 323 |
<body>
|
| 324 |
|
| 325 |
<p>
|
| 326 |
That's because you compiled agpgart into the kernel instead of as a module.
|
| 327 |
Ignore it unless you're having problems.
|
| 328 |
</p>
|
| 329 |
|
| 330 |
</body>
|
| 331 |
</section>
|
| 332 |
<section>
|
| 333 |
<title>I have a Radeon, and I want TV-Out.</title>
|
| 334 |
<body>
|
| 335 |
|
| 336 |
<p>
|
| 337 |
The drivers originally developed by the <uri
|
| 338 |
link="http://gatos.sf.net">GATOS</uri> project have been merged into Xorg's
|
| 339 |
codebase. You don't need anything special for TV-Out;
|
| 340 |
<c>x11-drivers/xf86-video-ati</c> will work just fine.
|
| 341 |
</p>
|
| 342 |
|
| 343 |
</body>
|
| 344 |
</section>
|
| 345 |
<section>
|
| 346 |
<title>
|
| 347 |
It doesn't work. My card is so incredibly new and cool that it isn't supported
|
| 348 |
at all.
|
| 349 |
</title>
|
| 350 |
<body>
|
| 351 |
|
| 352 |
<p>
|
| 353 |
Try out the binary drivers. For AMD cards, use <c>ati-drivers</c>; a listing is
|
| 354 |
at <uri>http://support.amd.com/us/gpudownload/Pages/index.aspx</uri>. If those
|
| 355 |
don't support it, use fbdev. It's slow, but it works.
|
| 356 |
</p>
|
| 357 |
|
| 358 |
</body>
|
| 359 |
</section>
|
| 360 |
<section>
|
| 361 |
<title>I have a PCI card and it doesn't work. Help!</title>
|
| 362 |
<body>
|
| 363 |
|
| 364 |
<p>
|
| 365 |
Edit <path>/etc/X11/xorg.conf</path>. In section "Device" enable ForcePCIMode.
|
| 366 |
</p>
|
| 367 |
|
| 368 |
<pre caption="Enabling ForcePCIMode">
|
| 369 |
Option "ForcePCIMode" "True"
|
| 370 |
</pre>
|
| 371 |
|
| 372 |
</body>
|
| 373 |
</section>
|
| 374 |
</chapter>
|
| 375 |
|
| 376 |
<chapter>
|
| 377 |
<title>References</title>
|
| 378 |
<section>
|
| 379 |
<body>
|
| 380 |
|
| 381 |
<ol>
|
| 382 |
<li><uri>http://forums.gentoo.org/viewtopic.php?t=46681</uri></li>
|
| 383 |
<li><uri>http://forums.gentoo.org/viewtopic.php?t=29264</uri></li>
|
| 384 |
<li><uri>http://dri.freedesktop.org/</uri></li>
|
| 385 |
<li><uri>http://www.retinalburn.net/linux/dri_status.html</uri></li>
|
| 386 |
</ol>
|
| 387 |
|
| 388 |
</body>
|
| 389 |
</section>
|
| 390 |
<section>
|
| 391 |
<title>Feedback</title>
|
| 392 |
<body>
|
| 393 |
|
| 394 |
<p>
|
| 395 |
With suggestions, questions, etc., e-mail <mail link="dberkholz"/>.
|
| 396 |
</p>
|
| 397 |
|
| 398 |
</body>
|
| 399 |
</section>
|
| 400 |
</chapter>
|
| 401 |
</guide>
|