1 1.1 mrg DRI Compilation Guide 2 1.1 mrg 3 1.1 mrg VA Linux Systems, Inc. Professional Services - Graphics. 4 1.1 mrg 5 1.1 mrg 21 April 2001 6 1.1 mrg 7 1.1 mrg 1. Preamble 8 1.1 mrg 9 1.1 mrg 1.1 Copyright 10 1.1 mrg 11 1.1 mrg Copyright 2000-2001 by VA Linux Systems, Inc. All Rights Reserved. 12 1.1 mrg 13 1.1 mrg Permission is granted to make and distribute verbatim copies of this document 14 1.1 mrg provided the copyright notice and this permission notice are preserved on all 15 1.1 mrg copies. 16 1.1 mrg 17 1.1 mrg 1.2 Trademarks 18 1.1 mrg 19 1.1 mrg OpenGL is a registered trademark and SGI is a trademark of Silicon Graphics, 20 1.1 mrg Inc. Unix is a registered trademark of The Open Group. The `X' device and X 21 1.1 mrg Window System are trademarks of The Open Group. XFree86 is a trademark of 22 1.1 mrg The XFree86 Project. Linux is a registered trademark of Linus Torvalds. 23 1.1 mrg Intel is a registered trademark of Intel Corporation. 3Dlabs, GLINT, and 24 1.1 mrg Oxygen are either registered trademarks or trademarks of 3Dlabs Inc. Ltd. 25 1.1 mrg 3dfx, Voodoo3, Voodoo4, and Voodoo5 are registered trademarks of 3dfx Inter- 26 1.1 mrg active, Incorporated. Matrox is a registered trademark of Matrox Electronic 27 1.1 mrg Systems Ltd. ATI Rage and Radeon is a registered trademark of ATI Technolo- 28 1.1 mrg gies, Inc. All other trademarks mentioned are the property of their respec- 29 1.1 mrg tive owners. 30 1.1 mrg 31 1.1 mrg 2. Introduction 32 1.1 mrg 33 1.1 mrg This document describes how to download, compile and install the DRI. The 34 1.1 mrg DRI provides 3D graphics hardware acceleration for the XFree86 project. This 35 1.1 mrg information is intended for experienced Linux developers. Beginners are 36 1.1 mrg probably better off installing precompiled packages. 37 1.1 mrg 38 1.1 mrg Edits, corrections and updates to this document may be mailed to <brian@tung- 39 1.1 mrg stengraphics.com>. 40 1.1 mrg 41 1.1 mrg Last updated on 13 February 2002 by Brian Paul. 42 1.1 mrg 43 1.1 mrg 3. Prerequisites 44 1.1 mrg 45 1.1 mrg You'll need the following: 46 1.1 mrg 47 1.1 mrg o An installation of XFree86 4.1 or later. The DRI tree has been pruned 48 1.1 mrg down to minimize its size. But in order to build the DRI tree you need 49 1.1 mrg to have recent X header files, etc. already installed. If you don't 50 1.1 mrg have XFree86 4.1 (or later) installed you can probably install it from 51 1.1 mrg RPMs (or another package format). Or, you can download XFree86 as 52 1.1 mrg sources and compile/install it yourself. 53 1.1 mrg 54 1.1 mrg o At least 200MB of free disk space. If you compile for debugging (the -g 55 1.1 mrg option) then you'll need about 600MB. 56 1.1 mrg 57 1.1 mrg o GCC compiler and related tools. 58 1.1 mrg 59 1.1 mrg o ssh (secure shell) if you're a DRI developer and don't want to use 60 1.1 mrg anonymous CVS download. 61 1.1 mrg 62 1.1 mrg o A 2.4.x Linux Kernel. See below for details. 63 1.1 mrg 64 1.1 mrg o FreeBSD support is not currently being maintained and may not work. 65 1.1 mrg 66 1.1 mrg The DRI 3D drivers generally work on systems with Intel or AMD CPUs. How- 67 1.1 mrg ever, limited support for Alpha and PowerPC support is underway. 68 1.1 mrg 69 1.1 mrg For 3dfx Voodoo hardware, you'll also need the Glide3 runtime library 70 1.1 mrg (libglide3-v3.so for Voodoo3 or libglide3-v5.so for Voodoo4/5). These can be 71 1.1 mrg downloaded from the DRI website. You can compile them yourself, but it's 72 1.1 mrg often a painful process. 73 1.1 mrg 74 1.1 mrg For Matrox G200/G400, Intel i810/i830 or ATI Rage128/Radeon hardware, you'll 75 1.1 mrg also need AGP support in your Linux kernel, either built-in or as a loadable 76 1.1 mrg module. 77 1.1 mrg 78 1.1 mrg 4. Linux Kernel Preparation 79 1.1 mrg 80 1.1 mrg Only the Linux 2.4.x kernels are currently supported by the DRI hardware 81 1.1 mrg drivers. 2.5.x kernels may work, but aren't tested. 82 1.1 mrg 83 1.1 mrg Most of the DRI drivers require AGP support and using Intel Pentium III SSE 84 1.1 mrg optimizations also requires an up-to-date Linux kernel. Configuring your 85 1.1 mrg kernel correctly is very important, as features such as SSE optimizations 86 1.1 mrg will be disabled if your kernel does not support them. Thus, if you have a 87 1.1 mrg Pentium III processor, you must configure your kernel for the Pentium III 88 1.1 mrg processor family. 89 1.1 mrg 90 1.1 mrg Building a new Linux kernel can be difficult for beginners but there are 91 1.1 mrg resources on the Internet to help. This document assumes experience with 92 1.1 mrg configuring, building and installing Linux kernels. 93 1.1 mrg 94 1.1 mrg Linux kernels can be downloaded from www.kernel.org 95 1.1 mrg 96 1.1 mrg Here are the basic steps for kernel setup. 97 1.1 mrg 98 1.1 mrg o Download the needed kernel and put it in /usr/src. Create a directory 99 1.1 mrg for the source and unpack it. For example: 100 1.1 mrg 101 1.1 mrg cd /usr/src 102 1.1 mrg rm -f linux 103 1.1 mrg mkdir linux-2.4.x 104 1.1 mrg ln -s linux-2.4.x linux 105 1.1 mrg bzcat linux-2.4.x.tar.bz2 | tar xf - 106 1.1 mrg 107 1.1 mrg It is critical that /usr/src/linux point to your new kernel sources, 108 1.1 mrg otherwise the kernel headers will not be used when building the DRI. 109 1.1 mrg This will almost certainly cause compilation problems. 110 1.1 mrg 111 1.1 mrg o Read /usr/src/linux/Documentation/Changes. This file lists the minimum 112 1.1 mrg requirements for all software packages required to build the kernel. 113 1.1 mrg You must upgrade at least gcc, make, binutils and modutils to at least 114 1.1 mrg the versions specified in this file. The other packages may not be 115 1.1 mrg needed. If you are upgrading from Linux 2.2.x you must upgrade your 116 1.1 mrg modutils package for Linux 2.4.x. 117 1.1 mrg 118 1.1 mrg o Configure your kernel. You might, for example, use make menuconfig and 119 1.1 mrg do the following: 120 1.1 mrg 121 1.1 mrg o Go to Code maturity level options 122 1.1 mrg 123 1.1 mrg o Enable Prompt for development and/or incomplete code/drivers 124 1.1 mrg 125 1.1 mrg o hit ESC to return to the top-level menu 126 1.1 mrg 127 1.1 mrg o Go to Processor type and features 128 1.1 mrg 129 1.1 mrg o Select your processor type from Processor Family 130 1.1 mrg 131 1.1 mrg o hit ESC to return to the top-level menu 132 1.1 mrg 133 1.1 mrg o Go to Character devices 134 1.1 mrg 135 1.1 mrg o Disable Direct Rendering Manager (XFree86 DRI support) since we'll 136 1.1 mrg use the DRI code from the XFree86/DRI tree and will compile it 137 1.1 mrg there. 138 1.1 mrg 139 1.1 mrg o Go to /dev/agpgart (AGP Support) (EXPERIMENTAL) (NEW) 140 1.1 mrg 141 1.1 mrg o Hit SPACE twice to build AGP support into the kernel 142 1.1 mrg 143 1.1 mrg o Enable all chipsets' support for AGP 144 1.1 mrg 145 1.1 mrg o It's recommended that you turn on MTRRs under Processor type and 146 1.1 mrg Features, but not required. 147 1.1 mrg 148 1.1 mrg o Configure the rest of the kernel as required for your system (i.e. Eth- 149 1.1 mrg ernet, SCSI, etc) 150 1.1 mrg 151 1.1 mrg o Exit, saving your kernel configuration. 152 1.1 mrg 153 1.1 mrg o Edit your /etc/lilo.conf file. Make sure you have an image entry as 154 1.1 mrg follows (or similar): 155 1.1 mrg 156 1.1 mrg image=/boot/vmlinuz 157 1.1 mrg label=linux.2.4.x 158 1.1 mrg read-only 159 1.1 mrg root=/dev/hda1 160 1.1 mrg 161 1.1 mrg The important part is that you have /boot/vmlinuz without a trailing 162 1.1 mrg version number. If this is the first entry in your /etc/lilo.conf AND 163 1.1 mrg you haven't set a default, then this will be your default kernel. 164 1.1 mrg 165 1.1 mrg o Compile the new kernel. 166 1.1 mrg 167 1.1 mrg cd /usr/src/linux-2.4.x 168 1.1 mrg make dep 169 1.1 mrg make bzImage 170 1.1 mrg make modules 171 1.1 mrg make modules_install 172 1.1 mrg make install 173 1.1 mrg 174 1.1 mrg Note that last make command will automatically run lilo for you. 175 1.1 mrg 176 1.1 mrg o Now reboot to use the new kernel. 177 1.1 mrg 178 1.1 mrg 5. CPU Architectures 179 1.1 mrg 180 1.1 mrg In general, nothing special has to be done to use the DRI on different CPU 181 1.1 mrg architectures. There are, however, a few optimizations that are CPU-depen- 182 1.1 mrg dent. Mesa will determine at runtime which CPU-dependent optimizations 183 1.1 mrg should be used and enable them where appropriate. 184 1.1 mrg 185 1.1 mrg 5.1 Intel Pentium III Features 186 1.1 mrg 187 1.1 mrg The Pentium III SSE instructions are used in optimized vertex transformation 188 1.1 mrg functions in the Mesa-based DRI drivers. On Linux, SSE requires a recent 189 1.1 mrg kernel (such as 2.4.0-test11 or later) both at compile time and runtime. 190 1.1 mrg 191 1.1 mrg 5.2 AMD 3DNow! Features 192 1.1 mrg 193 1.1 mrg AMD's 3DNow! instructions are used in optimized vertex transformation func- 194 1.1 mrg tions in the Mesa-based DRI drivers. 3DNow! is supported in most versions of 195 1.1 mrg Linux. 196 1.1 mrg 197 1.1 mrg 5.3 Alpha Features 198 1.1 mrg 199 1.1 mrg On newer Alpha processors a significant performance increase can be seen with 200 1.1 mrg the addition of the -mcpu= option to GCC. This option is dependent on the 201 1.1 mrg architecture of the processor. For example, -mcpu=ev6 will build specifi- 202 1.1 mrg cally for the EV6 based AXP's, giving both byte and word alignment access to 203 1.1 mrg the DRI/Mesa drivers. 204 1.1 mrg 205 1.1 mrg To enable this optimization edit your xc/config/host.def file and add the 206 1.1 mrg line: 207 1.1 mrg 208 1.1 mrg #define DefaultGcc2AxpOpt -O2 -mcpu=ev6 209 1.1 mrg 210 1.1 mrg Additional speed improvements to 3D rendering can be achieved by installing 211 1.1 mrg Compaq's Math Libraries (CPML) which can be obtained from http://www.sup- 212 1.1 mrg port.compaq.com/alpha-tools/software/index.html 213 1.1 mrg 214 1.1 mrg Once installed, you can add this line to your host.def to build with the CPML 215 1.1 mrg libraries: 216 1.1 mrg 217 1.1 mrg #define UseCompaqMathLibrary YES 218 1.1 mrg 219 1.1 mrg The host.def file is explained below. 220 1.1 mrg 221 1.1 mrg 6. Downloading the XFree86/DRI CVS Sources 222 1.1 mrg 223 1.1 mrg The DRI project is hosted by SourceForge. The DRI source code, which is a 224 1.1 mrg subset of the XFree86 source tree, is kept in a CVS repository there. 225 1.1 mrg 226 1.1 mrg The DRI CVS sources may be accessed either anonymously or as a registered 227 1.1 mrg SourceForge user. It's recommended that you become a registered SourceForge 228 1.1 mrg user so that you may submit non-anonymous bug reports and can participate in 229 1.1 mrg the mailing lists. 230 1.1 mrg 231 1.1 mrg 6.1 Anonymous CVS download: 232 1.1 mrg 233 1.1 mrg 1. Create a directory to store the CVS files: 234 1.1 mrg 235 1.1 mrg cd ~ 236 1.1 mrg mkdir DRI-CVS 237 1.1 mrg 238 1.1 mrg You could put your CVS directory in a different place but we'll use 239 1.1 mrg ~/DRI-CVS/ here. 240 1.1 mrg 241 1.1 mrg 2. Check out the CVS sources: 242 1.1 mrg 243 1.1 mrg cd ~/DRI-CVS 244 1.1 mrg cvs -d:pserver:anonymous (a] cvs.dri.sourceforge.net:/cvsroot/dri login 245 1.1 mrg (hit ENTER when prompted for a password) 246 1.1 mrg cvs -z3 -d:pserver:anonymous (a] cvs.dri.sourceforge.net:/cvsroot/dri co xc 247 1.1 mrg 248 1.1 mrg The -z3 flag causes compression to be used in order to reduce the down- 249 1.1 mrg load time. 250 1.1 mrg 251 1.1 mrg 6.2 Registered CVS download: 252 1.1 mrg 253 1.1 mrg 1. Create a directory to store the CVS files: 254 1.1 mrg 255 1.1 mrg cd ~ 256 1.1 mrg mkdir DRI-CVS 257 1.1 mrg 258 1.1 mrg You could put your CVS directory in a different place but we'll use 259 1.1 mrg ~/DRI-CVS/ here. 260 1.1 mrg 261 1.1 mrg 2. Set the CVS_RSH environment variable: 262 1.1 mrg 263 1.1 mrg setenv CVS_RSH ssh // if using csh or tcsh 264 1.1 mrg export CVS_RSH=ssh // if using sh or bash 265 1.1 mrg 266 1.1 mrg 3. Check out the CVS sources: 267 1.1 mrg 268 1.1 mrg cd ~/DRI-CVS 269 1.1 mrg cvs -z3 -d:ext:YOURID (a] cvs.dri.sourceforge.net:/cvsroot/dri co xc 270 1.1 mrg 271 1.1 mrg Replace YOURID with your CVS login name. You'll be prompted to enter 272 1.1 mrg your sourceforge password. 273 1.1 mrg 274 1.1 mrg The -z3 flag causes compression to be used in order to reduce the down- 275 1.1 mrg load time. 276 1.1 mrg 277 1.1 mrg 6.3 Updating your CVS sources 278 1.1 mrg 279 1.1 mrg In the future you'll want to occasionally update your local copy of the DRI 280 1.1 mrg source code to get the latest changes. This can be done with: 281 1.1 mrg 282 1.1 mrg cd ~/DRI-CVS 283 1.1 mrg cvs -z3 update -dA xc 284 1.1 mrg 285 1.1 mrg The -d flag causes any new subdirectories to be created and -A causes most 286 1.1 mrg recent trunk sources to be fetched, not branch sources. 287 1.1 mrg 288 1.1 mrg 7. Mesa 289 1.1 mrg 290 1.1 mrg Most of the DRI 3D drivers are based on Mesa (the free implementation of the 291 1.1 mrg OpenGL API). The relevant files from Mesa are already included in the 292 1.1 mrg XFree86/DRI source tree. There is no need to download or install the Mesa 293 1.1 mrg source files separately. 294 1.1 mrg 295 1.1 mrg Sometimes a newer version of Mesa will be available than the version included 296 1.1 mrg in XFree86/DRI. Upgrading Mesa within XFree86/DRI is not always straightfor- 297 1.1 mrg ward. It can be an error-prone undertaking, especially for beginners, and is 298 1.1 mrg not generally recommended. The DRI developers will upgrade Mesa when appro- 299 1.1 mrg priate. 300 1.1 mrg 301 1.1 mrg 8. Compiling the XFree86/DRI tree 302 1.1 mrg 303 1.1 mrg 8.1 Make a build tree 304 1.1 mrg 305 1.1 mrg Rather than placing object files and library files right in the source tree, 306 1.1 mrg they're instead put into a parallel build tree. The build tree is made with 307 1.1 mrg the lndir command: 308 1.1 mrg 309 1.1 mrg cd ~/DRI-CVS 310 1.1 mrg ln -s xc XFree40 311 1.1 mrg mkdir build 312 1.1 mrg cd build 313 1.1 mrg lndir -silent -ignorelinks ../XFree40 314 1.1 mrg 315 1.1 mrg The build tree will be populated with symbolic links which point back into 316 1.1 mrg the CVS source tree. 317 1.1 mrg 318 1.1 mrg Advanced users may have several build trees for compiling and testing with 319 1.1 mrg different options. 320 1.1 mrg 321 1.1 mrg 8.2 Edit the host.def file 322 1.1 mrg 323 1.1 mrg The ~/DRI-CVS/build/xc/config/cf/host.def file is used to configure the 324 1.1 mrg XFree86 build process. You can change it to customize your build options or 325 1.1 mrg make adjustments for your particular system configuration 326 1.1 mrg 327 1.1 mrg The default host.def file will look something like this: 328 1.1 mrg 329 1.1 mrg #define DefaultCCOptions -Wall 330 1.1 mrg (i386) #define DefaultGcc2i386Opt -O2 331 1.1 mrg (Alpha) #define DefaultGcc2AxpOpt -O2 -mcpu=ev6 (or similar) 332 1.1 mrg #define LibraryCDebugFlags -O2 333 1.1 mrg #define BuildServersOnly YES 334 1.1 mrg #define XF86CardDrivers vga tdfx mga ati i810 335 1.1 mrg #define LinuxDistribution LinuxRedHat 336 1.1 mrg #define DefaultCCOptions -ansi GccWarningOptions -pipe 337 1.1 mrg #define BuildXF86DRI YES 338 1.1 mrg /* Optionally turn these on for debugging */ 339 1.1 mrg /* #define GlxBuiltInTdfx YES */ 340 1.1 mrg /* #define GlxBuiltInMga YES */ 341 1.1 mrg /* #define GlxBuiltInR128 YES */ 342 1.1 mrg /* #define GlxBuiltInRadeon YES */ 343 1.1 mrg /* #define DoLoadableServer NO */ 344 1.1 mrg #define SharedLibFont NO 345 1.1 mrg 346 1.1 mrg The ProjectRoot variable specifies where the XFree86 files will be installed. 347 1.1 mrg We recommend installing the DRI files over your existing XFree86 installation 348 1.1 mrg - it's generally safe to do and less error-prone. This policy is different 349 1.1 mrg than what we used to recommend. 350 1.1 mrg 351 1.1 mrg If XFree86 4.x is not installed in /usr/X11R6/ you'll have to add the follow- 352 1.1 mrg ing to the host.def file: 353 1.1 mrg 354 1.1 mrg #define ProjectRoot pathToYourXFree86installation 355 1.1 mrg 356 1.1 mrg Note the XF86CardDrivers line to be sure your card's driver is listed. 357 1.1 mrg 358 1.1 mrg If you want to enable 3DNow! optimizations in Mesa and the DRI drivers, you 359 1.1 mrg should add the following: 360 1.1 mrg 361 1.1 mrg #define MesaUse3DNow YES 362 1.1 mrg 363 1.1 mrg You don't have to be using an AMD processor in order to enable this option. 364 1.1 mrg The DRI will look for 3DNow! support and runtime and only enable it if appli- 365 1.1 mrg cable. 366 1.1 mrg 367 1.1 mrg If you want to enable SSE optimizations in Mesa and the DRI drivers, you must 368 1.1 mrg upgrade to a Linux 2.4.x kernel. Mesa will verify that SSE is supported by 369 1.1 mrg both your processor and your operating system, but to build Mesa inside the 370 1.1 mrg DRI you need to have the Linux 2.4.x kernel headers in /usr/src/linux. If 371 1.1 mrg you enable SSE optimizations with an earlier version of the Linux kernel in 372 1.1 mrg /usr/src/linux, Mesa will not compile. You have been warned. If you do have 373 1.1 mrg a 2.4.x kernel, you should add the following: 374 1.1 mrg 375 1.1 mrg #define MesaUseSSE YES 376 1.1 mrg 377 1.1 mrg If you want to build the DRM kernel modules as part of the full build pro- 378 1.1 mrg cess, add the following: 379 1.1 mrg 380 1.1 mrg #define BuildXF86DRM YES 381 1.1 mrg 382 1.1 mrg Otherwise, you'll need to build them separately as described below. 383 1.1 mrg 384 1.1 mrg 8.3 Compilation 385 1.1 mrg 386 1.1 mrg To compile the complete DRI tree: 387 1.1 mrg 388 1.1 mrg cd ~/DRI-CVS/build/xc/ 389 1.1 mrg make World >& world.log 390 1.1 mrg 391 1.1 mrg Or if you want to watch the compilation progress: 392 1.1 mrg 393 1.1 mrg cd ~/DRI-CVS/build/xc/ 394 1.1 mrg make World >& world.log & 395 1.1 mrg tail -f world.log 396 1.1 mrg 397 1.1 mrg With the default compilation flags it's normal to get a lot of warnings dur- 398 1.1 mrg ing compilation. 399 1.1 mrg 400 1.1 mrg Building will take some time so you may want to go check your email or visit 401 1.1 mrg slashdot. 402 1.1 mrg 403 1.1 mrg WARNING: do not use the -j option with make. It's reported that it does not 404 1.1 mrg work with XFree86/DRI. 405 1.1 mrg 406 1.1 mrg 8.4 Check for compilation errors 407 1.1 mrg 408 1.1 mrg Using your text editor, examine world.log for errors by searching for the 409 1.1 mrg pattern ***. 410 1.1 mrg 411 1.1 mrg After fixing the errors, run make World again. Later, you might just compile 412 1.1 mrg parts of the source tree but it's important that the whole tree will build 413 1.1 mrg first. 414 1.1 mrg 415 1.1 mrg If you edited your host.def file to enable automatic building of the DRI ker- 416 1.1 mrg nel module(s), verify that they were built: 417 1.1 mrg 418 1.1 mrg cd ~/DRI-CVS/build/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel 419 1.1 mrg ls 420 1.1 mrg 421 1.1 mrg Otherwise, build them now by running 422 1.1 mrg 423 1.1 mrg cd ~/DRI-CVS/build/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel 424 1.1 mrg make -f Makefile.linux 425 1.1 mrg 426 1.1 mrg For the 3dfx Voodoo, you should see tdfx.o. For the Matrox G200/G400, you 427 1.1 mrg should see mga.o. For the ATI Rage 128, you should see r128.o. For the ATI 428 1.1 mrg Radeon, you should see radeon.o. For the Intel i810, you should see i810.o. 429 1.1 mrg 430 1.1 mrg If the DRI kernel module(s) failed to build you should verify that you're 431 1.1 mrg using the right version of the Linux kernel. The most recent kernels are not 432 1.1 mrg always supported. 433 1.1 mrg 434 1.1 mrg If your build machine is running a different version of the kernel than your 435 1.1 mrg target machine (i.e. 2.2.x vs. 2.4.x), make will select the wrong kernel 436 1.1 mrg source tree. This can be fixed by explicitly setting the value of LINUXDIR. 437 1.1 mrg If the path to your kernel source is /usr/src/linux-2.4.x, 438 1.1 mrg 439 1.1 mrg cd ~/DRI-CVS/build/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel 440 1.1 mrg make -f Makefile.linux LINUXDIR=/usr/src/linux-2.4.x 441 1.1 mrg 442 1.1 mrg or alternatively, edit Makefile.linux to set LINUXDIR before the ifndef LIN- 443 1.1 mrg UXDIR line. 444 1.1 mrg 445 1.1 mrg 8.5 DRI kernel module installation 446 1.1 mrg 447 1.1 mrg The DRI kernel modules will be in ~/DRI-CVS/build/xc/pro- 448 1.1 mrg grams/Xserver/hw/xfree86/os-support/linux/drm/kernel/. 449 1.1 mrg 450 1.1 mrg To load the appropriate DRM module in your running kernel you can either use 451 1.1 mrg ismod and restart your X server or copy the kernel module to /lib/mod- 452 1.1 mrg ules/2.4.x/kernel/drivers/char/drm/ then run depmod and restart your X 453 1.1 mrg server. 454 1.1 mrg 455 1.1 mrg Make sure you first unload any older DRI kernel modules that might be already 456 1.1 mrg loaded. 457 1.1 mrg 458 1.1 mrg Note that some DRM modules require that the agpgart module be loaded first. 459 1.1 mrg 460 1.1 mrg 9. Normal Installation and Configuration 461 1.1 mrg 462 1.1 mrg Most users will want to install the new X server and use it in place of their 463 1.1 mrg old X server. This section explains how to do that. 464 1.1 mrg 465 1.1 mrg Developers, on the other hand, may just want to test the X server without 466 1.1 mrg actually installing it as their default server. If you want to do that, skip 467 1.1 mrg to the next section. 468 1.1 mrg 469 1.1 mrg 9.1 Installation 470 1.1 mrg 471 1.1 mrg Here are the installation commands: 472 1.1 mrg 473 1.1 mrg su 474 1.1 mrg cd ~/DRI-CVS/build/xc 475 1.1 mrg make install 476 1.1 mrg 477 1.1 mrg 9.2 Update the XF86Config File 478 1.1 mrg 479 1.1 mrg You may need to edit your XF86Config file to enable the DRI. The config file 480 1.1 mrg is usually installed as /etc/X11/XF86Config-4. See the DRI User Guide for 481 1.1 mrg details, but basically, you need to load the "glx" and "dri" modules and add 482 1.1 mrg a "DRI" section. 483 1.1 mrg 484 1.1 mrg On the DRI web site, in the resources section, you'll find example XF86Config 485 1.1 mrg files for a number of graphics cards. These configuration files also setup 486 1.1 mrg DRI options so it's highly recommended that you look at these examples. 487 1.1 mrg 488 1.1 mrg The XFree86 4.x server can generate a basic configuration file itself. Sim- 489 1.1 mrg ply do this: 490 1.1 mrg 491 1.1 mrg cd /usr/X11R6/bin 492 1.1 mrg ./XFree86 -configure 493 1.1 mrg 494 1.1 mrg A file named /root/XF86Config.new will be created. It should allow you to 495 1.1 mrg try your X server but you'll almost certainly have to edit it. For example, 496 1.1 mrg you should add HorizSync and VertRefresh options to the Monitor section and 497 1.1 mrg Modes options to the Screen section. Also, the ModulePath option in the 498 1.1 mrg Files section should be set to /usr/X11R6/lib/modules. 499 1.1 mrg 500 1.1 mrg 9.3 Start the New X Server 501 1.1 mrg 502 1.1 mrg The new X server should be ready to use now. Start your X server in your 503 1.1 mrg usual manner. Often times the startx command is used: 504 1.1 mrg 505 1.1 mrg startx 506 1.1 mrg 507 1.1 mrg 10. Testing the Server Without Installing It 508 1.1 mrg 509 1.1 mrg As mentioned at the start of section 9, developers may want to simply run the 510 1.1 mrg X server without installing it. This can save some time and allow you to 511 1.1 mrg keep a number of X servers available for testing. 512 1.1 mrg 513 1.1 mrg 10.1 Configuration 514 1.1 mrg 515 1.1 mrg As described in the preceding section, you'll need to create a configuration 516 1.1 mrg file for the new server. Put the XF86Config file in your ~/DRI- 517 1.1 mrg CVS/build/xc/programs/Xserver directory. 518 1.1 mrg 519 1.1 mrg Be sure the ModulePath option in your XF86Config file is set correctly. 520 1.1 mrg 521 1.1 mrg 10.2 A Startup Script 522 1.1 mrg 523 1.1 mrg A simple shell script can be used to start the X server. Here's an example. 524 1.1 mrg 525 1.1 mrg #!/bin/sh 526 1.1 mrg export DISPLAY=:0 527 1.1 mrg ./XFree86 -xf86config XF86Config & \ 528 1.1 mrg sleep 2 529 1.1 mrg fvwm2 & 530 1.1 mrg xset b off 531 1.1 mrg xmodmap -e "clear mod4" 532 1.1 mrg xsetroot -solid "#00306f" 533 1.1 mrg xterm -geometry 80x40+0+0 534 1.1 mrg 535 1.1 mrg You might name this script start-dri. Put it in your ~/DRI-CVS/build/xc/pro- 536 1.1 mrg grams/Xserver directory. 537 1.1 mrg 538 1.1 mrg To test the server run the script: 539 1.1 mrg 540 1.1 mrg cd ~/DRI-CVS/build/xc/programs/Xserver 541 1.1 mrg ./start-dri 542 1.1 mrg 543 1.1 mrg For debugging, you may also want to capture the log messages printed by the 544 1.1 mrg server in a file. If you're using the C-shell: 545 1.1 mrg 546 1.1 mrg ./start-dri >& log 547 1.1 mrg 548 1.1 mrg 11. Where To Go From Here 549 1.1 mrg 550 1.1 mrg At this point your X server should be up and running with hardware-acceler- 551 1.1 mrg ated direct rendering. Please read the DRI User Guide for information about 552 1.1 mrg trouble shooting and how to use the DRI-enabled X server for 3D applications. 553 1.1 mrg 554 1.1 mrg Generated from XFree86: xc/programs/Xserver/hw/xfree86/doc/sgml/DRIcomp.sgml,v 1.19 dawes Exp $ 555 1.1 mrg 556 1.1 mrg 557