/[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.28 - (show annotations) (download) (as text)
Wed Feb 1 11:58:34 2006 UTC (8 years, 10 months ago) by neysx
Branch: MAIN
Changes since 1.27: +5 -6 lines
File MIME type: application/xml
#120506 no need to start an editor to add a line to packages.use

1 <?xml version="1.0" encoding="UTF-8"?>
2 <!-- $Header: /var/cvsroot/gentoo/xml/htdocs/doc/en/dri-howto.xml,v 1.27 2005/12/16 07:30:48 fox2mike Exp $ -->
3 <!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 <mail link="spyderous@gentoo.org">Donnie Berkholz</mail>
9 </author>
10 <author title="Editor">
11 <mail link="peesh@gentoo.org">Jorge Paulo</mail>
12 </author>
13
14 <abstract>
15 This document is a guide to getting 3D acceleration working using X11-DRM
16 with Xorg in Gentoo Linux.
17 </abstract>
18
19 <!-- The content of this document is licensed under the CC-BY-SA license -->
20 <!-- See http://creativecommons.org/licenses/by-sa/2.5 -->
21 <license/>
22
23 <version>1.2</version>
24 <date>2006-02-01</date>
25
26 <chapter>
27 <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 takes up quite a bit of processing power. While Xorg typically supports 2D
39 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 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 </p>
74
75 </body>
76 </section>
77 <section>
78 <title>What is X11-DRM and how does it relate to regular Xorg?</title>
79 <body>
80
81 <p>
82 X11-DRM is an <e>enhancement</e> to Xorg that adds 3D acceleration for
83 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 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 </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 </chapter>
113
114 <chapter>
115 <title>Install Xorg and configure your kernel</title>
116 <section>
117 <title>Install Xorg</title>
118 <body>
119
120 <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
125 </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
135 <pre caption="Checking your AGP chipset">
136 # <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 <comment>(Your output may not match the above due to different hardware.)</comment>
139 </pre>
140
141 <p>
142 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 Most, if not all, kernels should have these options. This was configured using
150 gentoo-sources-2.4.20-r5.
151 </p>
152
153 <pre caption="Configuring the kernel">
154 # <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 <comment>(Make sure /usr/src/linux links to your current kernel.)</comment>
157 # <i>cd /usr/src/linux</i>
158 # <i>make menuconfig</i>
159 </pre>
160
161 <pre caption="make menuconfig options">
162 Processor type and features ---&gt;
163 &lt;*&gt; MTRR (Memory Type Range Register) support
164 Character devices ---&gt;
165 &lt;M&gt; /dev/agpgart (AGP Support)
166 [M] Intel 440LX/BX/GX and I815/I820/I830M/I830MP/I840/I845/I850/I860 support
167 <comment>(Enable your chipset instead of the above.)</comment>
168 &lt; &gt; Direct Rendering Manager (XFree86 4.1.0 and higher DRI support)
169 </pre>
170
171 <p>
172 Make sure the Direct Rendering Manager (DRM) is <e>off</e>.
173 The X11-DRM package will provide its own.
174 </p>
175
176 </body>
177 </section>
178 <section>
179 <title>Compile and install your kernel</title>
180 <body>
181
182 <pre caption="Compiling and installing kernel">
183 <comment>(This example is for a 2.4 kernel)</comment>
184 # <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 </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 </chapter>
198
199 <chapter>
200 <title>Install X11-DRM and configure direct rendering</title>
201 <section>
202 <title>Install X11-DRM</title>
203 <body>
204
205 <pre caption="Installing X11-DRM">
206 # <i>emerge x11-drm</i>
207 </pre>
208
209 </body>
210 </section>
211 <section id="configure_xorg">
212 <title>Configure Xorg.conf</title>
213 <body>
214
215 <p>
216 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 <comment>(Add the insecure-drivers USE flag if you use one of the aforementioned chipsets)</comment>
225 # <i>echo "x11-base/xorg-x11 insecure-drivers" &gt;&gt; /etc/portage/package.use</i>
226
227 # <i>emerge xorg-x11</i>
228 </pre>
229
230 <p>
231 Open <path>/etc/X11/xorg.conf</path> with your favorite text editor and edit
232 it to enable DRI and GLX.
233 </p>
234
235 <pre caption="xorg.conf">
236 ...
237 Section "Module"
238 Load "dri"
239 Load "glx"
240 ...
241 EndSection
242 ...
243 Section "Device"
244 Driver "radeon"
245 ...
246 EndSection
247 ...
248 Section "dri"
249 Mode 0666
250 EndSection
251 </pre>
252
253 <p>
254 If you are using a different driver, replace "radeon" with yours.
255 </p>
256
257 </body>
258 </section>
259 <section>
260 <title>Changes to modules.autoload.d</title>
261 <body>
262
263 <p>
264 You will need to add the module name that your card uses to
265 <path>/etc/modules.autoload.d/kernel-2.6</path> to ensure that the module is
266 loaded automatically when the system starts up.
267 </p>
268
269 <pre caption="Editing /etc/modules.autoload.d/kernel-2.6">
270 <comment>(Change module name as required.)</comment>
271 intel-agp
272 </pre>
273
274 </body>
275 </section>
276 </chapter>
277
278 <chapter>
279 <title>Test 3D acceleration</title>
280 <section>
281 <title>Reboot to the new kernel</title>
282 <body>
283
284 <p>
285 Reboot your computer to your new kernel. It's time to see if you have direct
286 rendering and how good it is.
287 </p>
288
289 <pre caption="Testing rendering">
290 # <i>startx</i>
291 <comment>(No need to load modules for your driver or agpgart, if you compiled agpgart as a module.)</comment>
292 <comment>(They will be loaded automatically.)</comment>
293 # <i>glxinfo | grep rendering</i>
294 direct rendering: Yes
295 <comment>(If it says "No," you don't have 3D acceleration.)</comment>
296 # <i>glxgears</i>
297 <comment>(Test your frames per second (FPS) at the default size. The number should be )</comment>
298 <comment>(significantly higher than before installing x11-drm. Do this while the CPU is as idle as possible.)</comment>
299 </pre>
300
301 </body>
302 </section>
303 </chapter>
304
305 <chapter>
306 <title>Using the CVS sources</title>
307 <section>
308 <body>
309
310 <warn>
311 Don't do this if the package worked.
312 </warn>
313
314 </body>
315 </section>
316 <section>
317 <title>Do you need the CVS?</title>
318 <body>
319
320 <p>
321 First you have to check whether the x11-drm package works. If it doesn't and
322 you have checked your logs to verify it's not a configuration error, you might
323 want to consider the CVS sources. There are also daily driver snapshots
324 available if you do not wish to build the full CVS.
325 </p>
326
327 </body>
328 </section>
329 <section>
330 <title>Do the CVS sources support your card?</title>
331 <body>
332
333 <p>
334 Check the DRI <uri link="http://dri.freedesktop.org/wiki/Status">supported
335 cards list</uri> to see if the CVS supports your card. Even if it doesn't, but
336 it supports a similar card, try it.
337 </p>
338
339 <!-- I see a couple of 8x AGP stuff on the Internet about vanilla 2.4 kernels;
340 is this now available or not? I've commented it out for the time being,
341 hoping that this doesn't affect us :)
342
343 <warn>
344 "Linux 2.4 doesn't support agp 8x, so I had to go find a backport. The backport
345 works .... it doesn't patch quite properly, and it requires 2.4.21 (I've only
346 gotten it to work with vanilla, straight from the tarball (not ebuild)). First
347 go get the 2.4.20-2.4.21 patch from kernel.org .... (then get the patch,) It
348 was on a mailing list somewhere. It doesn't patch cleanly - - one file fails,
349 the pci_ids.h file, but if you actually read the file and the reject list, it's
350 very easy to fix. But it does load, and it gives me 1600x1200 with video
351 (although a bit slow b/c of lack of dga) with xfree-drm." (SanityInAnarchy on
352 #gentoo)
353 </warn>
354
355 <impo>
356 The patch is a little tricky to work with but <uri
357 link="http://www.ussg.iu.edu/hypermail/linux/kernel/0302.2/att-1618/01-agp3.diff.bz2">here's
358 the link</uri>. If you can disable 8X AGP in your BIOS, change it to 4X and you
359 may not need the patch.
360 </impo>
361 -->
362
363 </body>
364 </section>
365 <section>
366 <title>Follow the CVS Instructions</title>
367 <body>
368
369 <p>
370 The DRI project has a document about CVS compiling themselves. Please read <uri
371 link="http://dri.freedesktop.org/wiki/Building">the document</uri> and follow
372 the instructions up to the <e>Installing for X.org</e> part.
373 </p>
374
375 </body>
376 </section>
377 <section>
378 <title>Install the CVS</title>
379 <body>
380
381 <p>
382 Verify that the DRI kernel module(s) for your system were built:
383 </p>
384
385 <pre caption="Verification">
386 # <i>cd ~/DRI-CVS/build/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel; ls</i>
387 </pre>
388
389 <p>
390 For the 3dfx Voodoo, you should see <path>tdfx.o</path>. For the Matrox
391 G200/G400, you should see <path>mga.o</path>. For the ATI Rage 128, you should
392 see <path>r128.o</path>. For the ATI Radeon, you should see
393 <path>radeon.o</path>. For the Intel i810, you should see <path>i810.o</path>.
394 If the DRI kernel module(s) failed to build, you should verify that you're
395 using the right version of the Linux kernel. The most recent kernels are not
396 always supported.
397 </p>
398
399 <p>
400 Install over your X.org installation. You may wish to back up xorg-x11.
401 </p>
402
403 <pre caption="Backing up Xorg">
404 # <i>quickpkg xorg-x11</i>
405 <comment>(This backs up your Xorg-X11 package.)</comment>
406 # <i>make install</i>
407 </pre>
408
409 <p>
410 Follow the "Configure Xorg" section above.
411 </p>
412
413 <p>
414 To load the appropriate DRM module in your running kernel, copy the kernel
415 module to <path>/lib/modules/`uname -r`/kernel/drivers/char/drm/</path> then
416 run <c>modules-update</c> and restart your X server. If you're not running the
417 kernel you'll be using it in, instead of <c>`uname -r`,</c> use that kernel's
418 name.
419 </p>
420
421 <warn>
422 Make sure you first unload any older DRI kernel modules that might be already
423 loaded. Note that some DRM modules require that the agpgart module be loaded
424 first.
425 </warn>
426
427 </body>
428 </section>
429 </chapter>
430
431 <chapter>
432 <title>Tweak your performance</title>
433 <section>
434 <title>Get the most out of direct rendering</title>
435 <body>
436
437 <p>
438 A few options may increase performance by up to 30 percent (or more) over the
439 default. Set them in <path>/etc/X11/xorg.conf</path>.
440 </p>
441
442 <pre caption="xorg.conf">
443 Section "Device"
444 Option "AGPMode" "4"
445 <comment>(This increased FPS from 609 to 618.)</comment>
446 Option "AGPFastWrite" "True"
447 <comment>(This had no measurable effect, but it may increase instability of your computer.)</comment>
448 <comment>(You may also need to set it in your BIOS.)</comment>
449 Option "EnablePageFlip" "True"
450 <comment>(This improved FPS from 618 to 702. It also is "risky" but few people have reported problems.)</comment>
451 ...
452 EndSection
453 </pre>
454
455 <p>
456 If you want to set even more features, check out the <uri
457 link="http://dri.freedesktop.org/wiki/FeatureMatrix">feature matrix</uri> on
458 the DRI web site or the <uri
459 link="http://dri.sourceforge.net/doc/dri_driver_features.phtml">features
460 listing</uri> on Sourceforge.
461 </p>
462
463 </body>
464 </section>
465 </chapter>
466
467 <chapter>
468 <title>Troubleshooting</title>
469 <section>
470 <title>It doesn't work. I just recompiled my kernel or switched to a new one.</title>
471 <body>
472
473 <p>
474 Whenever you rebuild your kernel or switch to another kernel, you'll have to
475 rebuild the kernel module. Note that you don't need to remerge xorg-x11, but
476 you will need to remerge x11-drm.
477 </p>
478
479 </body>
480 </section>
481
482 <section>
483 <title>It doesn't work. I don't have rendering, and I can't tell why.</title>
484 <body>
485
486 <p>
487 Try <c>insmod radeon</c> before you start the X server. Also, try building
488 agpgart into the kernel instead of as a module.
489 </p>
490
491 </body>
492 </section>
493 <section>
494 <title>When I startx, I get this error: "[drm] failed to load kernel module agpgart"</title>
495 <body>
496
497 <p>
498 That's because you compiled agpgart into the kernel instead of as a module.
499 Ignore it unless you're having problems.
500 </p>
501
502 </body>
503 </section>
504 <section>
505 <title>Direct rendering doesn't work, and in /var/log/Xorg.0.log I have an error about driver version too low.</title>
506 <body>
507
508 <p>
509 You aren't using the x11-drm driver. Check if you compiled DRM and the driver
510 into the kernel; you shouldn't have.
511 </p>
512
513 </body>
514 </section>
515 <section>
516 <title>I have a Radeon, and I want TV-Out.</title>
517 <body>
518
519 <p>
520 Check out ati-gatos drivers. <c>emerge -s gatos</c>.
521 </p>
522
523 </body>
524 </section>
525 <section>
526 <title>It doesn't work. My card is so incredibly new and cool that it isn't supported at all.</title>
527 <body>
528
529 <p>
530 Try out the binary drivers. For ati-drivers, a listing is at
531 <uri>http://www.schneider-digital.de/html/download_ati.php</uri>. If those
532 don't support it, use fbdev. It's slow, but it works.
533 </p>
534
535 </body>
536 </section>
537 <section>
538 <title>I have a PCI card and it doesn't work. Help!</title>
539 <body>
540
541 <p>
542 In section "Device" enable ForcePCIMode.
543 </p>
544
545 <pre caption="Enabling ForcePCIMode">
546 Option "ForcePCIMode" "True"
547 </pre>
548
549 </body>
550 </section>
551 </chapter>
552
553 <chapter>
554 <title>Acknowledgments</title>
555 <section>
556 <body>
557
558 <ol>
559 <li>
560 Christopher Webber for suggesting a troubleshooting question about changing
561 or recompiling kernels
562 </li>
563 <li>
564 Steve, for suggesting consistency between the cases of dri and DRI in
565 XF86Config
566 </li>
567 </ol>
568
569 </body>
570 </section>
571 </chapter>
572
573 <chapter>
574 <title>References</title>
575 <section>
576 <body>
577
578 <ol>
579 <li><uri>http://forums.gentoo.org/viewtopic.php?t=46681</uri></li>
580 <li><uri>http://forums.gentoo.org/viewtopic.php?t=29264</uri></li>
581 <li><uri>http://dri.freedesktop.org/</uri></li>
582 <li><uri>http://www.retinalburn.net/linux/dri_status.html</uri></li>
583 </ol>
584
585 </body>
586 </section>
587 </chapter>
588 </guide>

  ViewVC Help
Powered by ViewVC 1.1.20