Typo
[linux_from_scratch_hints.git] / OLD / dri.txt
blobedede8d942efc6a5b0748af95398276d97b9c96f
1 TITLE:          Setting up XFree86 4.0+ DRI.
2 LFS VERSION:    Any
3 AUTHOR:         Marc Heerdink <marc@koelkast.net>
5 SYNOPSIS:
6         This hint explains how 3D rendering in X can be enabled.
8 HINT:
9 version 3.0 01/23/2002
12 =================
13 TABLE OF CONTENTS
14 =================
16 1 Introduction
17 2 Required Files
18 3 3Dfx Cards
19   3.1 3Dfx Specific Files
20   3.2 Link-Only X Installation
21   3.3 Installing Glide 3
22   3.4 3Dfx Troubleshooting
23 4 Matrox Cards
24   4.1 Matrox Specific Files
25   4.2 Preparing X
26 5 The Final X Installation
27   5.1 Zlib Installation
28   5.2 X Installation
29 6 The Glut Library
30 7 Configuration
31   7.1 Kernel Configuration
32       7.1.1 DRI
33       7.1.2 AGP
34       7.1.3 MTRR
35       7.1.4 Check If It Works
36   7.2 XFree Configuration
37 8 Testing
38 9 Generic Troubleshooting
39 10 What next?
40    10.1 Image Libraries
41         10.1.1 Needed Files
42         10.1.2 Libpng
43         10.1.3 Jpeg
44         10.1.4 Libungif
45         10.1.5 Tiff
46         10.1.6 Lcms
47         10.1.7 Libmng
48    10.2 Freetype
49         10.2.1 Needed files
50         10.2.2 Freetype 1
51         10.2.3 Freetype 2
52         10.2.4 Ttmkfdir
53    10.3 Choosing A Window Manager
54    10.4 Get Some Applications
55    10.5 Where To Go Next?
56 11 Outroduction
59 ===============
60 1. INTRODUCTION
61 ===============
63   Since XFree86 4.0, DRI is included with the normal XFree86 releases. It
64 provides a way to access the 3D graphics cards found in many modern Personal
65 Computers, such as the Matrox G-series, ATI Radeon/Rage cards and the 3Dfx
66 Voodoo-series cards. Installing DRI can be quite a pain (especially obtaining
67 and building the required helper liraries), so I decided to write a hint on
68 it. This document is, AFAIK, the only in-depth manual on how to set up DRI
69 rendering with XFree86 4.0 and up.
70   Unfortunately, Direct Rendering isn't available for all 3D video cards out
71 there. Generally, any recent 3Dfx, Matrox, ATI or Intel on-board video card
72 is more or less supported. An up-to-date list can always be found on
73 http://www.xfree86.org/. Every card has a slightly different installation
74 procedure, but the 3Dfx procedure is by far the most complicated.
75   This hint contains detailed instructions on how to set up DRI for 3Dfx cards
76 using CVS software. I can't guarantee that everything will work smoothely if
77 you follow these instructions, because I don't own a 3Dfx card anymore. If you
78 have additions, comments, success reports or any other information that you
79 feel would make a good addition to this hint, please mail me at
80 <marc@koelkast.net>.
81   The only card this hint is currently tested on, is a Matrox G400 Singe Head
82 with 32 MB onboard memory. It should work on other cards that do not require
83 special steps (such as ATI cards), but if you had any complications with these
84 cards, please mail me the steps to overcome the trouble so I can include them
85 in this hint.
88 =================
89 2. REQUIRED FILES
90 =================
92 Sources for X:
94   ftp://ftp.xfree86.org/pub/XFree86/4.2.0/source/X420src-1.tgz
95   ftp://ftp.xfree86.org/pub/XFree86/4.2.0/source/X420src-2.tgz
96   ftp://ftp.xfree86.org/pub/XFree86/4.2.0/source/X420src-3.tgz
98 Sources for Zlib:
100   ftp://ftp.info-zip.org/pub/infozip/zlib/zlib-1.1.3.tar.gz
102 DRI host.def:
104   http://www.linuxfromscratch.org/~gimli/host.def
106 Sources for Mesa3D:
108   http://prdownloads.sourceforge.net/mesa3d/MesaDemos-4.0.1.tar.bz2
109   http://prdownloads.sourceforge.net/mesa3d/MesaLib-4.0.1.tar.bz2
112 =============
113 3. 3DFX CARDS
114 =============
116   It took me a week to figure out how to enable DRI on 3Dfx cards, because it
117 isn't the most easy procedure one can think of. We'll build X twice for the
118 3Dfx cards, so it's a good idea to use a fast machine to do the compiling.
121 =======================
122 3.1 3DFX SPECIFIC FILES
123 =======================
125   You can either get my glide3x source tarball, or the latest sources from
126 CVS. To get them from CVS, you'll have to install the cvs program available
127 from http://www.cvshome.org/. Installing it is beyond the scope of this
128 document. The tarball containing today's (01-23-2002) CVS sources (2.8 MB) is
129 available from:
131  http://www.linuxfromscratch.org/~gimli/glide3x-cvs-20020123.tar.bz2
133   If you want the CVS sources and if you have CVS installed, run the following
134 commands to get the required files and to set up the directory for building
135 Glide:
137  cvs -d:pserver:anonymous@cvs.glide.sourceforge.net:/cvsroot/glide login &&
138  cvs -d:pserver:anonymous@cvs.glide.sourceforge.net:/cvsroot/glide -z3 co glide3x &&
139  cvs -d:pserver:anonymous@cvs.glide.sourceforge.net:/cvsroot/glide -z3 co swlibs &&
140  cvs -d:pserver:anonymous@cvs.glide.sourceforge.net:/cvsroot/glide logout &&
141  mv swlibs/ glide3x/
144 ============================
145 3.2 LINK-ONLY X INSTALLATION
146 ============================
148   We'll have to build a minimal X installation to link Glide against. Glide is
149 needed for a properly working DRI driver for 3Dfx cards. Since it should be a
150 very minimal installation, you just need the sources in the first tarball for X.
151 Extract the sources with this command (while you're in the /usr/src directory):
153  tar xzvf /path/to/X420src-1.tgz
155   To build X, we'll need a special host.def. I suggest you copy paste this file
156 because it's pretty long. Put this in /usr/src/xc/config/cf/host.def (NOTE: The
157 "#"s at the beginning of lines are _not_ comments):
159 (TODO: Does this still work with 4.2.0?)
161 -------------------------------------------------
162 #define DefaultCCOptions                -w
163 #define TermcapLibrary                  -lncurses
165 #define XF86CardDrivers                 vga
166 #define XInputDrivers                   void
168 #define BuildServersOnly                YES
169 #define XVirtualFrameBufferServer       NO
171 #define BuildFontServer                 NO
172 #define BuildFonts                      NO
174 #define BuildMITMiscExt                 NO
175 #define BuildTestExt                    NO
176 #define BuildSyncExt                    NO
177 #define BuildXF86MiscExt                NO
178 #define BuildXF86RushExt                NO
179 #define BuildBigReqsExt                 NO
180 #define BuildEVI                        NO
181 #define BuildDBE                        NO
182 #define BuildDBElib                     NO
183 #define BuildDPMS                       NO
184 #define BuildFontCache                  NO
185 #define BuildXIE                        NO
186 #define BuildXIElib                     NO
187 #define BuildXKB                        NO
188 #define BuildRECORD                     NO
189 #define BuildRECORDlib                  NO
190 #define BuildXCSecurity                 NO
191 #define BuildAppgroup                   NO
192 #define BuildCup                        NO
193 #define BuildDPSLibraries               NO
194 #define BuildRenderLibrary              NO
195 #define BuildXF86DRI                    NO
196 #define BuildPexExt                     NO
197 #define BuildGlxExt                     NO
198 #define BuildXinerama                   NO
199 #define BuildRender                     NO
200 #define BuildScreenSaverLibrary         NO
201 #define BuildXvLibrary                  NO
202 #define BuildGLXLibrary                 NO
203 #define BuildXF86VidModeExt             NO
204 #define BuildXF86MiscLibrary            NO
205 #define BuildXF86BigfontExt             NO
206 #define BuildFreeType                   NO
207 #define BuildXTrueType                  NO
208 #define BuildCID                        NO
209 #define BuildType1                      NO
210 #define BuildSpeedo                     NO
212 #define LinuxFBDevSupport               NO
213 #define UseX86Emu                       NO
215 #define XF1Bpp                          NO
216 #define XF4Bpp                          NO
217 #define XF8_32Bpp                       NO
218 #define XF8_16Bpp                       NO
219 #define XF24_32Bpp                      NO
220 #define XFShadowFB                      NO
221 #define XF86VgaHw                       NO
222 #define XF86FBDevHw                     NO
223 #define XF86XAA                         NO
224 #define XF86Ramdac                      NO
225 #define XF86I2C                         NO
226 #define XF86DCC                         NO
227 #define XF86RAC                         NO
228 #define XF86Int10                       NO
229 #define XF86AFB                         NO
230 -------------------------------------------------
232   Now that we have the host.def, it's time to build X. Enter the following
233 commands to build X:
235  cd /usr/src/xc &&
236  make World
238   The build will take about 10 minutes on a fast system. Note that the build
239 isn't functional since some essential stuff was removed from it. It serves
240 our purposes though. Enter the following commands to prepare the environment
241 for compiling Glide:
243  cd /usr &&
244  ln -s src/xc/exports X11R6 &&
245  cd include &&
246  ln -s ../X11R6/include/X11 &&
247  echo "/usr/X11R6/lib" >>/etc/ld.so.conf &&
248  ldconfig
250 NOTE: Don't remove /usr/src/xc yet! We'll do that later.
253 ======================
254 3.3 INSTALLING GLIDE 3
255 ======================
257   There is a bug in Glide 3 which forces you to use automake < 1.5. If you're
258 using a newer version, like 1.5 which is currently used in the book, you
259 should install automake 1.4-p5 next to it. First, get the older automake from
260 ftp://ftp.gnu.org/gnu/automake/automake-1.4-p5.tar.gz Extract the tarball,
261 and run these commands to install automake in a temporary location:
263  ./configure --prefix=$HOME/automake-temp &&
264  make INSTALL="install -c -D" install &&
265  cp /usr/share/aclocal/libtool.m4 ~/automake-temp/share/aclocal
267   Copy the glide3x directory that was created during the CVS checkout over to
268 /usr/src, and put the swlibs directory (from the checkout) in the glide3x
269 directory. Enter the /usr/src/glide3x directory and enter the following
270 commands to generate a configure script:
272  ~/automake-temp/bin/aclocal &&
273  ~/automake-temp/bin/automake &&
274  autoconf
276   Now we can configure glide. Replace <card type> with "h3" for a Voodoo Banshee
277 or Voodoo 3, or with "h5" for the Voodoo 4/5 series. Run these commands:
279  ./configure --prefix=/usr --enable-fx-glide-hw=<card type> \
280              --enable-fx-build-dri --enable-shared --enable-static &&
281  ./ltconfig ltmain.sh
283   The final step is to compile glide. Replace <arch> with your machine type.
284 To find out what machine you are using, run "uname -m". Run these commands
285 to compile and install glide:
287  make GLIDE_DEBUG_GCFLAGS="-O3 -march=<arch>" -f makefile.autoconf all &&
288  make GLIDE_DEBUG_GCFLAGS="-O3 -march=<arch>" -f makefile.autoconf install
290   Now we have glide compiled and installed, we can trash the symlinks created
291 in chapter 3.2 and the temporary automake installation:
293  rm -f /usr/X11R6 &&
294  rm -f /usr/include/X11 &&
295  rm -rf ~/automake-temp
297   Make sure you remove the /usr/src/xc and /usr/src/glide3x directories as
298 well, we won't need them any more.
301 ========================
302 3.4 3DFX TROUBLESHOOTING
303 ========================
305 * Q1: I get this message when I build Glide:
306 ------------------------------------------------------------------
307 linhwc.c:64: X11/Xlib.h: No such file or directory
308 linhwc.c:65: X11/extensions/xf86dga.h: No such file or directory
309 linhwc.c:66: X11/extensions/xf86vmode.h: No such file or directory
310 ------------------------------------------------------------------
311 * A1: Either you forgot to create the symlink from /usr/include/X11 to
312 /usr/X11R6/include/X11 in chapter 3.2, or you removed the /usr/src/xc directory
313 before you started building glide. In the first case, scroll back to chapter
314 3.2 and create the link, in the second case you'll have to build the link-only
315 X installation again :(.
317 * Q2: Building Glide fails with the --enable-amd3d flag!
318 * A2: Yes it does. Remove it to build Glide without problems. This problem is
319 due to a missing .S file, because 3Dnow! support for Glide hasn't been ported
320 to Linux (yet?).
323 ===============
324 4. MATROX CARDS
325 ===============
327   A friend of mine had a G400 long before I had one. I had some experience
328 installing DRI for that card before I got mine, so it took me only 60 minutes
329 (the X build) to set it up.
330   The Matrox DRI drivers are listed on dri.sourceforge.net as
331 development/unstable. Don't let this mislead you, because I found them pretty
332 fast (80 fps in Q3A) and pretty stable as well (crashed only afted 8 hours of
333 spinning the XMMS OpenGL Plugin). We'll use the Matrox HAL library in our X
334 build. This library is not opensource, but it's a library that enables some
335 features that are not supported by default with the stock X drivers, such as
336 multi head and flat panel output. This library is not required for 3D
337 rendering.
340 =========================
341 4.1 MATROX SPECIFIC FILES
342 =========================
344 Matrox HAL Library:
346   ftp://ftp.matrox.com/pub/mga/archive/linux/2001/beta_133_143/mga-133_143-source.tgz
349 ===============
350 4.2 PREPARING X
351 ===============
353   Start by extracting all three source tarballs for X into /usr/src. We'll have
354 to modify the source tree somewhat to enable the HAL library. Extract
355 mga-133_143-source.tgz to /usr/src as well. Now run the following commands to
356 install the HAL library (from the /usr/src directory):
358  cp mgasource/mga-1.4.3/mga/HALlib/* \
359     xc/programs/Xserver/hw/xfree86/drivers/mga/HALlib
362 ===========================
363 5. THE FINAL X INSTALLATION
364 ===========================
366   We've come to the point that we're ready to install X. If you didn't already
367 do so, extract the X420src-1.tgz, X420src-2.tgz and X420src-3.tgz files into
368 /usr/src. You should have a /usr/src/xc directory, with the HAL Library
369 installed into it if you're using a Matrox card (see chapter 4).
372 =====================
373 5.1 ZLIB INSTALLATION
374 =====================
376   Extract zlib-1.1.3 in /usr/src. Enter the newly created zlib-1.1.3 directory
377 and run the following commands to install zlib:
379  sed s/\\$\(OBJS\)$/\\$\(OBJS\)\ \\$\(OBJA\)/ Makefile.in >tmp~
380  mv tmp~ Makefile.in
381  cp contrib/asm<arch>match.S .
382  CFLAGS="-O3 -march=<machine type> -DASMV" ./configure --prefix=/usr &&
383  make OBJA=match.o &&
384  make install &&
385  CFLAGS="-O3 -march=<machine type> -DASMV" ./configure --prefix=/usr --shared &&
386  make OBJA=match.o &&
387  make install
389   Notes: Replace <arch> with your architecture, such as 586 for an Intel
390 Pentium 1 or 686 for a Pentium II/III or Athlon. Replace <machine type> with
391 your machine type. You can find out both these values by running "uname -m";
392 <machine type> is the full output, <arch> is the output minus the first "i".
395 ==================
396 5.2 X INSTALLATION
397 ==================
399   Copy the host.def you downloaded in chapter 2.1 to the X configuration
400 directory (/usr/src/xc/config/cf/) and open it in a text editor. Read through
401 the file and adjust the settings as necessary. If you want more control (the
402 defines included in this host.def should normally suffice), use xf86site.def
403 as a starting point. When you've finished editing host.def, you can start
404 the build process for XFree86. Enter the /usr/src/xc directory, and run the
405 following command to build X:
407  make World |tee -i World.LOG
409   By using tee, we can both save the output of the make command to a file
410 (World.LOG) and print the output to the screen at the same time. This allows
411 you to follow the build process, but if any errors occured you'll have them
412 handy in a file.
413   Building will take about 60 minutes on a fast machine, or 60 hours on a slow
414 machine. I suggest you visit slashdot, get yourself a cup of tea or do
415 something else interesting instead of following the build process closely. It's
416 very annoying watching those lines scroll by and we're creating a log file
417 anyway.
418   When the build is finished, open World.LOG in a text pager and search for
419 "***". If they're found, you had an error while building X and you'll probably
420 want to solve that. If it's not found, add /usr/X11R6/lib to /etc/ld.so.conf
421 (if not already present) and run these commands to install X:
423  make install &&
424  make install.man &&
425  cd /usr &&
426  ln -s X11R6 X11 &&
427  cd /usr/include &&
428  ln -s ../X11R6/include/X11 &&
429  cd /var &&
430  ln -s ../usr/X11R6/lib/X11 &&
431  ldconfig
433   Lucky you! You just built yourself a DRI X installation! Remove the sources
434 for X if you like, because we won't need them any more.
437 ===================
438 6. THE GLUT LIBRARY
439 ===================
441   Unfortunately not everything we need comes with X. About all programs that
442 use OpenGL need the library as well, so we'll install it here. We'll use the
443 version of glut that comes with Mesa, because it has been adapted to work with
444 X. Mesa is a huge download though, especially since we're only using the glut
445 library from it. Install the glut library from Mesa using these commands (as
446 usual, replace <arch> with your architecture):
448  CFLAGS="-O3 -march=<arch>" CXXFLAGS=$CFLAGS \
449  ./configure --prefix=/usr/X11R6 --enable-shared --enable-static &&
450  cd src-glut &&
451  make &&
452  make install &&
453  cd ../include/GL &&
454  install -m 444 -o root glut.h /usr/X11R6/include/GL
456   There are some other useful things included with Mesa, such as the demos.
457 If you want to build them to measure performance, run the following commands
458 to build them:
460  cd demos &&
461  for FILE in *.c; do
462    echo $FILE
463    DEMO="`echo $FILE |sed s/\.c$//`"
464    gcc -w -I/usr/X11R6/include -I../util -L/usr/X11R6/lib -lGL -lGLU \
465        -lOSMesa -lglut -o ${DEMO} ${FILE}
466  done
468   You'll see that building one of the demos fails, the others work though. Now
469 you've got a bunch of accellerated demos.
472 ================
473 7. CONFIGURATION
474 ================
476   Cool. DRI and the helper libraries are installed. Now what do we have to do to
477 make everything working? This chapter explains how you should configure
478 essential software for DRI.
481 ========================
482 7.1 KERNEL CONFIGURATION
483 ========================
485   The kernel provides some options that affect the behaviour of DRI. I'll
486 explain the purpose of each of them here. These explanations are based on the
487 2.4 kernel series, that should be used for DRI.
490 =========
491 7.1.1 DRI
492 =========
494   The first and most important is kernel support for DRI and the 3Dfx cards.
495 The options for this can be found in the section "Character Devices" of the
496 kernel configuration (make menuconfig). At the bottom, there's an option:
498 [ ] Direct Rendering Manager (XFree86 4.1.0 and higher DRI support)
500 (Taken from the kernel 2.4.17 menuconfig)
502   This option has to be enabled for DRI to work. Press space if you don't have
503 a "*" between the square brackets. If this option is enabled, you'll get a
504 submenu:
506 < >   3dfx Banshee/Voodoo3+
507 < >   3dlabs GMX 2000
508 < >   ATI Rage 128
509 < >   ATI Radeon
510 < >   Intel I810
511 < >   Matrox g200/g400
512 < >   SiS
514 (Taken from the kernel 2.4.17 menuconfig)
516   Select "3dfx Banshee/Voodoo3+" for a 3Dfx card, and "Matrox g200/g400" for a
517 Matrox card. You can compile the driver either as a module ("M") or directly
518 into the kernel ("*"); the X server will load the module as needed.
521 =========
522 7.1.2 AGP
523 =========
525   The kernel also provides support for the AGP buses found on many recent
526 motherboards. The reason this was implemented relatively late, is that the AGP
527 bus is actually a slightly improved PCI bus (that's why AGP cards have a PCI
528 device ID). The interface to the AGP bus is called "agpgart". The
529 implementation depends on the motherboard chipset you are using. The options
530 for agpgart can be found in the "Character Devices" section of the kernel
531 configuration. Almost at the bottom, you see this:
533 < > /dev/agpgart (AGP Support)
535 (Taken from the kernel 2.4.17 menuconfig)
537 There should be a "*" between the <> signs, so press space until it's there.
538 A submenu will show up:
540 [ ]   Intel 440LX/BX/GX and I815/I830M/I840/I850 support
541 [ ]   Intel I810/I815/I830M (on-board) support
542 [ ]   VIA chipset support
543 [ ]   AMD Irongate, 761, and 762 support
544 [ ]   Generic SiS support
545 [ ]   ALI chipset support
546 [ ]   Serverworks LE/HE support
548 (Taken from the kernel 2.4.17 menuconfig)
550   Select your chipset from the list, and press "space" so that a "*" appears in
551 the square brackets. If you don't know what chipset you're using, enable all of
552 these chipsets, the correct one will be recognized at boot time.
554 ** If you're using a PCI type card, you won't (of course) have to do this! **
557 ==========
558 7.1.3 MTRR
559 ==========
561   MTRR stands for "Memory Type Range Register". This is a register in the
562 processor to control processor access to memory ranges, thus it improves
563 performance of PCI and AGP cards dramatically. If MTRRs are enabled, X will
564 detect them automatically and use them. Intel processors have MTRRs if they
565 are Pentium Pro or newer. AMD processors have MTRR support from the K6-2. If
566 you don't know what processor you're using, or if it's neither an Intel nor an
567 AMD processor, you can safely enable MTRR support, because it won't be used if
568 it's not supported by your processor. You can find the MTRR option in the
569 "Processor type and features" section of the kernel configuration. The option
570 to enable it looks like this:
572 [ ] MTRR (Memory Type Range Register) support
574 (Taken from the kernel 2.4.17 menuconfig)
577 =======================
578 7.1.4 CHECK IF IT WORKS
579 =======================
581   If you have modified your kernel configuration at the points I told you
582 about, it's time to compile and install the new kernel. When the system has
583 booted with the new kernel, we can test if everything works. Let's start by
584 running:
586  dmesg |less
588   This will open the kernel boot messages in the text pager less. For each of
589 the modifications that I discussed, search for a specific string in the dmesg
590 output. I'll give some examples:
592 * MTRR Support can be found by searching for "mtrr". My system tells me:
594 mtrr: v1.40 (20010327) Richard Gooch (rgooch@atnf.csiro.au)
595 mtrr: detected mtrr type: Intel
597 * AGP Support can be found by searching for "agpgart". This is what I get:
599 Linux agpgart interface v0.99 (c) Jeff Hartmann
600 agpgart: Maximum main memory to use for agp memory: 321M
601 agpgart: Detected Via Apollo Pro KT133 chipset
602 agpgart: AGP aperture is 64M @ 0xd0000000
604 * DRI Support can only be found if the module for your card is directly
605 compiled into the kernel (or if the X server has been started with DRI
606 enabled). Search for "drm" to get something like:
608 [drm] AGP 0.99 on VIA Apollo KT133 @ 0xd0000000 64MB
609 [drm] Initialized mga 3.0.2 20000928 on minor 63
611 for Matrox cards or
613 [drm] AGP 0.99 on VIA Apollo KT133 @ 0xd6000000 16MB
614 [drm] Initialized tdfx 1.0.0 20000928 on minor 63
616 for 3Dfx cards.
618 If all of these match, the kernel part is OK.
621 =======================
622 7.2 XFREE CONFIGURATION
623 =======================
625   The next step to get DRI to work, is configuring XFree. This can be done in a
626 very fast and easy way. Run (as root):
628  XFree86 -configure
630   This will detect the video card you're using, the mouse type (if you have a
631 /dev/mouse device or symlink), the keyboard and even the monitor if your
632 monitor supports that. The configuration file it generates is pretty usable
633 (although some people want you to believe it's horrible), but it needs some
634 adjustments. The configuration file is temporary saved in /root/XF86Config.new.
635 Open this file in a text editor, and make the following changes:
637 * In Section "Files":
638 The default X installation has more FontPaths than there are in this file. Add
639 every directory in /usr/X11R6/lib/X11/fonts to the FontPaths listed here.
641 * In Section "Module":
642 Add 'Load  "type1"' and 'Load  "freetype"' to enable support for Type 1 and
643 TrueType fonts. Make sure the "GLcore", "dbe", "glx" and "dri" drivers are
644 loaded!
646 * Configure the sections "InputDevice" to fit your preferences.
648 * In Section "Monitor":
649 If these values weren't autodetected, you'll have to add both "HorizSync" and
650 "VertRefresh" manually. Consult your monitor handbook for these values. Be
651 careful, you might destroy your Monitor when these settings are wrong.
653 * In Section "DRI":
654 Add "Mode 0666" to this section to enable Direct Rendering for everybody, so
655 it can be used by other users than only root.
657 * In Section "Screen":
658 Add a definition for "DefaultDepth" to the main section (eg. between the
659 "Monitor" definition and the first subsection). !This should be 16 for DRI to
660 work! It looks like this:
662 DefaultDepth 16
664 Add in each of the subsections "Display" some screen resolutions:
666 Modes     "1600x1200" "1280x1024" "1280x960" "1024x768" "800x600" "640x480"
668 The first resolution in the "Modes" definition in the subsection for the
669 default color depth is the resolution that's going to be the default.
671   If you have made these changes, it's safe to test your configuration. By
672 default, a log file will be created under /var/log (usually XFree86.0.log).
673 Open this file and browse to the end of it. There should be these lines near
674 the end:
676 (II) TDFX(0): [DRI] installation complete
677 (==) TDFX(0): Direct rendering enabled
681 (II) MGA(0): [DRI] installation complete
682 (==) MGA(0): Direct rendering enabled
684 by now, you can probably guess which one is for which card.
687 =========
688 8 TESTING
689 =========
691   If you have followed this entire hint, you probably want to see it working
692 (why would you otherwise go through all this pain). I have made a small
693 selection of programs that can be useful in testing the DRI subsystem.
695 * glxinfo. This utility is part of a standard XFree installation. If you run
696 it, you should get "direct rendering: Yes" as the second line of the output.
698 * xdpyinfo. This program comes with the standard XFree installation. Check in
699 the output for "GLX", "SGI-GLX" and "XFree86-DRI". If all three are preset,
700 the extensions were loaded successfully.
702 * The OpenGL Spectrum Analyzer that comes with XMMS (http://www.xmms.org/).
703 This doesn't work in 3dfx fullscreen mode on the 3Dfx cards since Glide 2
704 isn't installed. You can have phun with it in a small window too, so who cares.
706 * Tuxracer (http://tuxracer.sourceforge.net/). A must-have for every 1337 h4x0r
707 and for everybody who likes a funny game. I love it! You'll need some additional
708 libraries (SDL, SDL_mixer and tcl) to get this to work, but it's really worth
709 it... :PP
711 * Quake III Arena. It heavily uses the OpenGL subsystem, so this is both a very
712 good test and a very good benchmark. If you have the windows version, get the
713 linux version @ ftp://ftp.idsoftware.com/pub/idstuff/quake3/linux/ (~12 MB).
714 Untar it into a directory (/usr/games/quake3, /opt/quake3 or whatever) and add
715 the pak0.pak from the CD and the pak1.pak and pak2.pak from Quake III 1.17.
716 Then run quake3.x86 and let the fragging begin :)
718 * The OpenGL screensavers in the xscreensaver distribution
719 (http://www.jwz.org/xscreensaver/). You'll need the GLE library
720 (http://www.linas.org/gle/) for an optimal working xscreensaver.
722 * The Mesa demo programs; for instructions see chapter 6.
725 ==========================
726 9. GENERIC TROUBLESHOOTING
727 ==========================
729 * Q1: The XFree logfile tells me that DRI is disabled, but I've done everything
730 right and I'm using 24 bit colors by default!
731 * A1: You need 16 bit color for most cards for DRI to work.
733 * Q2: Compiling X fails with a message about undefined/missing targets. What
734 should I do??
735 * A2: This problem is caused by a broken imake. It will be recompiled next time
736 you start the build. So the only thing you can do is restart the build and pray
737 that imake will work this time...
739 * Q4: I have another problem!
740 * A4: Mail me <marc@koelkast.net> I'll do my best to provide you with a
741 solution.
744 ==============
745 10. WHAT NEXT?
746 ==============
748   I have received some complaints from people who didn't know what to do next,
749 after they have finished this hint. I'll try to give you some guidelines what
750 you can do with your brand new X installation. This section is mainly intended
751 for newbies, eg. it has nothing to do with the main subject of this hint:
752 setting up DRI. If you don't feel like a newbie and you've set up a full X
753 workstation before, don't even try to read this because it will probably be
754 very boring for you.
755   This part is mainly intended to fill the gap between this hint and other
756 hints, that deal with specific applications and libraries. Those applications
757 and libraries depend on some very common libraries, such as a font handling
758 library and image libraries. These are the libraries you'll be installing in
759 this chapter, because some of them are not really straightforward to install.
760   Another problem many newbies are facing is that they don't know what window
761 manager they should use. I'm not going into detail here (because if I did, this
762 part would be much longer than the hint itself), but I'll try to give you some
763 ideas.
764   Last but not least, I'll try to give you some references to other hints which
765 you will probably find useful. These references are stated between the lines,
766 but I'm sure you'll notice them if you read carefully. Good luck, soldier! :)
769 ====================
770 10.1 IMAGE LIBRARIES
771 ====================
773   Image libraries are, as the name suggests, libraries that have to do with
774 reading from, writing to and manipulating images. Each format has it's own image
775 library. The libraries we'll be installing are the ones for the most common
776 image types and the ones that are usually found on all linux systems. If a
777 library is not listed here, don't think your linux system will be unable to read
778 them! Specific libraries are only needed for images that are a) complicated or
779 b) that have Afganic licenses, so they can't be easily copy-pasted in any
780 program. One useful addition to this list might be "libmng," a library for
781 animated PNG images if you're planning to install KDE.
784 ===================
785 10.1.1 NEEDED FILES
786 ===================
788  http://www.libpng.org/pub/png/src/libpng-1.2.1.tar.gz
789  http://www.ijg.org/files/jpegsrc.v6b.tar.gz
790  http://www.ibiblio.org/pub/Linux/libs/graphics/libungif-4.1.0.tar.gz
791  ftp://ftp.remotesensing.org/pub/libtiff/tiff-v3.5.7.tar.gz
792  http://www.littlecms.com/lcms-1.08.tar.gz
793  http://www.libmng.com/download/libmng-1.0.3.tar.gz
796 =============
797 10.1.2 LIBPNG
798 =============
800   Extract the libpng-1.2.1.tar.gz tarball into /usr/src. Now enter the
801 following commands to install libpng:
803  sed -e 's&ZLIBLIB=\.\./zlib&ZLIBLIB=/usr/lib&' \
804      -e 's&ZLIBINC=\.\./zlib&ZLIBLIB=/usr/include&' \
805      scripts/makefile.linux >Makefile &&
806  make &&
807  make install
810 ===========
811 10.1.3 JPEG
812 ===========
814   Extract the jpegsrc.v6b.tar.gz tarball into /usr/src. Enter the newly created
815 /usr/src/jpeg-6b directory. Enter the following commands to install jpeg:
817  ./configure --enable-shared --enable-static &&
818  make &&
819  make install
822 ===============
823 10.1.4 LIBUNGIF
824 ===============
826   Extract the libungif-4.1.0.tar.gz tarball into /usr/src. Enter the newly
827 created /usr/src/libungif-4.1.0 directory. Enter the following commands to
828 install libungif:
830  ./configure &&
831  make &&
832  make install
835 ===========
836 10.1.5 TIFF
837 ===========
839   Extract the tiff-v3.5.5.tar.gz tarball into /usr/src. Enter the newly created
840 /usr/src/tiff-v3.5.5 directory. Open configure in a text editor and find these
841 lines:
843 DIRS_LIBINC=                            # dirs to search for ancillary includes
844 DIR_JPEGLIB=                            # dir for IJG -ljpeg
845 DIR_GZLIB=                              # dir for zlib -lgz
847   Change them to:
849 DIRS_LIBINC=/usr/local/include          # dirs to search for ancillary includes
850 DIR_JPEGLIB=/usr/local/lib              # dir for IJG -ljpeg
851 DIR_GZLIB=/usr/lib                      # dir for zlib -lgz
853   Now find these:
855 JPEG=no                                 # configure JPEG support
856 ZIP=no                                  # configure ZIP/Deflate support
858   And change to:
860 JPEG=yes                                # configure JPEG support
861 ZIP=yes                                 # configure ZIP/Deflate support
863   Finally, find this line in Makefile.in:
865 @${ECHO} "= "man; cd man; ${MAKE} -${MAKEFLAGS} install
867   and remove it. Now run these commands to install tiff:
869  ./configure (press enter when promped "are these ok?")
870  make &&
871  make install &&
872  install -m 0755 -o root libtiff/libtiff.so.3.5.7 /usr/local/lib/libtiff.so.3.5.7
874   As always, run "ldconfig" to initialize the new libraries (make sure
875 /usr/local/lib is in /etc/ld.so.conf).
878 ===========
879 10.1.6 LCMS
880 ===========
882   Extract the lcms-1.08.tar.gz tarball into /usr/src. Now enter the
883 following commands to install lcms:
885  make BASEDIR=/usr/local &&
886  make BASEDIR=/usr/local install &&
887  mkdir /usr/local/include/lcms &&
888  ln -s ../lcms.h /usr/local/include/lcms
891 =============
892 10.1.7 LIBMNG
893 =============
895   Extract the libmng-1.0.3.tar.gz tarball into /usr/src. Now enter the
896 following commands to install lcms:
898  ./configure &&
899  make &&
900  make install &&
901  rm -r /usr/local/include/lcms
904 =============
905 10.2 FREETYPE
906 =============
908   Freetype is the true-type font handling library. These true-type fonts are the
909 fonts that are used on Windows systems. They provide excellent scalability with
910 a decent quality. Freetype comes in two flavours, freetype 1 and freetype 2.
911 These two versions are not compatible, freetype 2 is an entirely new project. To
912 make sure every program can find the freetype version it requires, it's a good
913 idea to install them both.
916 ===================
917 10.2.1 NEEDED FILES
918 ===================
920  http://prdownloads.sourceforge.net/freetype/freetype-1.3.1.tar.gz
921  http://prdownloads.sourceforge.net/freetype/freetype-2.0.6.tar.gz
922  http://www.joerg-pommnitz.de/TrueType/ttmkfdir.tar.gz
925 =================
926 10.2.2 FREETYPE 1
927 =================
929   Extract the freetype-1.3.1.tar.gz tarball into /usr/src. Enter the newly
930 created /usr/src/freetype-1.3.1 directory and enter the following commands to
931 install freetype 1:
933  ./configure --enable-static --enable-shared &&
934  make &&
935  make install
938 =================
939 10.2.3 FREETYPE 2
940 =================
942   Extract the freetype-2.0.6.tar.gz tarball into /usr/src. Enter the newly
943 created /usr/src/freetype-2.0.6 directory and enter the following commands to
944 install freetype 2:
946  make setup &&
947  make &&
948  make install
950   Don't forget to run ldconfig after you've installed a library! Make this a
951 habit!
954 ===============
955 10.2.4 TTMKFDIR
956 ===============
958   To be able to use TTF fonts with XFree86, you'll have to create fonts.scale
959 files to be able to generate the fonts.dir files. A nice utility to create
960 these fonts.scale files is ttmkfdir. Extract the tarball into /usr/src, and
961 run the following commands to install ttmkfdir into /usr/X11R6/bin:
963  mkdir ttmkfdir &&
964  tar xzvf /path/to/ttmkfdir.tar.gz &&
965  cd ttmkfdir &&
966  make clean &&
967  make FREETYPE_INCL="/usr/local/include/freetype" \
968       FREETYPE_LIB="-L/usr/local/lib -lttf" &&
969  install -m 0755 -o root ttmkfdir /usr/X11R6/bin
971   When you've added TTF files to the TTF folder, you can run the following
972 commands to update the fonts.dir file:
974  ttmkfdir >fonts.scale &&
975  mkfontdir
978 ==============================
979 10.3 CHOOSING A WINDOW MANAGER
980 ==============================
982   In this chapter I'm going to help you choose a WM (Window Manager). A WM is,
983 as the name suggests, a program that manages your windows. To be more specific,
984 a WM takes care all window handling issues, such as creating a window on the
985 screen, drawing the window on the screen, and destroying it. Many window
986 managers have much additional functionality, such as the ability to launch your
987 programs or set the background.
989   Before you start thinking that everything is a wm, I'll give you some theory.
990 In Linux, two sorts of "Window Managers" exist: the real WMs and the Desktop
991 Environments (DEs from now on). These DEs do a lot more than just managing your
992 windows. A little list:
994 DE features:
995 - taskbar ala Windows
996 - integrated configuration program
997 - desktop look'n'feel
998 - own program collection
1000   A DE consists of many different programs and libraries, while a WM generally
1001 consists of only one or two programs that depend on other, common libraries.
1002 There are currently two big DEs that you should take a look at: Gnome and KDE.
1003 KDE provides a feeling just like Windows, has its own toolkit and a variety of
1004 programs, has its own office suite, has its own browser and is the stabler of
1005 the two. Gnome on the other hand, does not have its own window manager (this is
1006 a pro - freedom of choice), is more slick in presentation, is faster and is
1007 based on a more widely used toolkit. I personally prefer Gnome, because it's the
1008 least Windows-like of the two. As always, make your own choice. There are hints
1009 available for both DEs at the LFS hint section.
1011   So far the DEs. Now we get to the real stuff, the WMs. If you didn't run away
1012 searching for a DE hint, you're my friend. DEs are for lamers and weenies, real
1013 1337 h4x0rs use real window managers ;-). There is a wide variety of window
1014 managers available (search freshmeat for an idea) so I'll discuss the most
1015 common window managers.
1016   A good WM for newbies to start with is IceWM. It's not hard to install,
1017 features a taskbar and fine themeability. It's pretty fast and easy to use. Use
1018 this one if you want to focus on learning linux, not on learning to use a WM.
1019   Another wide-spread WM is WindowMaker. This one is also a very popular
1020 newbie-WM, although many more experienced linux users seem to like it too. This
1021 WM doesn't work very straightforward but is not hard to learn. It features a
1022 program launch menu, multiple desktops and slick graphics.
1023   A similar graphics implementation is used by BlackBox. This WM is very well
1024 known for its speed. Additionally, it's often referred to as the second most
1025 beautiful so it may be the right WM for you. It's not the easiest WM though,
1026 because the WM is very limited; you'll have to edit menus with a text-editor for
1027 example. Some features: multiple desktops, themeability and speed.
1028   The last in row is the king of them all, IMO: Enlightenment. This WM is the
1029 most beautiful of all WMs in the world. The whole environment consists of
1030 pictures, the themes are built from pictures. Many great artists have put
1031 together astonishing themes for this WM. A list of features: launch menu,
1032 iconbox (minimized-apps-collector), desktop pagers, multiple desktops, virtual
1033 screens, own configuration dialogs, advanced session control and image
1034 backgrounds. Don't let this list of pros convince you easily, there are also
1035 many downsides to Enlightenment. To name a few: you need a _very_ fast pc to
1036 keep things going smoothly, hard to learn, application menus have to be manually
1037 edited and too many configuration options to learn them all. Many features can
1038 only be accessed through the keyboard. This one is both a beaty and a beast.
1041 ==========================
1042 10.4 GET SOME APPLICATIONS
1043 ==========================
1045   This section is not written yet.
1048 ======================
1049 10.5 WHERE TO GO NEXT?
1050 ======================
1052   This section is not written yet.
1055 ================
1056 11. OUTRODUCTION
1057 ================
1059   Because this didn't really fit in the other chapters, I'll put it here. If
1060 you have a 3Dfx card, you can run:
1062  export FX_GLIDE_SWAPINTERVAL=0
1064   to have the frame send rate of your videocard not in sync with the your
1065 monitors refresh rate. This may increase framerate, but decrease smoothness of
1066 gameplay. It's worth a try...
1068   Now it's time to play with your DRI X server ;) I won't put any more annoying
1069 stuff in here, but I want you to know that I'd like to get some feedback on
1070 this hint. It isn't easy to write it, because I don't know if what works here,
1071 works on other systems too. If you completed this hint successfully, I'd like
1072 you to drop me a line, and if you have encountered errors, please feel free to
1073 annoy me with them. The E-Mail address still is:
1075 <marc@koelkast.net>
1077 - Have fun!
1078   Marc