/[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.6 Revision 1.50
1<?xml version="1.0" encoding="UTF-8"?> 1<?xml version="1.0" encoding="UTF-8"?>
2<!-- $Header: /var/cvsroot/gentoo/xml/htdocs/doc/en/dri-howto.xml,v 1.6 2003/11/15 00:35:18 neysx Exp $ -->
3<!DOCTYPE guide SYSTEM "/dtd/guide.dtd"> 2<!DOCTYPE guide SYSTEM "/dtd/guide.dtd">
3<!-- $Header: /var/cvsroot/gentoo/xml/htdocs/doc/en/dri-howto.xml,v 1.50 2012/12/25 18:47:17 swift Exp $ -->
4 4
5<guide link="/doc/en/dri-howto.xml"> 5<guide>
6<title>Hardware 3D Acceleration Guide</title> 6<title>Hardware 3D Acceleration Guide</title>
7
7<author title="Author"> 8<author title="Author">
8 <mail link="donnie.berkholz@richmond.edu">Donnie Berkholz</mail> 9 <mail link="dberkholz"/>
9</author> 10</author>
10<author title="Editor"> 11<author title="Editor">
11 <mail link="peesh@gentoo.org">Jorge Paulo</mail> 12 <mail link="peesh"/>
12</author> 13</author>
14<author title="Editor">
15 <mail link="nightmorph"/>
16</author>
13 17
18<abstract>
19This document is a guide to getting 3D acceleration working using the DRM with
20Xorg in Gentoo Linux.
21</abstract>
22
23<!-- The content of this document is licensed under the CC-BY-SA license -->
24<!-- See http://creativecommons.org/licenses/by-sa/2.5 -->
14<license/> 25<license/>
15 26
16<abstract>This document is a guide to getting 3D acceleration working using XFree-DRM with XFree86 in Gentoo Linux.</abstract>
17
18<version>1.0.0</version> 27<version>6</version>
19<date>June 19 2003</date> 28<date>2012-12-25</date>
20 29
21<chapter> 30<chapter>
22 <title>Introduction</title> 31<title>Introduction</title>
23 <section> 32<section>
24 <title>What is hardware 3D acceleration and why do I want it?</title> 33<title>What is hardware 3D acceleration and why do I want it?</title>
25 <body> 34<body>
26 <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> 35
36<p>
37With hardware 3D acceleration, three-dimensional rendering uses the graphics
38processor on your video card instead of taking up valuable CPU resources
39drawing 3D images. It's also referred to as "hardware acceleration" instead of
40"software acceleration" because without this 3D acceleration your CPU is forced
41to draw everything itself using the Mesa software rendering libraries, which
42takes up quite a bit of processing power. While Xorg typically supports 2D
43hardware acceleration, it often lacks hardware 3D acceleration.
44Three-dimensional hardware acceleration is valuable in situations requiring
45rendering of 3D objects such as games, 3D CAD and modeling.
46</p>
47
27 </body> 48</body>
28 </section> 49</section>
29
30
31 <section> 50<section>
32 <title>How do I get hardware 3D acceleration?</title> 51<title>How do I get hardware 3D acceleration?</title>
33 <body> 52<body>
34 <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.
35<!--
36 Temporarily removed from the guide as nvidia tsg is not more
37 supported.
38 53
39 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. 54<p>
40--> 55In many cases, both binary and open-source drivers exist. Open source drivers
41 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> 56are preferable since we're using Linux and open source is one of its underlying
57principles. Sometimes, binary drivers are the only option, especially if your
58graphics card is so new that open source drivers have not yet been written to
59support its features. Binary drivers include <c>x11-drivers/nvidia-drivers</c>
60for nVidia cards and <c>x11-drivers/ati-drivers</c> for AMD/ATI cards.
61</p>
62
42 </body> 63</body>
43 </section> 64</section>
44
45
46 <section> 65<section>
47 <title>What is DRI?</title> 66<title>What is DRI?</title>
48 <body> 67<body>
49 <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> 68
69<p>
70The <uri link="http://dri.freedesktop.org/wiki/">Direct Rendering
71Infrastructure</uri>, also known as the DRI, is a framework for allowing direct
72access to graphics hardware in a safe and efficient manner. It includes changes
73to the X server, to several client libraries and to the kernel. The first major
74use for the DRI is to create fast OpenGL implementations.
75</p>
76
50 </body> 77</body>
51 </section> 78</section>
52
53
54 <section> 79<section>
55 <title>What is XFree-DRM and how does it relate to regular XFree86?</title> 80<title>What is the DRM and how does it relate to regular Xorg?</title>
56 <body> 81<body>
57 <p>XFree-DRM is an <e>enhancement</e> to XFree86 that adds 3D acceleration for cards to which XFree86 doesn't provide acceleration.</p> 82
83<p>
84The DRM (Direct Rendering Manager) is an <e>enhancement</e> to Xorg that adds 3D
85acceleration for cards by adding the kernel module necessary for direct
86rendering.
87</p>
88
58 </body> 89</body>
59 </section> 90</section>
60
61
62 <section> 91<section>
63 <title>Purpose</title> 92<title>Purpose</title>
64 <body> 93<body>
65 <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> 94
95<p>
96This guide is for people who can't get direct rendering working with just Xorg.
97The DRM works for the following drivers:
98</p>
99
100<ul>
101 <li>3dfx</li>
102 <li>intel</li>
103 <li>matrox</li>
104 <li>nouveau</li>
105 <li>rage128</li>
106 <li>radeon</li>
107 <li>mach64</li>
108 <li>sis300</li>
109 <li>via</li>
110</ul>
111
112<p>
113See the <uri link="http://dri.freedesktop.org/">DRI homepage</uri> for more info
114and documentation.
115</p>
116
66 </body> 117</body>
67 </section> 118</section>
119</chapter>
68 120
69 121<chapter>
122<title>Install Xorg and configure your kernel</title>
70 <section> 123<section>
71 <title>Feedback</title> 124<title>Install Xorg</title>
72 <body> 125<body>
73 <p>For suggestions, questions, etc., e-mail <mail link="donnie.berkholz@richmond.edu">Donnie Berkholz</mail>.</p> 126
127<p>
128Please read our <uri link="/doc/en/xorg-config.xml">Xorg Configuration
129Guide</uri> to get Xorg up and running.
130</p>
131
74 </body> 132</body>
75 </section> 133</section>
76</chapter>
77
78
79<chapter>
80 <title>Install XFree86 and configure your kernel</title>
81 <section> 134<section>
82 <title>Install XFree86</title>
83 <body>
84 <pre>
85# <i>emerge x11-base/xfree</i>
86 </pre>
87 </body>
88 </section>
89
90
91 <section>
92 <title>Configure your kernel</title> 135<title>Configure your kernel</title>
93 <body> 136<body>
137
138<p>
94 <p>Probe for your chipset and enable just that one.</p> 139Probe for your chipset and enable just that one.
140</p>
141
95 <pre caption="Checking your AGP chipset"> 142<pre caption="Checking your AGP chipset">
96# <i>emerge pciutils; lspci | grep AGP</i> 143# <i>emerge pciutils; lspci | grep AGP</i>
97# <i>00:01.0 PCI bridge: Intel Corp. 440BX/ZX/DX - 82443BX/ZX/DX AGP bridge (rev 03)</i> 144# <i>00:01.0 PCI bridge: Intel Corp. 440BX/ZX/DX - 82443BX/ZX/DX AGP bridge (rev 03)</i>
98<codenote>Your output may not match the above due to different hardware.</codenote> 145<comment>(Your output may not match the above due to different hardware.)</comment>
99 </pre> 146</pre>
147
148<p>
149If your chipset is not supported by the kernel you might have some success by
150passing <c>agp=try_unsupported</c> as a kernel parameter. This will use Intel's
151generic routines for AGP support. To add this parameter, edit your bootloader
152configuration file!
153</p>
154
155<p>
100 <p>Most, if not all, kernels should have these options. This was configured using gentoo-sources-2.4.20-r5.</p> 156Most, if not all, kernels should have these options. This was configured using a
101 <pre> 157standard <c>gentoo-sources</c> kernel.
158</p>
159
160<pre caption="Configuring the kernel">
102# <i>ls -l /usr/src/linux </i> 161# <i>ls -l /usr/src/linux </i>
103lrwxrwxrwx 1 root root 22 May 29 18:20 /usr/src/linux -> linux-2.4.20-gentoo-r5 162lrwxrwxrwx 1 root root 22 2007-02-14 20:12 /usr/src/linux -> linux-2.6.18-gentoo-r4
104<codenote>Make sure <path>/usr/src/linux</path> links to your current kernel.</codenote> 163<comment>(Make sure /usr/src/linux links to your current kernel.)</comment>
105# <i>cd /usr/src/linux</i> 164# <i>cd /usr/src/linux</i>
106# <i>make menuconfig</i> 165# <i>make menuconfig</i>
107 </pre> 166</pre>
108 <p></p> 167
109 <pre caption="make menuconfig options"> 168<pre caption="make menuconfig options">
110Processor type and features ---&gt; 169Processor type and features --->
111 &lt;*&gt; MTRR (Memory Type Range Register) support 170&lt;*&gt; MTRR (Memory Type Range Register) support
112Character devices ---&gt; 171Device drivers --->
172 Graphics support --->
113 &lt;*&gt; /dev/agpgart (AGP Support) 173 &lt;M&gt; /dev/agpgart (AGP Support) --->
114 [*] Intel 440LX/BX/GX and I815/I820/I830M/I830MP/I840/I845/I850/I860 support 174 <comment>(The agpgart option is not present on 64-bit kernels; just choose your chipset support.)</comment>
175 &lt;M&gt; Intel 440LX/BX/GX, I8xx and E7x05 support
115<codenote>Enable your chipset instead of the above.</codenote> 176 <comment>(Enable your chipset instead of the above.)</comment>
116 [ ] Direct Rendering Manager (XFree86 DRI support) 177 &lt;M&gt; Direct Rendering Manager (XFree86 4.1.0 and higher DRI support) --->
178 &lt;M&gt; <comment>(Select your graphics card from the list)</comment>
117 </pre> 179</pre>
118 <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> 180
119 </body> 181</body>
120 </section> 182</section>
121 183<section>
122
123 <section>
124 <title>Compile and install your kernel</title> 184<title>Compile and install your kernel</title>
125 <body> 185<body>
186
126 <pre caption="Compiling and installing kernel"> 187<pre caption="Compiling and installing kernel">
127# <i>make dep &amp;&amp; make clean bzImage modules modules_install</i> 188# <i>make &amp;&amp; make modules_install</i>
128# <i>mount /boot</i>
129# <i>cp arch/i386/boot/bzImage /boot</i>
130 </pre>
131 <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>
132 </body>
133 </section>
134</chapter>
135
136
137<chapter>
138 <title>Install XFree-DRM and configure direct rendering</title>
139 <section>
140 <title>Install XFree-DRM</title>
141 <body>
142 <pre>
143# <i>ACCEPT_KEYWORDS="~x86" emerge xfree-drm</i>
144 </pre> 189</pre>
190
191<p>
192Don't forget to set up <path>grub.conf</path> or <path>lilo.conf</path> and run
193<c>/sbin/lilo</c> if you use LILO.
194</p>
195
145 </body> 196</body>
146 </section> 197</section>
198<section>
199<title>Add your user to the video group</title>
200<body>
147 201
202<p>
203Next, add your user(s) to the video group, as explained in the <uri
204link="/doc/en/handbook">handbook</uri>:
205</p>
148 206
149 <section> 207<pre caption="Adding a user to the video group">
150 <title>Configure XF86Config</title> 208# <i>gpasswd -a username video</i>
151 <body> 209</pre>
152 <p>Open <path>/etc/X11/XF86Config</path> with your favorite text editor and edit it to enable DRI and GLX.</p> 210
153 <pre caption="XF86Config"> 211</body>
154... 212</section>
155Section "Module" 213</chapter>
156 Load "dri" 214
157 Load "glx" 215<chapter>
158 ... 216<title>Configure direct rendering</title>
217<section id="configure_xorg">
218<title>Configure Xorg</title>
219<body>
220
221<p>
222Hopefully just adding your user to the <c>video</c> group is sufficient to
223enable direct rendering. However, you may also need to create a file in
224<path>/etc/X11/xorg.conf.d/</path>. You can name it anything you like; just make
225sure it ends in <path>.conf</path>. Open up your favorite text editor and create
226a file with this inside it:
227</p>
228
229<pre caption="/etc/X11/xorg.conf.d/10-dri.conf">
230Section "Device"
231 Driver "radeon"
232 <comment>(Replace radeon with the name of your driver.)</comment>
159EndSection 233EndSection
160... 234Section "dri"
235 Mode 0666
236EndSection
237</pre>
238
239</body>
240</section>
241<section>
242<title>Changes to /etc/conf.d/modules</title>
243<body>
244
245<p>
246You will need to add the module name that your card uses to
247<path>/etc/conf.d/modules</path> to ensure that the module is
248loaded automatically when the system starts up.
249</p>
250
251<pre caption="Editing /etc/conf.d/modules">
252<comment>(Change module name as required.)</comment>
253modules="<i>intel-agp</i>"
254</pre>
255
256<note>
257If you compiled <c>agpgart</c> as a module, you will also need to add it to
258<path>/etc/conf.d/modules</path>.
259</note>
260
261</body>
262</section>
263</chapter>
264
265<chapter>
266<title>Test 3D acceleration</title>
267<section>
268<title>Reboot to the new kernel</title>
269<body>
270
271<p>
272Reboot your computer to your new kernel and login as a normal user. It's time to
273see if you have direct rendering and how good it is. <c>glxinfo</c> and
274<c>glxgears</c> are part of the <c>mesa-progs</c> package, so make sure it is
275installed before you attempt to run these commands.
276</p>
277
278<pre caption="Testing rendering">
279$ <i>startx</i>
280<comment>(No need to load modules for your driver or agpgart, even if you compiled them as a module.)</comment>
281<comment>(They will be loaded automatically.)</comment>
282$ <i>glxinfo | grep rendering</i>
283direct rendering: Yes
284<comment>(If it says "No", you don't have 3D acceleration.)</comment>
285$ <i>glxgears</i>
286<comment>(Test your frames per second (FPS) at the default size. The number should be
287significantly higher than before configuring DRM. Do this while the CPU is as idle as
288possible.)</comment>
289</pre>
290
291<note>
292FPS may be limited by your screen's refresh rate, so keep this in mind if
293<c>glxgears</c> reports only about 70-100 FPS. <c>games-fps/ut2004-demo</c> or
294other 3D games are better benchmarking tools, as they give you real-world
295performance results.
296</note>
297
298</body>
299</section>
300<section>
301<title>Get the most out of direct rendering</title>
302<body>
303
304<p>
305If you want to set more features, for performance or other reasons, check out
306the <uri link="http://dri.freedesktop.org/wiki/FeatureMatrix">feature
307matrix</uri> on the DRI web site or the <uri
308link="http://dri.sourceforge.net/doc/dri_driver_features.phtml">features
309listing</uri> on Sourceforge.
310</p>
311
312</body>
313</section>
314</chapter>
315
316<chapter>
317<title>Troubleshooting</title>
318<section>
319<title>It doesn't work. I don't have rendering, and I can't tell why.</title>
320<body>
321
322<p>
323Try <c>modprobe radeon</c> before you start the X server (replace <c>radeon</c>
324with the name of your driver). Also, try building agpgart into the kernel
325instead of as a module.
326</p>
327
328</body>
329</section>
330<section>
331<title>When I startx, I get this error: "[drm] failed to load kernel module agpgart"</title>
332<body>
333
334<p>
335That's because you compiled agpgart into the kernel instead of as a module.
336Ignore it unless you're having problems.
337</p>
338
339</body>
340</section>
341<section>
342<title>I have a Radeon, and I want TV-Out.</title>
343<body>
344
345<p>
346The drivers originally developed by the <uri
347link="http://gatos.sf.net">GATOS</uri> project have been merged into Xorg's
348codebase. You don't need anything special for TV-Out;
349<c>x11-drivers/xf86-video-ati</c> will work just fine.
350</p>
351
352</body>
353</section>
354<section>
355<title>
356It doesn't work. My card is so incredibly new and cool that it isn't supported
357at all.
358</title>
359<body>
360
361<p>
362Try out the binary drivers. For AMD cards, use <c>ati-drivers</c>; a listing is
363at <uri>http://support.amd.com/us/gpudownload/Pages/index.aspx</uri>. If those
364don't support it, use fbdev. It's slow, but it works.
365</p>
366
367</body>
368</section>
369<section>
370<title>I have a PCI card and it doesn't work. Help!</title>
371<body>
372
373<p>
374Create a config file in <path>/etc/X11/xorg.conf.d/</path>; name it anything you
375want as long as it ends in <path>.conf</path>. Add the following to it:
376</p>
377
378<pre caption="/etc/X11/xorg.conf.x/10-pcimode.conf">
161Section "Device" 379Section "Device"
162 Driver "radeon" 380 Option "ForcePCIMode" "True"
163 ...
164EndSection 381EndSection
165...
166Section "DRI"
167 Mode 0666
168EndSection
169 </pre> 382</pre>
170 <p>If you are using a different driver, replace "radeon" with yours.</p> 383
171 </body> 384</body>
172 </section> 385</section>
173</chapter>
174
175
176<chapter> 386</chapter>
177 <title>Test 3D acceleration</title> 387
178 <section>
179 <title>Reboot to the new kernel</title>
180 <body>
181 <p>Reboot your computer to your new kernel. It's time to see if you have direct rendering and how good it is.</p>
182 <pre caption="Testing rendering">
183# <i>startx</i>
184<codenote>No need to load modules for your driver or agpgart, if you compiled agpgart as a module.</codenote>
185<codenote>They will be loaded automatically.</codenote>
186# <i>glxinfo | grep rendering</i>
187direct rendering: Yes
188<codenote>If it says "No," you don't have 3D acceleration.</codenote>
189# <i>glxgears</i>
190<codenote>Test your frames per second (FPS) at the default size. Do this while the CPU is as idle as possible.</codenote>
191 </pre>
192 </body>
193 </section>
194</chapter> 388<chapter>
195
196
197<chapter>
198 <title>Using the CVS sources</title>
199 <section>
200 <body>
201 <warn>Don't do this if the package worked.</warn>
202 <note>By their nature, CVS sources are always changing. Your configuration may not look exactly like the one below.</note>
203 </body>
204 </section>
205 <section>
206 <title>Do you need the CVS?</title>
207 <body>
208 <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>
209 </body>
210 </section>
211 <section>
212 <title>Do the CVS sources support your card?</title>
213 <body>
214 <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>
215 <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>
216 <p></p>
217 <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>
218 </body>
219 </section>
220
221
222 <section>
223 <title>Install the CVS sources</title>
224 <body>
225 <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>
226 </body>
227 </section>
228
229
230 <section>
231 <title>Anonymous CVS download</title>
232 <body>
233 <p>Create a directory to store the CVS files:</p>
234 <pre>
235# <i>cd ~</i>
236# <i>mkdir DRI-CVS</i>
237 </pre>
238 <p>Check out the CVS sources</p>
239 <pre>
240# <i>cd ~/DRI-CVS</i>
241# <i>cvs -d:pserver:anonymous@cvs.dri.sourceforge.net:/cvsroot/dri login</i>
242<codenote>(hit ENTER when prompted for a password)</codenote>
243# <i>cvs -z3 -d:pserver:anonymous@cvs.dri.sourceforge.net:/cvsroot/dri co xc</i>
244<codenote>The -z3 flag causes compression to be used in order to reduce the download time.</codenote>
245 </pre>
246 </body>
247 </section>
248
249
250 <section>
251 <title>Updating your CVS sources</title>
252 <body>
253 <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>
254 <pre>
255# <i>cd ~/DRI-CVS</i>
256# <i>cvs -z3 update -dA xc</i>
257<codenote>The -d flag causes any new subdirectories to be created.</codenote>
258<codenote>The -A flag causes most recent trunk sources to be fetched, not branch sources.</codenote>
259 </pre>
260 </body>
261 </section>
262
263
264 <section>
265 <title>Make a build tree</title>
266 <body>
267 <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>
268 <pre>
269# <i>cd ~/DRI-CVS</i>
270# <i>ln -s xc XFree40</i>
271# <i>mkdir build; cd build</i>
272# <i>lndir -silent -ignorelinks ../XFree40</i>
273 </pre>
274 <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>
275 </body>
276 </section>
277
278
279 <section>
280 <title>Edit the host.def file</title>
281 <body>
282 <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>
283 <pre>
284 #define DefaultCCOptions -Wall
285<codenote>For i386:</codenote>
286 #define DefaultGcc2i386Opt -O2
287<codenote>For Alpha:</codenote>
288 #define DefaultGcc2AxpOpt -O2 -mcpu=ev6 (or similar)
289<codenote>For all architectures</codenote>
290 #define LibraryCDebugFlags -O2
291 #define BuildServersOnly YES
292 #define XF86CardDrivers vga tdfx mga ati i810
293 #define LinuxDistribution LinuxRedHat
294 #define DefaultCCOptions -ansi GccWarningOptions -pipe
295 #define BuildXF86DRI YES
296 /* Optionally turn these on for debugging */
297 /* #define GlxBuiltInTdfx YES */
298 /* #define GlxBuiltInMga YES */
299 /* #define GlxBuiltInR128 YES */
300 /* #define GlxBuiltInRadeon YES */
301 /* #define DoLoadableServer NO */
302 #define SharedLibFont NO
303 </pre>
304 <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>
305 <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>
306 <pre>
307#define ProjectRoot pathToYourXFree86installation
308<codenote>Note the XF86CardDrivers line to be sure your card's driver is listed.</codenote>
309<codenote>If you want to enable 3DNow! optimizations in Mesa and the DRI drivers, you should add the following:</codenote>
310#define MesaUse3DNow YES
311<codenote>You don't have to be using an AMD processor to enable this option.</codenote>
312<codenote>The DRI will look for 3DNow! support at runtime and only enable it if applicable.</codenote>
313 </pre>
314 <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>
315 <pre>
316#define MesaUseKatmai YES
317 </pre>
318 </body>
319 </section>
320
321
322 <section>
323 <title>Compile the XFree86/DRI tree</title>
324 <body>
325 <p>To compile the complete DRI tree:</p>
326 <pre>
327# <i>cd ~/DRI-CVS/build/xc/</i>
328# <i>make World &gt;&amp; world.log</i>
329 </pre>
330 <p>One user suggests it may also be necessary to do the following:</p>
331 <pre>
332# <i>cd ~/DRI-CVS/build/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel</i>
333# <i>make -f Makefile.linux radeon.o</i>
334<codenote>Replace radeon with your driver.</codenote>
335 </pre>
336 <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>
337 <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>
338 <p>Using your text editor, examine world.log for errors by searching for the pattern ***.</p>
339 </body>
340 </section>
341
342
343 <section>
344 <title>Install your driver</title>
345 <body>
346 <p>Verify that the DRI kernel module(s) for your system were built:</p>
347 <pre>
348# <i>cd ~/DRI-CVS/build/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel; ls</i>
349 </pre>
350 <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>
351 <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>
352 <pre>
353# <i>cd ~/DRI-CVS/build/xc/exports/lib/modules/</i>
354# <i>cp dri/r200_dri.so /usr/X11R6/lib/modules/dri/</i>
355# <i>cp drivers/atimisc_drv.o /usr/X11R6/lib/modules/drivers/</i>
356# <i>cp drivers/radeon_drv.o /usr/X11R6/lib/modules/drivers/</i>
357# <i>cp extensions/libdri.a /usr/X11R6/lib/modules/extensions/</i>
358# <i>cp linux/libdrm.a /usr/X11R6/lib/modules/linux/</i>
359 </pre>
360 <p>Follow the "Configure XF86Config" section above.</p>
361 <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>
362 <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>
363 </body>
364 </section>
365</chapter>
366
367
368<chapter>
369 <title>Tweak your performance</title>
370 <section>
371 <title>Get the most out of direct rendering</title>
372 <body>
373 <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>
374 <pre caption="XF86Config">
375Section "Device"
376 Option "AGPMode" "4"
377<codenote>This increased FPS from 609 to 618.</codenote>
378 Option "AGPFastWrite" "True"
379<codenote>This had no measurable effect, but it may increase instability of your computer.</codenote>
380<codenote>You may also need to set it in your BIOS.</codenote>
381 Option "EnablePageFlip" "True"
382<codenote>This improved FPS from 618 to 702. It also is "risky" but few people have reported problems.</codenote>
383 ...
384EndSection
385 </pre>
386 <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>
387 </body>
388 </section>
389</chapter>
390
391<chapter>
392 <title>Troubleshooting</title>
393 <section>
394 <title>It doesn't work. I don't have rendering, and I can't tell why.</title>
395 <body>
396 <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>
397 </body>
398 </section>
399 <section>
400 <title>When I <c>startx</c>, I get this error: "[drm] failed to load kernel module agpgart"</title>
401 <body>
402 <p>That's because you compiled agpgart into the kernel instead of as a module. Ignore it.</p>
403 </body>
404 </section>
405 <section>
406 <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>
407 <body>
408 <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>
409 </body>
410 </section>
411 <section>
412 <title>I have a Radeon, and I want TV-Out.</title>
413 <body>
414 <p>Check out ati-gatos drivers. <c>emerge -s gatos</c>.</p>
415 </body>
416 </section>
417 <section>
418 <title>It doesn't work. My card is so incredibly new and cool that it isn't supported at all.</title>
419 <body>
420 <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>
421 </body>
422 </section>
423 <section>
424 <title>I have a PCI card and it doesn't work. Help!</title>
425 <body>
426 <p>In section "Device" enable ForcePCIMode.
427<pre>Option "ForcePCIMode" "True"</pre></p>
428 </body>
429 </section>
430
431</chapter>
432
433
434<chapter>
435 <title>References</title> 389<title>References</title>
436 <section> 390<section>
437 <body> 391<body>
438 <p> 392
439 <ol> 393<ol>
440 <li>http://forums.gentoo.org/viewtopic.php?t=46681</li> 394 <li><uri>http://forums.gentoo.org/viewtopic.php?t=46681</uri></li>
441 <li>http://forums.gentoo.org/viewtopic.php?t=29264</li> 395 <li><uri>http://forums.gentoo.org/viewtopic.php?t=29264</uri></li>
442 <li>http://dri.sourceforge.net/</li> 396 <li><uri>http://dri.freedesktop.org/</uri></li>
443 <li>http://www.retinalburn.net/linux/dri_status.html</li>
444 </ol> 397</ol>
445 </p> 398
446 </body> 399</body>
447 </section> 400</section>
401<section>
402<title>Feedback</title>
403<body>
404
405<p>
406With suggestions, questions, etc., e-mail <mail link="dberkholz"/>.
407</p>
408
409</body>
410</section>
448</chapter> 411</chapter>
449</guide> 412</guide>

Legend:
Removed from v.1.6  
changed lines
  Added in v.1.50

  ViewVC Help
Powered by ViewVC 1.1.20