/[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.26 - (show annotations) (download) (as text)
Tue Oct 11 03:46:14 2005 UTC (8 years, 10 months ago) by swift
Branch: MAIN
Changes since 1.25: +6 -12 lines
File MIME type: application/xml
#108581 - x11-drm is now available for 2.6 kernels as well

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

  ViewVC Help
Powered by ViewVC 1.1.20