/[gentoo]/xml/htdocs/doc/en/dri-howto.xml
Gentoo

Contents of /xml/htdocs/doc/en/dri-howto.xml

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.38 - (show annotations) (download) (as text)
Thu Apr 26 03:45:02 2007 UTC (7 years, 3 months ago) by nightmorph
Branch: MAIN
Changes since 1.37: +7 -5 lines
File MIME type: application/xml
added mesa-progs, bug 176062

1 <?xml version="1.0" encoding="UTF-8"?>
2 <!-- $Header: /var/cvsroot/gentoo/xml/htdocs/doc/en/dri-howto.xml,v 1.37 2007/02/18 23:44:24 nightmorph Exp $ -->
3 <!DOCTYPE guide SYSTEM "/dtd/guide.dtd">
4
5 <guide link="/doc/en/dri-howto.xml">
6
7 <title>Hardware 3D Acceleration Guide</title>
8
9 <author title="Author">
10 <mail link="dberkholz@gentoo.org">Donnie Berkholz</mail>
11 </author>
12 <author title="Editor">
13 <mail link="peesh@gentoo.org">Jorge Paulo</mail>
14 </author>
15 <author title="Editor">
16 <mail link="nightmorph@gentoo.org">Joshua Saddler</mail>
17 </author>
18
19 <abstract>
20 This document is a guide to getting 3D acceleration working using the DRM with
21 Xorg in Gentoo Linux.
22 </abstract>
23
24 <!-- The content of this document is licensed under the CC-BY-SA license -->
25 <!-- See http://creativecommons.org/licenses/by-sa/2.5 -->
26 <license/>
27
28 <version>1.8</version>
29 <date>2007-04-25</date>
30
31 <chapter>
32 <title>Introduction</title>
33 <section>
34 <title>What is hardware 3D acceleration and why do I want it?</title>
35 <body>
36
37 <p>
38 With hardware 3D acceleration, three-dimensional rendering uses the graphics
39 processor on your video card instead of taking up valuable CPU resources
40 drawing 3D images. It's also referred to as "hardware acceleration" instead of
41 "software acceleration" because without this 3D acceleration your CPU is forced
42 to draw everything itself using the Mesa software rendering libraries, which
43 takes up quite a bit of processing power. While Xorg typically supports 2D
44 hardware acceleration, it often lacks hardware 3D acceleration.
45 Three-dimensional hardware acceleration is valuable in situations requiring
46 rendering of 3D objects such as games, 3D CAD and modeling.
47 </p>
48
49 </body>
50 </section>
51 <section>
52 <title>How do I get hardware 3D acceleration?</title>
53 <body>
54
55 <p>
56 In many cases, both binary and open-source drivers exist. Open-source drivers
57 are preferable since we're using Linux and open source is one of its underlying
58 principles. Sometimes, binary drivers are the only option, like with nVidia's
59 cards. Binary drivers include <c>x11-drivers/nvidia-drivers</c> and
60 <c>x11-drivers/nvidia-legacy-drivers</c> for nVidia cards and
61 <c>x11-drivers/ati-drivers</c> for ATI cards. Other open-source drivers include
62 <c>media-video/ati-gatos</c> for ATI cards, which aims to support ATI's video
63 capabilities more fully.
64 </p>
65
66 </body>
67 </section>
68 <section>
69 <title>What is DRI?</title>
70 <body>
71
72 <p>
73 The <uri link="http://dri.freedesktop.org/wiki/">Direct Rendering
74 Infrastructure</uri>, also known as the DRI, is a framework for allowing direct
75 access to graphics hardware in a safe and efficient manner. It includes changes
76 to the X server, to several client libraries and to the kernel. The first major
77 use for the DRI is to create fast OpenGL implementations.
78 </p>
79
80 </body>
81 </section>
82 <section>
83 <title>What is the DRM and how does it relate to regular Xorg?</title>
84 <body>
85
86 <p>
87 The DRM (Direct Rendering Manager) is an <e>enhancement</e> to Xorg that adds 3D
88 acceleration for cards by adding the kernel module necessary for direct
89 rendering.
90 </p>
91
92 </body>
93 </section>
94 <section>
95 <title>Purpose</title>
96 <body>
97
98 <p>
99 This guide is for people who can't get direct rendering working with just Xorg.
100 The DRM works for the following drivers:
101 </p>
102
103 <ul>
104 <li>3dfx</li>
105 <li>i8x0</li>
106 <li>matrox</li>
107 <li>rage128</li>
108 <li>radeon</li>
109 <li>mach64</li>
110 <li>sis300</li>
111 <li>via</li>
112 </ul>
113
114 <p>
115 See the <uri link="http://dri.freedesktop.org/">DRI homepage</uri> for more info
116 and documentation.
117 </p>
118
119 </body>
120 </section>
121 <section>
122 <title>Feedback</title>
123 <body>
124
125 <p>
126 With suggestions, questions, etc., e-mail <mail
127 link="dberkholz@gentoo.org">Donnie Berkholz</mail>.
128 </p>
129
130 </body>
131 </section>
132 </chapter>
133
134 <chapter>
135 <title>Install Xorg and configure your kernel</title>
136 <section>
137 <title>Install Xorg</title>
138 <body>
139
140 <p>
141 Please read our <uri link="/doc/en/xorg-config.xml">Xorg Configuration
142 Guide</uri> to get Xorg up and running.
143 </p>
144
145 </body>
146 </section>
147 <section>
148 <title>Configure your kernel</title>
149 <body>
150
151 <p>
152 Probe for your chipset and enable just that one.
153 </p>
154
155 <pre caption="Checking your AGP chipset">
156 # <i>emerge pciutils; lspci | grep AGP</i>
157 # <i>00:01.0 PCI bridge: Intel Corp. 440BX/ZX/DX - 82443BX/ZX/DX AGP bridge (rev 03)</i>
158 <comment>(Your output may not match the above due to different hardware.)</comment>
159 </pre>
160
161 <p>
162 If your chipset is not supported by the kernel you might have some succes by
163 passing <c>agp=try_unsupported</c> as a kernel parameter. This will use Intel's
164 generic routines for AGP support. To add this parameter, edit your bootloader
165 configuration file!
166 </p>
167
168 <p>
169 Most, if not all, kernels should have these options. This was configured using a
170 standard <c>gentoo-sources</c> kernel.
171 </p>
172
173 <pre caption="Configuring the kernel">
174 # <i>ls -l /usr/src/linux </i>
175 lrwxrwxrwx 1 root root 22 2007-02-14 20:12 /usr/src/linux -> linux-2.6.18-gentoo-r4
176 <comment>(Make sure /usr/src/linux links to your current kernel.)</comment>
177 # <i>cd /usr/src/linux</i>
178 # <i>make menuconfig</i>
179 </pre>
180
181 <pre caption="make menuconfig options">
182 Processor type and features --->
183 &lt;*&gt; MTRR (Memory Type Range Register) support
184 Device drivers --->
185 Character devices --->
186 &lt;M&gt; /dev/agpgart (AGP Support)
187 <comment>(The agpgart option is not present on 64-bit kernels; just choose your chipset support.)</comment>
188 &lt;M&gt; Intel 440LX/BX/GX, I8xx and E7x05 support
189 <comment>(Enable your chipset instead of the above.)</comment>
190 &lt;M&gt; Direct Rendering Manager (XFree86 4.1.0 and higher DRI support)
191 </pre>
192
193 </body>
194 </section>
195 <section>
196 <title>Compile and install your kernel</title>
197 <body>
198
199 <pre caption="Compiling and installing kernel">
200 # <i>make &amp;&amp; make modules_install</i>
201 </pre>
202
203 <p>
204 Don't forget to set up <path>grub.conf</path> or <path>lilo.conf</path> and run
205 <c>/sbin/lilo</c> if you use LILO.
206 </p>
207
208 </body>
209 </section>
210 </chapter>
211
212 <chapter>
213 <title>Configure direct rendering</title>
214 <section id="configure_xorg">
215 <title>Configure Xorg.conf</title>
216 <body>
217
218 <p>
219 Open <path>/etc/X11/xorg.conf</path> with your favorite text editor and edit
220 it to enable DRI and GLX.
221 </p>
222
223 <pre caption="xorg.conf">
224 ...
225 Section "Module"
226 Load "dri"
227 Load "glx"
228 ...
229 EndSection
230 ...
231 Section "Device"
232 Driver "radeon"
233 <comment>(Replace radeon with the name of your driver.)</comment>
234 ...
235 EndSection
236 ...
237 Section "dri"
238 Mode 0666
239 EndSection
240 </pre>
241
242 </body>
243 </section>
244 <section>
245 <title>Changes to modules.autoload.d</title>
246 <body>
247
248 <p>
249 You will need to add the module name that your card uses to
250 <path>/etc/modules.autoload.d/kernel-2.6</path> to ensure that the module is
251 loaded automatically when the system starts up.
252 </p>
253
254 <pre caption="Editing /etc/modules.autoload.d/kernel-2.6">
255 <comment>(Change module name as required.)</comment>
256 intel-agp
257 </pre>
258
259 <note>
260 If you compiled <c>agpgart</c> as a module, you will also need to add it to
261 <path>/etc/modules.autoload.d/kernel-2.6</path>.
262 </note>
263
264 </body>
265 </section>
266 </chapter>
267
268 <chapter>
269 <title>Test 3D acceleration</title>
270 <section>
271 <title>Reboot to the new kernel</title>
272 <body>
273
274 <p>
275 Reboot your computer to your new kernel and login as a normal user. It's time to
276 see if you have direct rendering and how good it is. <c>glxinfo</c> and
277 <c>glxgears</c> are part of the <c>mesa-progs</c> package, so make sure it is
278 installed before you attempt to run these commands.
279 </p>
280
281 <pre caption="Testing rendering">
282 $ <i>startx</i>
283 <comment>(No need to load modules for your driver or agpgart, even if you compiled them as a module.)</comment>
284 <comment>(They will be loaded automatically.)</comment>
285 $ <i>glxinfo | grep rendering</i>
286 direct rendering: Yes
287 <comment>(If it says "No", you don't have 3D acceleration.)</comment>
288 $ <i>glxgears</i>
289 <comment>(Test your frames per second (FPS) at the default size. The number should be
290 significantly higher than before configuring DRM. Do this while the CPU is as idle as
291 possible.)</comment>
292 </pre>
293
294 <note>
295 FPS may be limited by your screen's refresh rate, so keep this in mind if
296 <c>glxgears</c> reports only about 70-100 FPS. <c>games-fps/ut2004-demo</c> is a
297 better benchmarking tool, as it can give you real-world performance results.
298 </note>
299
300 </body>
301 </section>
302 </chapter>
303
304 <chapter>
305 <title>Tweak your performance</title>
306 <section>
307 <title>Get the most out of direct rendering</title>
308 <body>
309
310 <p>
311 A few options may increase performance by up to 30 percent (or more) over the
312 default. Set them in <path>/etc/X11/xorg.conf</path>. However, you will first
313 need to check that your motherboard and video card support these options.
314 </p>
315
316 <p>
317 First, let's see if your video card can support fast writes. We'll do this by
318 closely inspecting the output from <c>lspci</c>. Specifically, we are looking
319 at the "VGA compatible controller" information.
320 </p>
321
322 <pre caption="Video card check">
323 # <i>lspci -vv</i>
324 01:00.0 VGA compatible controller: ATI Technologies Inc Radeon Mobility M6 LY (prog-if 00 [VGA])
325 . . .
326 Capabilities: [58] AGP version 2.0
327 Status: RQ=48 Iso- ArqSz=0 Cal=0 SBA+ ITACoh- GART64- HTrans- 64bit- FW+ AGP3- Rate=x1,x2,x4
328 </pre>
329
330 <p>
331 While quite a lot of information is produced, we are looking for <b>FW</b> in
332 the "Status" subsection of the AGP "Capabilities" section. If <b>FW+</b> is
333 present in the "Status" line, it means the card supports fast writes. We can
334 now check if the motherboard supports fast writes.
335 </p>
336
337 <impo>
338 If you do not see <b>FW+</b>, but instead see <b>FW-</b>, you cannot enable
339 fast writes in <path>xorg.conf</path>. Your card does not support fast writes.
340 </impo>
341
342 <p>
343 Now let's make sure the motherboard supports fast writes as well. This time,
344 look at the "Host bridge" section of your <c>lspci</c> output.
345 </p>
346
347 <pre caption="Motherboard check">
348 # <i>lspci -vv</i>
349 00:00.0 Host bridge: Intel Corporation 82830 830 Chipset Host Bridge (rev 02)
350 . . .
351 Capabilities: [a0] AGP version 2.0
352 Status: RQ=32 Iso- ArqSz=0 Cal=0 SBA+ ITACoh- GART64- HTrans- 64bit- FW+ AGP3- Rate=x1,x2,x4
353 </pre>
354
355 <p>
356 Again, examine the "Status" subsection of your AGP "Capabilities" section. Look
357 for <b>FW</b>. If you see <b>FW+</b>, your motherboard supports fast writes.
358 </p>
359
360 <impo>
361 Remember, both your video card information and your motherboard information
362 must show the same <b>FW</b> capability. If either device shows <b>FW-</b> in
363 "Status", you cannot enable fast writes in <path>xorg.conf</path>.
364 </impo>
365
366 <p>
367 Assuming that all has gone well and both your motherboard and video card
368 support fast writes, let's enable this option in
369 <path>/etc/X11/xorg.conf</path> and get the best performance out of your
370 hardware.
371 </p>
372
373 <pre caption="xorg.conf">
374 Section "Device"
375 Option "AGPMode" "4"
376 <comment>(This increased FPS from 609 to 618.)</comment>
377 Option "AGPFastWrite" "True"
378 <comment>(This had no measurable effect, but it may increase instability of your computer.)</comment>
379 <comment>(You may also need to set it in your BIOS.)</comment>
380 Option "EnablePageFlip" "True"
381 <comment>(This improved FPS from 618 to 702. It also is "risky" but few people have reported problems.)</comment>
382 ...
383 EndSection
384 </pre>
385
386 <warn>
387 Enabling <c>AGPFastWrite</c> on a VIA chipset will very likely cause your
388 machine to lock up. VIA chipsets do not play nicely with fast writes, so use
389 this setting at your own risk.
390 </warn>
391
392 <note>
393 Remember, if you want fast writes to work properly, you will have to first
394 enable the appropriate option in your BIOS.
395 </note>
396
397 <p>
398 If you want to set even more features, check out the <uri
399 link="http://dri.freedesktop.org/wiki/FeatureMatrix">feature matrix</uri> on
400 the DRI web site or the <uri
401 link="http://dri.sourceforge.net/doc/dri_driver_features.phtml">features
402 listing</uri> on Sourceforge.
403 </p>
404
405 </body>
406 </section>
407 </chapter>
408
409 <chapter>
410 <title>Troubleshooting</title>
411 <section>
412 <title>It doesn't work. I don't have rendering, and I can't tell why.</title>
413 <body>
414
415 <p>
416 Try <c>modprobe radeon</c> before you start the X server (replace <c>radeon</c>
417 with the name of your driver). Also, try building agpgart into the kernel
418 instead of as a module.
419 </p>
420
421 </body>
422 </section>
423 <section>
424 <title>When I startx, I get this error: "[drm] failed to load kernel module agpgart"</title>
425 <body>
426
427 <p>
428 That's because you compiled agpgart into the kernel instead of as a module.
429 Ignore it unless you're having problems.
430 </p>
431
432 </body>
433 </section>
434 <section>
435 <title>I have a Radeon, and I want TV-Out.</title>
436 <body>
437
438 <p>
439 Check out <c>ati-gatos</c> drivers. <c>emerge -av ati-gatos</c>.
440 </p>
441
442 </body>
443 </section>
444 <section>
445 <title>
446 It doesn't work. My card is so incredibly new and cool that it isn't supported
447 at all.
448 </title>
449 <body>
450
451 <p>
452 Try out the binary drivers. For <c>ati-drivers</c>, a listing is at
453 <uri>http://ati.amd.com/support/drivers/linux/linux-radeon.html</uri> (for x86)
454 and at <uri>http://ati.amd.com/support/drivers/linux64/linux64-radeon.html</uri>
455 (for amd64). If those don't support it, use fbdev. It's slow, but it works.
456 </p>
457
458 </body>
459 </section>
460 <section>
461 <title>I have a PCI card and it doesn't work. Help!</title>
462 <body>
463
464 <p>
465 Edit <path>/etc/X11/xorg.conf</path>. In section "Device" enable ForcePCIMode.
466 </p>
467
468 <pre caption="Enabling ForcePCIMode">
469 Option "ForcePCIMode" "True"
470 </pre>
471
472 </body>
473 </section>
474 </chapter>
475
476 <chapter>
477 <title>Acknowledgments</title>
478 <section>
479 <body>
480
481 <ol>
482 <li>
483 Christopher Webber for suggesting a troubleshooting question about changing
484 or recompiling kernels
485 </li>
486 <li>
487 Steve, for suggesting consistency between the cases of dri and DRI in
488 XF86Config
489 </li>
490 </ol>
491
492 </body>
493 </section>
494 </chapter>
495
496 <chapter>
497 <title>References</title>
498 <section>
499 <body>
500
501 <ol>
502 <li><uri>http://forums.gentoo.org/viewtopic.php?t=46681</uri></li>
503 <li><uri>http://forums.gentoo.org/viewtopic.php?t=29264</uri></li>
504 <li><uri>http://dri.freedesktop.org/</uri></li>
505 <li><uri>http://www.retinalburn.net/linux/dri_status.html</uri></li>
506 </ol>
507
508 </body>
509 </section>
510 </chapter>
511 </guide>

  ViewVC Help
Powered by ViewVC 1.1.20