/[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.36 - (show annotations) (download) (as text)
Tue Oct 10 09:36:49 2006 UTC (7 years, 9 months ago) by neysx
Branch: MAIN
Changes since 1.35: +3 -3 lines
File MIME type: application/xml
#150708 Bump for "Removed media-video/mgavideo"

1 <?xml version="1.0" encoding="UTF-8"?>
2 <!-- $Header: /var/cvsroot/gentoo/xml/htdocs/doc/en/dri-howto.xml,v 1.35 2006/10/10 09:35:25 neysx 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
16 <abstract>
17 This document is a guide to getting 3D acceleration working using X11-DRM
18 with Xorg in Gentoo Linux.
19 </abstract>
20
21 <!-- The content of this document is licensed under the CC-BY-SA license -->
22 <!-- See http://creativecommons.org/licenses/by-sa/2.5 -->
23 <license/>
24
25 <version>1.6</version>
26 <date>2006-10-10</date>
27
28 <chapter>
29 <title>Introduction</title>
30 <section>
31 <title>What is hardware 3D acceleration and why do I want it?</title>
32 <body>
33
34 <p>
35 With hardware 3D acceleration, three-dimensional rendering uses the graphics
36 processor on your video card instead of taking up valuable CPU resources
37 drawing 3D images. It's also referred to as "hardware acceleration" instead of
38 "software acceleration" because without this 3D acceleration your CPU is forced
39 to draw everything itself using the Mesa software rendering libraries, which
40 takes up quite a bit of processing power. While Xorg typically supports 2D
41 hardware acceleration, it often lacks hardware 3D acceleration.
42 Three-dimensional hardware acceleration is valuable in situations requiring
43 rendering of 3D objects such as games, 3D CAD and modeling.
44 </p>
45
46 </body>
47 </section>
48 <section>
49 <title>How do I get hardware 3D acceleration?</title>
50 <body>
51
52 <p>
53 In many cases, both binary and open-source drivers exist. Open-source drivers
54 are preferable since we're using Linux and open source is one of its underlying
55 principles. Sometimes, binary drivers are the only option, like with nVidia's
56 cards. Binary drivers include x11-drivers/nvidia-drivers and
57 x11-drivers/nvidia-legacy-drivers for nVidia cards and media-video/ati-drivers
58 for ATI cards. Other open-source drivers include media-video/kyro-kernel for
59 KyroII cards and media-video/ati-gatos for ATI cards, which aim to support
60 ATI's video capabilities more fully.
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 X11-DRM and how does it relate to regular Xorg?</title>
81 <body>
82
83 <p>
84 X11-DRM is an <e>enhancement</e> to Xorg that adds 3D acceleration for
85 cards by adding the kernel module necessary for direct rendering.
86 </p>
87
88 </body>
89 </section>
90 <section>
91 <title>Purpose</title>
92 <body>
93
94 <p>
95 This guide is for people who can't get direct rendering working with just Xorg.
96 X11-DRM works for 3dfx, gamma, i8x0, matrox, rage128, radeon, mach64 and sis300
97 series drivers. VIA card owners should not use <c>x11-drm</c>, but should
98 instead use the DRI provided in recent kernels (&gt;2.6.13). See the <uri
99 link="http://dri.freedesktop.org/">DRI homepage</uri> for more info and
100 documentation.
101 </p>
102
103 </body>
104 </section>
105 <section>
106 <title>Feedback</title>
107 <body>
108
109 <p>
110 With suggestions, questions, etc., e-mail <mail
111 link="dberkholz@gentoo.org">Donnie Berkholz</mail>.
112 </p>
113
114 </body>
115 </section>
116 </chapter>
117
118 <chapter>
119 <title>Install Xorg and configure your kernel</title>
120 <section>
121 <title>Install Xorg</title>
122 <body>
123
124 <p>
125 Please read our <uri link="/doc/en/xorg-config.xml">Xorg Configuration
126 Guide</uri> to get Xorg up and running.
127 </p>
128
129 </body>
130 </section>
131 <section>
132 <title>Configure your kernel</title>
133 <body>
134
135 <p>
136 Probe for your chipset and enable just that one.
137 </p>
138
139 <pre caption="Checking your AGP chipset">
140 # <i>emerge pciutils; lspci | grep AGP</i>
141 # <i>00:01.0 PCI bridge: Intel Corp. 440BX/ZX/DX - 82443BX/ZX/DX AGP bridge (rev 03)</i>
142 <comment>(Your output may not match the above due to different hardware.)</comment>
143 </pre>
144
145 <p>
146 If your chipset is not supported by the kernel you might have some succes by
147 passing <c>agp=try_unsupported</c> as a kernel parameter. This will use Intel's
148 generic routines for AGP support. To add this parameter, edit your bootloader
149 configuration file!
150 </p>
151
152 <p>
153 Most, if not all, kernels should have these options. This was configured using
154 gentoo-sources-2.4.20-r5.
155 </p>
156
157 <pre caption="Configuring the kernel">
158 # <i>ls -l /usr/src/linux </i>
159 lrwxrwxrwx 1 root root 22 May 29 18:20 /usr/src/linux -> linux-2.4.20-gentoo-r5
160 <comment>(Make sure /usr/src/linux links to your current kernel.)</comment>
161 # <i>cd /usr/src/linux</i>
162 # <i>make menuconfig</i>
163 </pre>
164
165 <pre caption="make menuconfig options">
166 Processor type and features ---&gt;
167 &lt;*&gt; MTRR (Memory Type Range Register) support
168 Character devices ---&gt;
169 &lt;M&gt; /dev/agpgart (AGP Support)
170 [M] Intel 440LX/BX/GX and I815/I820/I830M/I830MP/I840/I845/I850/I860 support
171 <comment>(Enable your chipset instead of the above.)</comment>
172 &lt; &gt; Direct Rendering Manager (XFree86 4.1.0 and higher DRI support)
173 </pre>
174
175 <p>
176 Make sure the Direct Rendering Manager (DRM) is <e>off</e>.
177 The X11-DRM package will provide its own.
178 </p>
179
180 </body>
181 </section>
182 <section>
183 <title>Compile and install your kernel</title>
184 <body>
185
186 <pre caption="Compiling and installing kernel">
187 <comment>(This example is for a 2.4 kernel)</comment>
188 # <i>make dep &amp;&amp; make clean bzImage modules modules_install</i>
189 # <i>mount /boot</i>
190 # <i>cp arch/i386/boot/bzImage /boot</i>
191 </pre>
192
193 <p>
194 If you want your kernel to be named something other than bzImage, be sure to
195 copy to /boot/yourname instead. Don't forget to set up grub.conf or lilo.conf
196 and run /sbin/lilo if you use LILO.
197 </p>
198
199 </body>
200 </section>
201 </chapter>
202
203 <chapter>
204 <title>Install X11-DRM and configure direct rendering</title>
205 <section>
206 <title>Install X11-DRM</title>
207 <body>
208
209 <pre caption="Installing X11-DRM">
210 # <i>emerge x11-drm</i>
211 </pre>
212
213 </body>
214 </section>
215 <section id="configure_xorg">
216 <title>Configure Xorg.conf</title>
217 <body>
218
219 <p>
220 Some chipsets require you to rebuild <c>xorg-x11</c> with
221 <c>USE="insecure-drivers"</c>. This applies to mach64, unichrome and savage
222 chipsets on xorg-x11-6.8.2, and to mach64 and unichrome on xorg-x11-6.8.99.x.
223 Savage users should not try xorg-x11-6.8.99.x as support for the savage there
224 is broken.
225 </p>
226
227 <pre caption="Rebuilding xorg-x11">
228 <comment>(Add the insecure-drivers USE flag if you use one of the aforementioned chipsets)</comment>
229 # <i>echo "x11-base/xorg-x11 insecure-drivers" &gt;&gt; /etc/portage/package.use</i>
230
231 # <i>emerge xorg-x11</i>
232 </pre>
233
234 <p>
235 Open <path>/etc/X11/xorg.conf</path> with your favorite text editor and edit
236 it to enable DRI and GLX.
237 </p>
238
239 <pre caption="xorg.conf">
240 ...
241 Section "Module"
242 Load "dri"
243 Load "glx"
244 ...
245 EndSection
246 ...
247 Section "Device"
248 Driver "radeon"
249 ...
250 EndSection
251 ...
252 Section "dri"
253 Mode 0666
254 EndSection
255 </pre>
256
257 <p>
258 If you are using a different driver, replace "radeon" with yours.
259 </p>
260
261 </body>
262 </section>
263 <section>
264 <title>Changes to modules.autoload.d</title>
265 <body>
266
267 <p>
268 You will need to add the module name that your card uses to
269 <path>/etc/modules.autoload.d/kernel-2.6</path> to ensure that the module is
270 loaded automatically when the system starts up.
271 </p>
272
273 <pre caption="Editing /etc/modules.autoload.d/kernel-2.6">
274 <comment>(Change module name as required.)</comment>
275 intel-agp
276 </pre>
277
278 <note>
279 If you compiled <c>agpgart</c> as a module, you will also need to add it to
280 <path>/etc/modules.autoload.d/kernel-2.6</path>.
281 </note>
282
283 </body>
284 </section>
285 </chapter>
286
287 <chapter>
288 <title>Test 3D acceleration</title>
289 <section>
290 <title>Reboot to the new kernel</title>
291 <body>
292
293 <p>
294 Reboot your computer to your new kernel and login as a normal user. It's time
295 to see if you have direct rendering and how good it is.
296 </p>
297
298 <pre caption="Testing rendering">
299 $ <i>startx</i>
300 <comment>(No need to load modules for your driver or agpgart, even if you compiled them as a module.)</comment>
301 <comment>(They will be loaded automatically.)</comment>
302 $ <i>glxinfo | grep rendering</i>
303 direct rendering: Yes
304 <comment>(If it says "No", you don't have 3D acceleration.)</comment>
305 $ <i>glxgears</i>
306 <comment>(Test your frames per second (FPS) at the default size. The number should be )</comment>
307 <comment>(significantly higher than before installing x11-drm. Do this while the CPU is as idle as possible.)</comment>
308 </pre>
309
310 </body>
311 </section>
312 </chapter>
313
314 <chapter>
315 <title>Using the CVS sources</title>
316 <section>
317 <body>
318
319 <warn>
320 Don't do this if the package worked.
321 </warn>
322
323 </body>
324 </section>
325 <section>
326 <title>Do you need the CVS?</title>
327 <body>
328
329 <p>
330 First you have to check whether the x11-drm package works. If it doesn't and
331 you have checked your logs to verify it's not a configuration error, you might
332 want to consider the CVS sources. There are also daily driver snapshots
333 available if you do not wish to build the full CVS.
334 </p>
335
336 </body>
337 </section>
338 <section>
339 <title>Do the CVS sources support your card?</title>
340 <body>
341
342 <p>
343 Check the DRI <uri link="http://dri.freedesktop.org/wiki/Status">supported
344 cards list</uri> to see if the CVS supports your card. Even if it doesn't, but
345 it supports a similar card, try it.
346 </p>
347
348 <!-- I see a couple of 8x AGP stuff on the Internet about vanilla 2.4 kernels;
349 is this now available or not? I've commented it out for the time being,
350 hoping that this doesn't affect us :)
351
352 <warn>
353 "Linux 2.4 doesn't support agp 8x, so I had to go find a backport. The backport
354 works .... it doesn't patch quite properly, and it requires 2.4.21 (I've only
355 gotten it to work with vanilla, straight from the tarball (not ebuild)). First
356 go get the 2.4.20-2.4.21 patch from kernel.org .... (then get the patch,) It
357 was on a mailing list somewhere. It doesn't patch cleanly - - one file fails,
358 the pci_ids.h file, but if you actually read the file and the reject list, it's
359 very easy to fix. But it does load, and it gives me 1600x1200 with video
360 (although a bit slow b/c of lack of dga) with xfree-drm." (SanityInAnarchy on
361 #gentoo)
362 </warn>
363
364 <impo>
365 The patch is a little tricky to work with but <uri
366 link="http://www.ussg.iu.edu/hypermail/linux/kernel/0302.2/att-1618/01-agp3.diff.bz2">here's
367 the link</uri>. If you can disable 8X AGP in your BIOS, change it to 4X and you
368 may not need the patch.
369 </impo>
370 -->
371
372 </body>
373 </section>
374 <section>
375 <title>Follow the CVS Instructions</title>
376 <body>
377
378 <p>
379 The DRI project has a document about CVS compiling themselves. Please read <uri
380 link="http://dri.freedesktop.org/wiki/Building">the document</uri> and follow
381 the instructions up to the <e>Installing for X.org</e> part.
382 </p>
383
384 </body>
385 </section>
386 <section>
387 <title>Install the CVS</title>
388 <body>
389
390 <p>
391 Verify that the DRI kernel module(s) for your system were built:
392 </p>
393
394 <pre caption="Verification">
395 # <i>cd ~/DRI-CVS/build/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel; ls</i>
396 </pre>
397
398 <p>
399 For the 3dfx Voodoo, you should see <path>tdfx.o</path>. For the Matrox
400 G200/G400, you should see <path>mga.o</path>. For the ATI Rage 128, you should
401 see <path>r128.o</path>. For the ATI Radeon, you should see
402 <path>radeon.o</path>. For the Intel i810, you should see <path>i810.o</path>.
403 If the DRI kernel module(s) failed to build, you should verify that you're
404 using the right version of the Linux kernel. The most recent kernels are not
405 always supported.
406 </p>
407
408 <p>
409 Install over your X.org installation. You may wish to back up xorg-x11.
410 </p>
411
412 <pre caption="Backing up Xorg">
413 # <i>quickpkg xorg-x11</i>
414 <comment>(This backs up your Xorg-X11 package.)</comment>
415 # <i>make install</i>
416 </pre>
417
418 <p>
419 Follow the "Configure Xorg" section above.
420 </p>
421
422 <p>
423 To load the appropriate DRM module in your running kernel, copy the kernel
424 module to <path>/lib/modules/`uname -r`/kernel/drivers/char/drm/</path> then
425 run <c>modules-update</c> and restart your X server. If you're not running the
426 kernel you'll be using it in, instead of <c>`uname -r`,</c> use that kernel's
427 name.
428 </p>
429
430 <warn>
431 Make sure you first unload any older DRI kernel modules that might be already
432 loaded. Note that some DRM modules require that the agpgart module be loaded
433 first.
434 </warn>
435
436 </body>
437 </section>
438 </chapter>
439
440 <chapter>
441 <title>Tweak your performance</title>
442 <section>
443 <title>Get the most out of direct rendering</title>
444 <body>
445
446 <p>
447 A few options may increase performance by up to 30 percent (or more) over the
448 default. Set them in <path>/etc/X11/xorg.conf</path>. However, you will first
449 need to check that your motherboard and video card support these options.
450 </p>
451
452 <p>
453 First, let's see if your video card can support fast writes. We'll do this by
454 closely inspecting the output from <c>lspci</c>. Specifically, we are looking
455 at the "VGA compatible controller" information.
456 </p>
457
458 <pre caption="Video card check">
459 # <i>lspci -vv</i>
460 01:00.0 VGA compatible controller: ATI Technologies Inc Radeon Mobility M6 LY (prog-if 00 [VGA])
461 . . .
462 Capabilities: [58] AGP version 2.0
463 Status: RQ=48 Iso- ArqSz=0 Cal=0 SBA+ ITACoh- GART64- HTrans- 64bit- FW+ AGP3- Rate=x1,x2,x4
464 </pre>
465
466 <p>
467 While quite a lot of information is produced, we are looking for <b>FW</b> in
468 the "Status" subsection of the AGP "Capabilities" section. If <b>FW+</b> is
469 present in the "Status" line, it means the card supports fast writes. We can
470 now check if the motherboard supports fast writes.
471 </p>
472
473 <impo>
474 If you do not see <b>FW+</b>, but instead see <b>FW-</b>, you cannot enable
475 fast writes in <path>xorg.conf</path>. Your card does not support fast writes.
476 </impo>
477
478 <p>
479 Now let's make sure the motherboard supports fast writes as well. This time,
480 look at the "Host bridge" section of your <c>lspci</c> output.
481 </p>
482
483 <pre caption="Motherboard check">
484 # <i>lspci -vv</i>
485 00:00.0 Host bridge: Intel Corporation 82830 830 Chipset Host Bridge (rev 02)
486 . . .
487 Capabilities: [a0] AGP version 2.0
488 Status: RQ=32 Iso- ArqSz=0 Cal=0 SBA+ ITACoh- GART64- HTrans- 64bit- FW+ AGP3- Rate=x1,x2,x4
489 </pre>
490
491 <p>
492 Again, examine the "Status" subsection of your AGP "Capabilities" section. Look
493 for <b>FW</b>. If you see <b>FW+</b>, your motherboard supports fast writes.
494 </p>
495
496 <impo>
497 Remember, both your video card information and your motherboard information
498 must show the same <b>FW</b> capability. If either device shows <b>FW-</b> in
499 "Status", you cannot enable fast writes in <path>xorg.conf</path>.
500 </impo>
501
502 <p>
503 Assuming that all has gone well and both your motherboard and video card
504 support fast writes, let's enable this option in
505 <path>/etc/X11/xorg.conf</path> and get the best performance out of your
506 hardware.
507 </p>
508
509 <pre caption="xorg.conf">
510 Section "Device"
511 Option "AGPMode" "4"
512 <comment>(This increased FPS from 609 to 618.)</comment>
513 Option "AGPFastWrite" "True"
514 <comment>(This had no measurable effect, but it may increase instability of your computer.)</comment>
515 <comment>(You may also need to set it in your BIOS.)</comment>
516 Option "EnablePageFlip" "True"
517 <comment>(This improved FPS from 618 to 702. It also is "risky" but few people have reported problems.)</comment>
518 ...
519 EndSection
520 </pre>
521
522 <warn>
523 Enabling <c>AGPFastWrite</c> on a VIA chipset will very likely cause your
524 machine to lock up. VIA chipsets do not play nicely with fast writes, so use
525 this setting at your own risk.
526 </warn>
527
528 <note>
529 Remember, if you want fast writes to work properly, you will have to first
530 enable the appropriate option in your BIOS.
531 </note>
532
533 <p>
534 If you want to set even more features, check out the <uri
535 link="http://dri.freedesktop.org/wiki/FeatureMatrix">feature matrix</uri> on
536 the DRI web site or the <uri
537 link="http://dri.sourceforge.net/doc/dri_driver_features.phtml">features
538 listing</uri> on Sourceforge.
539 </p>
540
541 </body>
542 </section>
543 </chapter>
544
545 <chapter>
546 <title>Troubleshooting</title>
547 <section>
548 <title>It doesn't work. I just recompiled my kernel or switched to a new one.</title>
549 <body>
550
551 <p>
552 Whenever you rebuild your kernel or switch to another kernel, you'll have to
553 rebuild the kernel module. Note that you don't need to remerge xorg-x11, but
554 you will need to remerge x11-drm.
555 </p>
556
557 </body>
558 </section>
559
560 <section>
561 <title>It doesn't work. I don't have rendering, and I can't tell why.</title>
562 <body>
563
564 <p>
565 Try <c>insmod radeon</c> before you start the X server. Also, try building
566 agpgart into the kernel instead of as a module.
567 </p>
568
569 </body>
570 </section>
571 <section>
572 <title>When I startx, I get this error: "[drm] failed to load kernel module agpgart"</title>
573 <body>
574
575 <p>
576 That's because you compiled agpgart into the kernel instead of as a module.
577 Ignore it unless you're having problems.
578 </p>
579
580 </body>
581 </section>
582 <section>
583 <title>Direct rendering doesn't work, and in /var/log/Xorg.0.log I have an error about driver version too low.</title>
584 <body>
585
586 <p>
587 You aren't using the x11-drm driver. Check if you compiled DRM and the driver
588 into the kernel; you shouldn't have.
589 </p>
590
591 </body>
592 </section>
593 <section>
594 <title>I have a Radeon, and I want TV-Out.</title>
595 <body>
596
597 <p>
598 Check out ati-gatos drivers. <c>emerge -s gatos</c>.
599 </p>
600
601 </body>
602 </section>
603 <section>
604 <title>It doesn't work. My card is so incredibly new and cool that it isn't supported at all.</title>
605 <body>
606
607 <p>
608 Try out the binary drivers. For ati-drivers, a listing is at
609 <uri>http://www.schneider-digital.de/html/download_ati.php</uri>. If those
610 don't support it, use fbdev. It's slow, but it works.
611 </p>
612
613 </body>
614 </section>
615 <section>
616 <title>I have a PCI card and it doesn't work. Help!</title>
617 <body>
618
619 <p>
620 In section "Device" enable ForcePCIMode.
621 </p>
622
623 <pre caption="Enabling ForcePCIMode">
624 Option "ForcePCIMode" "True"
625 </pre>
626
627 </body>
628 </section>
629 </chapter>
630
631 <chapter>
632 <title>Acknowledgments</title>
633 <section>
634 <body>
635
636 <ol>
637 <li>
638 Christopher Webber for suggesting a troubleshooting question about changing
639 or recompiling kernels
640 </li>
641 <li>
642 Steve, for suggesting consistency between the cases of dri and DRI in
643 XF86Config
644 </li>
645 </ol>
646
647 </body>
648 </section>
649 </chapter>
650
651 <chapter>
652 <title>References</title>
653 <section>
654 <body>
655
656 <ol>
657 <li><uri>http://forums.gentoo.org/viewtopic.php?t=46681</uri></li>
658 <li><uri>http://forums.gentoo.org/viewtopic.php?t=29264</uri></li>
659 <li><uri>http://dri.freedesktop.org/</uri></li>
660 <li><uri>http://www.retinalburn.net/linux/dri_status.html</uri></li>
661 </ol>
662
663 </body>
664 </section>
665 </chapter>
666 </guide>

  ViewVC Help
Powered by ViewVC 1.1.20