| |
|
|
|
1
|
|
| DRI Compilation guide <-- feedback requested |
snakeoil
13/1/04 7:24:09 AM
Overlord

|
DRI linux Compilation Guide What is DRI? DRI is the "Direct Rendering Infastructure" It is a set of optimised 2D & 3D drivers for xfree86 that use Mesa. Each release of xfree86 includes a copy of DRI. This guide is about how to compile an up to date copy of DRI, as the one included with xfree86 is normally out of date. Why do this? Two reasons normally. Either your video chipset is supported in the current CVS release of DRI and hasn't been merged back into the current xfree86 release. Or you like the idea of staying on the bleeding edge in terms of performance. For me it was mostly number one with a little bit of number two mixed in. *WARNING* * DRI only supports a limited number of video chipsets. Before attempting this guide, check (insert URL here) to make certain that your video chipset is supported. * DRI CVS is not considered to be entirely stable and may contain issues. Problems can occur so be warned before you try. Okay, now all of that is out of the way it is time to begin. Getting AGPgart in the Kernel Before DRI will work you have to have AGPgart support working correctly. This is normally located under the "Device Drivers" -> "Character devices" section of your kernel config. The options you need to enable are "/dev/agpgart (AGP support)" along with the relevant chipset for your motherboard. Once you compile this in and boot up you should get a message along the lines of Linux agpgart interface v0.100 (c) Dave Jones agpgart: Detected ATI IGP330/340/345/350/M chipset agpgart: Maximum main memory to use for AGP memory: 77M agpgart: AGP aperture is 64M @ 0xd8000000 Your system should then also have an agpgart entry under /dev Getting the Sources Second thing you must do is obtain copies of the DRI & Mesa CVS releases. For DRI you have two options, using cvs or cvsup. Personally my favourite is using cvsup, this guide only contains the CVS instructions though, if you want the cvsup ones, go and have a look at the DRI website. For Mesa, I could only see cvs as an option. When you are logging into both CVS repositories you will be using anonymous access. This means that each time you are asked for a password it should simply be safe to hit enter and not worry about it. Getting DRI Go to the spot on your machine where you want to store the sources (personally I used /usr/src) and create a directory to store the DRI cvs checkout. Once you have done this you are able to start checking out the source code. ie cd /usr/src mkdir dri cd dri cvs -d:pserver:anonymous@pdx.freedesktop.org:/cvs/dri login cvs -d:pserver:anonymous@pdx.freedesktop.org:/cvs/dri co xc Once this has finished you will have a full copy of the DRI source code in your directory. Getting Mesa The DRI cvs release now requires a copy of the Mesa cvs release to compile against. So now we grab it in a similar fashion. ie cd /usr/src mkdir mesa cd mesa cvs -d:pserver:anonymous@pdx.freedesktop.org:/cvs/mesa login cvs -d:pserver:anonymous@pdx.freedesktop.org:/cvs/mesa co Mesa Setting DRI Configuration options Next thing to do before you can start compiling DRI is set the relevant configuration options. The file in question is located under xc/xc/config/cf and is called host.def. Fire up your favourite text editor on the file and update the following entries. #define XFree86CustomVersion "" This lets you place a customised name in your drivers. You don't really need to set this but it can make starting up XFree86 cool to see your name in the logs. Put whatever name you want between the "". Just make certain that if you put a name in there, any special c characters have the proper leading identifiers. #define MesaSrcDir / For this one you need to change / to point to the Mesa directory you checked out. So if you followed the above examples you would set it to /usr/src/mesa/Mesa. There is no trailing slash on the name. Failure to set this correctly will break your build. #define MesaUseKatmai YES You won't find this one in the file initially. It adds SSE support to the drivers you are about to compile. I recommend adding it if your processor supports SSE (which should be all recent computers these days) as it gives a decent performance boost. On my machine it gave me about 10-20% more fps. If you are not certain if your machine supports SSE, use the command cat /proc/cpuinfo. The output of this will contain one line marked "flags" on my machine I get flags : fpu vme de pse tsc msr pae mce cx8 sep mtrr pge mca cmov pat pse36 clflush dts acpi mmx fxsr sse sse2 ss ht tm pbe cid All you are looking for is the part that says "sse" As you can see, my processor supports it. #define X86CardDrivers #define DriDrivers There are a couple of these supported by #ifdef, #elif, #else and #endif statements. Ensure you update the right ones for your system architecture. These define statements allow you to set what drivers are built later on. As your machine will only have 1-2 video cards, you won't need most of the entries here. Not updating these lines won't do anything bad, it will just mean that it all takes a bit longer to compile. Before you compile. Okay, now the configuration options are set you are getting closer to compiling. There are only a couple more steps you need to complete before you can start to build the drivers. First you have to change into the directory you checked dri out into and issue the following commands. ln -s xc XFree40 mkdir build cd build lndir -silent -ignorelinks ../XFree40 These steps create a build directory for DRI. They are not absolutely essential, but allow you to use the same machine to compile DRI for multiple different ones. (you create a second build directory by following the above steps and giving build a different name) Compiling DRI To start the compile change into the build/xc directory and issue the following command make World >& world.log & This will output all of the compiler information into the world.log file. Keeping a copy of this file can be useful later on if you hit problems. If you want to watch the compile "as it happens" simply enter the following command. tail -f world.log Installing DRI Once the compile has finished, check the world.log file to ensure there were no errors. If you are happy with the results then issue the command make install in the xc directory as root. This should then install over the top of your existing Xfree86 directory updating your older drivers. When you start Xfree86 next time you should be using your new drivers. Doing the Kernel modules DRI essentially needs three drivers before it can work. The first two (the 2D & 3D ones) were compiled in the above steps. The last one that is required is a kernel module. The module is responsible for passing commands from the 2D/3D drivers back to the physical graphics hardware. To get the kernel module you have two options, either use the DRM support in the kernel or compile them out of your DRI source. As you have grabbed your 2D/3D drivers out of dri-cvs, we are also going to get the kernel modules from there. First thing to do is check that you don't have DRM enabled in your kernel. DRM configuration is found in the following place "Device Drivers" -> "Character Devices" -> "Direct Rendering Manager". Make sure this is unset. If it is set, disable it and recompile your kernel because you are not going to need it. The next stage is to change back into your dri-cvs build/xc directory. Then issue the following command. cd programs/Xserver/hw/xfree86/os-support/linux/drm/kernel The directory you are now in contains all of the kernel module sources. To compile issue the following command make -f Makefile.linux By default the build uses your currently running kernel source (As found under /lib/modules/(kernel name)/build) If you are wanting to build the module using some different sourcecode you need to add the option LINUXDIR=/where/kernel/source/is onto the make command (updating the patch accordingly) This compile builds all kernel modules. If you are pressed for time you can only tell it to build the one you need. To do this, add the DRM_MODULES="put your module names in here with nothing after them, like radeon" after the make command. Assuming the above all worked fine you should have a whole bunch of .ko files in the directory. You now need to manually copy the module over into your kernel directory and run depmod to tell your system it is there. This can be done using the following command mkdir /lib/modules/`uname -r`/kernel/drivers/char/drm cp (module name here) /lib/modules/`uname -r`/kernel/drivers/char/drm depmod The `uname -r` part simply returns your current running kernel version. The first line creates the directory the kernel modules are surposed to be in, and the second line copies the module there. Depmod is run to update your modules.dep & map files accordingly. You should now be able to go modprobe (module name) to load the module up. Doing this on my machine gives me [drm] Initialized radeon 1.10.0 20020828 on minor 0: ATI Radeon RS200 Mobility IGP 340M This can be confirmed by checking your /dev/dri folder. It should contain an item called card(x) (where x is the minor number in the dmesg line above) you should now be ready to configure X windows. You don't need to load this module automatically on startup. XFree86 will load it for you when it starts up. Configuring X Windows Now for the fun part, to configure X to use the new drivers you have compiled. What I have listed below assumes that you have a working Xfree86 installation that was previously using stock drivers. All you really need to do to use your new drivers is very minor. The following needs to be added Section "Module" Load "dri" Load "glx" ... EndSection The load dri & load glx lines need to be added to your Module section. Don't touch anything else in this part. Those lines tell X to enable dri support and load the relevant opengl libraries. Section "DRI" Mode 0666 EndSection By default the dri entries in /dev can only be accessed by root. Adding this section will tell X to apply 0666 permissions to all dri resources which will allow all users to access them. Section "Device" ... EndSection Depending on what module you were already using, it may or may not be neccessary to change anything in this part. To find out what options you can select, enter the command man (driver name) On the command line. In my case I have a radeon card so with dri working I added the following options Option "AGPMode" "4" Option "AGPFastWrite" "on" Option "EnablePageFlip" "on" Once you have done all of the above, save the file sit back and start up X. Barring any problems you should now have working 3D. If you do have problems, checkout below. After you have installed The following points are things you should do * Subscribe to the dri-users mailing list. As you are using possibly unstable drivers they may have problems. This list is the apropriate place to raise any issues like this. * If you are interested in helping develop the drivers, or want really bleeding edge releases then subscribe to dri-devel. This list is for the people who are developing the drivers. It normally contains patches that haven't yet been committed to cvs. Do not post general problems here. * Have a look at bugs.xfree86.org. This is the bugzilla system for xfree86 & dri. On here you can search all dri bugs that are currently being worked on and obtain tentative fix patches. Problems? If your compile fails the first thing to do is re-check all your options. Ensure that the host.def options are set correctly. I've had quite a few weird failures simply because I misspelt katmai.. who comes up with words like that anyway? If that fails update your cvs trees (both DRI & Mesa) and try again. It is possible that a patch may have been introduced that caused a problem and has since been fixed or pulled out again. Next thing to try is searching the dri-users mailing list. It will give you an idea of if anybody else has encountered a similar problem before. This list should also contain any suggested fixes for the problem. Depending on what you find on dri-users, searching dri-devel & bugzilla may be helpful. If the problem is a recognised bug there should be people on one of these working on it. Finally if you can't find any help on the above, post an email to dri-users containing your problem. Try to include as much information as possible. If you are having a compile problem, include the relevant snippet from the world.log file. If the drivers compile fine but xfree86 has issues while using them, include any error messages from your xfree86.log files. Absolutely lastly, don't send your problem to me. Edited by snakeoil: 16/1/2004 11:32:49 AM ----- don't tell me I'm not consistent - I already know this
|
elmo198
13/1/04 5:12:12 PM
Overlord

