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

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

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

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

Legend:
Removed from v.1.4  
changed lines
  Added in v.1.31

  ViewVC Help
Powered by ViewVC 1.1.20