/[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.27 - (hide annotations) (download) (as text)
Fri Dec 16 07:30:48 2005 UTC (8 years, 11 months ago) by fox2mike
Branch: MAIN
Changes since 1.26: +23 -4 lines
File MIME type: application/xml
#101566 - Autoloading Modules as required. Added CC-BY-SA 2.5 comment as well. I'm back in business babies :p

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

  ViewVC Help
Powered by ViewVC 1.1.20