|
do I care? why so complicated? just download xfree-drm Edited by elmo198: 13/1/2004 5:12:37 PM ----- Gentoo Linux 1.4 - Kernel 2.4.22-openmosix apache, php, iptables, squid, openssh, tightvnc, webmin, NFS. Gnome, and everthing you want, I have! :) http://members.optusnet.com.au/~elmie
|
BlueNomad
13/1/04 6:43:37 PM
Overlord

|
lol.. even easier emerge xfree-drm :) ----- Athlon1800+, nForce2, 512+256mb, 40+120+12gig,gf2ti, sblive!
|
snakeoil
13/1/04 6:52:15 PM
Overlord

|
elmo198/BlueNomad - afaik xfree-drm only provides you with kernel modules for DRI. Working on the dri-cvs gives you a more up to date copy of the normal 2D/3D drivers as well. Plus there are drivers for some cards that haven't made it into a xfree release yet. ----- don't tell me I'm not consistent - I already know this
|
Redhatter
13/1/04 9:53:14 PM
Overlord

|
snakeoil: Nicely done -- I had a good read (tried to post a comment earlier, but links didn't oblige). At some point, I might have a look and see about giving this a try -- mind you, I think a newer video card will improve my system's performace better (The card is a Radeon 7000 AGP). I recall having to do this some time ago when I was running Linux from Scratch. (Which is worth doing -- if only to get to know how Linux ticks.) One comment though, you mention the following commands to compile the sources and view the output (I know where it comes from -- I've seen it in the installation instructions for XFree86): make World >& world.log & tail -f world.log Why not: make World >& | tee world.log Tip -- if you're not sure if your processor supports SSE instructions, have a look at /proc/cpuinfo On my main box, a dual P3 (Coppermine) 1GHz I get something like the following: processor : 0 vendor_id : GenuineIntel cpu family : 6 model : 8 model name : Pentium III (Coppermine) stepping : 10 cpu MHz : 1004.523 cache size : 256 KB ... flags : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 mmx fxsr sse bogomips : 2005.40 processor : 1 vendor_id : GenuineIntel cpu family : 6 model : 8 model name : Pentium III (Coppermine) stepping : 10 cpu MHz : 1004.523 cache size : 256 KB ... flags : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 mmx fxsr sse bogomips : 2005.40 Notice the sse listed in the flags section of each CPU? On my laptop, a PII 300MHz, notice the lack of the SSE flag... processor : 0 vendor_id : GenuineIntel cpu family : 6 model : 5 model name : Pentium II (Deschutes) stepping : 2 cpu MHz : 299.943 cache size : 512 KB ... flags : fpu vme de pse tsc msr pae mce cx8 sep mtrr pge mca cmov pat pse36 mmx fxsr bogomips : 598.01 On an older machine, such as my P166 server, it's a similar story... processor : 0 vendor_id : GenuineIntel cpu family : 5 model : 4 model name : Pentium MMX stepping : 3 cpu MHz : 165.791 ... flags : fpu vme de pse tsc msr mce cx8 mmx bogomips : 330.95 That's a simple way to determine the capabilities of your CPU. elmo198/BlueNomad: Not everyone can simply run 'emerge xfree-drm' -- as not all distributions of Linux use Gentoo's Portage. Also (as made evident by the very posts on this forum) not everyone uses Gentoo. Now, before you go raming Gentoo down peoples' throats, please bear in mind that Linux is about choice, and that some people may have quite legitimate reasons for not using Gentoo (or even not using Linux) Also, just downloading xfree-drm, AFAIK, doesn't install XFree86 automatically -- some of the above would still apply. Edited by Redhatter: 14/1/2004 12:53:23 PM ----- Stuart Longland a.k.a --<!iCNCi!>-- Redhatter "I haven't lost my mind -- it's backed up on a tape somewhere..." Atomic Linux Project: http://atomicl.berlios.de/
|
Bazza
14/1/04 7:04:26 AM
Apprentice

|
First off, nice guide. Although I don't think it's relevant to me, as the nVidia X drivers specifically say not to load DRI. Anyway, I think I noticed a mistake: "* DRI CVS is considered to be entirely stable and may contain issues." I think you mean, CVS is considered unstable (As I don't recall many OS projects advertising their CVS to be stable :o) ----- The box said "Install Win9x or better". So I installed Linux Atomic Linux Forums: http://atomicl.berlios.de/phpBB2/
|
snakeoil
14/1/04 7:30:34 AM
Overlord

|
Redhatter - thanks for the suggestion, I will include the trick with /proc/cpuinfo under the MesaUseKatmai bit. I am still digging into it a bit but have heard somewhere that some of the drivers are surposed to have SSE2 optimisations as well. Bazza - thanks for picking the typo, somedays I swear I must be slightly dyslexic as well. Now if I could only learn how to spell =) I know what you mean with nvidia cards though. My desktop at home has one, which simplifies matters as far as installing goes. The reason you don't load dri for the nvidia drivers is that nvidia provide their own copy of all the opengl libraries. ----- don't tell me I'm not consistent - I already know this
|
snakeoil
16/1/04 11:34:14 AM
Champion

|
Guide has been updated. * Fixed a few small typos * Included Redhatter's suggestion on checking for SSE * Put a section in for how to compile the kernel modules * Put a section in on how to setup Xfree to use the drivers. ----- don't tell me I'm not consistent - I already know this
|
Forums | Open Source OS
|
|