Everything in this works for me except where I say something isuntested (only the TV out stuff). You might need to play about inorder to get some of this working because systems differ. If youaren’t confident building kernels, configuring X and so on – this isn’t for you.

You can get the very latest X from there. This is what I’m using atthe moment and everything here works with it. Since I downloaded them,Brandon has updated them and Xft was missing according to #debian – soit is worth checking up on their state before downloadingthem. Otherwise stick to the debs in sid. If you want to stick to4.0.3 then you should be ok, but I’m not promising.

Note the kernel (as of 2.4.5) isn’t quite up to date. You need todownload the 3.x DRI modules from http://www.xfree86.org/~alanh/. Downloadthe source, not the binarys and build them. Before starting X you needthe mga.o from that directory insmodded. If you are running4.0.3 then these modules might be too recent, check startup logs.

In your /etc/X11/XF86Config-4 you need to have the lineLoad “dri” in the Module section. You also needan IRQ assigned to your AGP slot. You can usually do this in theBIOS. I’m afraid that if you run Xinerama you have to disable it toget DRI to load.

Now, start X and check /var/log/XFree86.0.log for linescontaining DRI and check for errors. The X utility glxinfowill tell you if DRI is loaded. Look for the string DirectRendering. Once you have DRI running you can try tuxracer out 😉

AA Fonts You need recent versions of libqt to get AA fonts. Youcan check if your QT can do AA by running ldd/usr/lib/libqt.so can checking that the library is linkedagainst Xft and Xrender. You also need RENDER support in your X serverwhich you can check with xdpyinfo | grep RENDER. You shouldalso have the freetype and type1 X modulesloaded.

If you have a font server configured you should disable them and makesure you have a truetype font directory configured. You can get the(free) MS font pack by installing the msttcorefonts packagewhich downloads the font pack from the Microsoft server. AAfonts are configured by /etc/X11/XftConfig but the defaultis a reasonable start. Once you have all this configuredexport QT_XFT=1 and run a QT app like konqueror. The fontsshould be anti-aliased. Unfortunately, AA fonts do not work well withXinerama (again) so you have to disable it for them to work.

Dualhead XAfter seeing all the stuff above about how Xinerama breaks things youmight be wondering why you would want a dualhead system. Well, forone, it is damm useful for coding and you don’t have to run Xineramato get dualhead. Xinerama just binds 2 displays together into one butif you run dualhead without it, you get 2 different displays. This meansthat you can’t move windows across the displays and so on – but itdoes work.

To get dualhead working you need to config your G400 card as 2different devices. Here is the section from my X config:

Note that if you don’t have a wonderful dualhead card you can run 2different cards in the same way. This means you have to dig up a PCIgraphics card (I’ve never seen a motherboard with two AGP slots) butthey aren’t too hard to find. This also means that you can run 3, 4,5, … screens if you like (and if you have desk space for all thesemonitors)

You need to setup 2 Screen sections like you would normally and then aServerLayout section:

“Screen x” is just what I called my Screen sections. Alsomake sure you get the direction round the right way. Matrox haverelease a Linux version of their PowerDesk utility (pompous name for asimple utility). You can get it from theirwebsite (follow the links to the Linux drivers).

This utility also allows you to set the second head to output NTSC orPAL output (for TVs) given that you have the Matrox HAL libraryinstalled. This is a closed source library which you can get from theMatrox website and enables Macrovision(a really stupid system which upsets some VCRs). High-quality VCRsaren’t affected by Macrovision – but these are rare.

I’ve not tried running the output to a TV yet. The G400 comes with aconverter from a standard PC video out to S-VIDEO and something thatlooks like a coax video cable. The coax connector isn’t actually anormal connector (it’s a little too big) but you can get S-VIDEO->Coaxconverters (in the UK, try Maplins).

FMV playback

By far the best video player I’ve found is MPlayer. This has played everythingI’ve thrown at it so far. It uses the avifile way of loading windowsDLLs for codecs so you need the set of DLLs in /usr/lib/win32 (you canget them from the avifile site, I think)

However, it also comes with some interesting drivers for theG200/G400. Under the drivers subdir of the mplayer sourcethere is a kernel module for the mga_vid device. Thisallows applications to use the hardware scaling and colour conversionwhich really speeds up playing.

After building and insmodding the mga_vid.o you need tocreate a device for it with mknod /dev/mga_vid c 1780. After this you need to run the configure script for mplayeragain and rebuild it. Once you have done this you can use the switch-vo mga (console mode) or -vo xmga (in X) to useit. Note that this conflicts with Xv (the X video extension, load theextmod X module) and you might need to reboot to get Xvworking again. In X, Xv does almost the same thing that xmga doesexcept that xmga can play on the second-head.

Mplayer really is worth playing with – it’s a great piece of work

Dualhead Console if you have the matrox frame buffer driversinstalled in your kernel you can actually get dualhead consolemode. Now I don’t find the matrox frame buffer is very stable whenswitching to X and back – so keep those disks sync’ed. That beingsaid, switching to X via Alt-F7 locks my box up hard withoutit.

You need to persuade the kernel to build the i2c-matrox andmatrox-maven modules as well as all the normal Matroxframe buffer ones. I couldn’t find this in the normalconfig and had to edit the .config file manually. Thelines are CONFIG_FB_MATROX_MULTIHEAD andCONFIG_FB_MATROX_I2C. Note that this needs I2C support andI2C bit-banging support (in the normal config under characterdevices). I’d suggest building all of these as modules.

Insmodding all the modules can take a bit of time in order to get allthe depends right – but there is only a finite number of orders youcan insmod them in. It’s best if you install the modules properly anduse modprobe.

Now we go back to the mplayer source and into the TVoutsubdir. This contains all the tools needed, so build each offbset, con2fb and matroxset. Runningthe modules script will try to insmod all the neededmodules. Once you have all the modules installed you should have 2frame buffer devices – fb0 is the primary head and fb1 is the secondaryhead.

The matroxset utility can setup the second head. matroxset -m128 should activate the second head and con2fb/con2fb/dev/fb1 /dev/tty2 should bind tty2 to it. You should now havetty2 on the second head and another console on the primary head. Youcan switch consoles as normal and see 2 at once. Note that consoles onthe second head are really slow.

You can also set the second head to TV mode with matroxset -mx (where x=1 for PAL and x=2 for NTSC). I haven’t tried this yet– see above for information about the connector. Also untried (but itshould work) is using mplayer’s fbdev mode (-vo fbdevoption on the command line) and setting $FRAMEBUFFER to/dev/fb/1 (this maybe /dev/fb1 if you don’t run devfs) to play to aVCR because I don’t think this will have Macrovision.

Playing DVDsYou should have read the above section on FMV playback before readingthis. Also, if you are in the USA it might be illegal for you to readthis or try any of this. Just don’t be surprised that the MPAA decreesyour head to be their intellectual property in 10 years time.

Firstly, you need a DVD drive. I have an SR-8585-B and itworks for me. Before investing you might want to check which DVDdrives are region-free, or can be made so. More on this below

DVDs use the UDF file system so you need to build your kernel with UDFsupport in (or as a module). Get a DVD (they can be quite expensivebut you can rent one to try it out) and try to mount it withmount -t udf /dev/hdd /cdrom. I’ll be using/dev/hdd as my DVD device, change it to fit yoursystem. I’ll also be using /cdrom as my mount point, again,change to fit your system. Once mounted, you should see aVIDEO_TS directory and a few files in it.

You can’t actually read those files (yet) because of CSS – theencryption system which DVDs use. You must have heard all about CSS bynow – so I won’t talk about the legal/social aspects here. One othertrick DVDs have is regions. All DVDs have a region marker which theDVD reads (Region 1 = USA, 2 = Europe, … up to region 8). Some DVDsare hardwired only to read certain region DVDs, some are region-freeand will read anything and some use the 5 strikes system where the DVDdrive will change regions 5 times and lock on the 5thtime. If you happen to put a odd region in on the 5 change – you arestuck with it.

With my drive I can use the regionset utility from LinuxTV.orgto set the region of my drive.

Now grab libcss from LiViD and build and install it. Youcan now reconfigure mplayer with the –with-csslibdir and–with-cssincdir options (these are required) to uselibcss. Do so and rebuild mplayer.

Now in libcss/src there are a number of utilities. Firstly run./tstdvd /dev/hdd (you may need to be root). This should getthe 2048 byte disc key for the DVD and dump it in a file calleddisc-key. Then run ./tstdvd /dev/hdd/cdrom/VIDEO_TS/VTS_01_1.VOB (you may need to put in a validfilename here). This will get the title-key from the DVD. If gettingthe title key fails with an I/O error it usually means the region iswrong – check your syslog.

If that went well, mplayer should be able to play the DVD (you didrebuild mplayer with libcss support, right?). So run mplayer -voxv -dvd /dev/hdd -aid 128 /cdrom/VIDEO_TS/VTS_01_1.VOB andhope. The -aid option selects the audio track and 128 seemsto be English for me, without it I get only the sound-track (nospeech). Interestingly, AID 130 gives me a commentary.

If the audio isn’t in sync with the video (you can see this as soon assomeone speaks) you can use the -delay option. A delay of-0.3 seconds works well for the DVD I’m using.

DivX 😉 Encoding Think of this what you will. As I said aboveI’m not getting into the legal/social aspects here.

Firstly – you need to get the unencrypted MPEG file from the DVD. Youcan use the css_cat utility from the libcss source to getthis. It needs the disc-key and title-key filesproduced by tstdvd above. Note that different titles (thefirst number in the VTS filename) may have differentkeys. The command is roughly css-cat -v1P/cdrom/VIDEO_TS/VTS_01_1.VOB > vts1.mpeg.

Now we have the raw MPEG we can encode it to DivX ;-). Mplayer canactually make DivX using the Project Mayo encode code – but it has noaudio. However, x2dixvworks well. With x2divx I didn’t get any audio until I used the CVSversion of avifile – your luck may vary. x2divx can take a -boption to set the DivX bit rate and I find a value of 6000 gives goodquality and a 5:1 compression ratio.As always – have fun. AGL

A funny thing to add to your XF86Config is :Option “AGPMode” “4” It screams with bzflag and q3 🙂And BTW, I managed to play movies from the second plug on a monitor via fb1. The inconvenient is that it doesn’t changes the video mode automatically.

As for me the DRI acceleration still doesn’t work with my G450 card (I followed the Radeon Guide posted here and asked Matrox for support but there was no solution yet. Some otheres share my problem too…), I just want to thank for that guide, while it helped me with those divx stuff. Secondly, I just want to note that DRIP (http://drip.sourceforge.net/) is also a very nice tool to … decode your private familly videos to divx, and it’s with nice GUI too;). If the 0.6x sequfaults, go for the 0.5x branch which worked fine for me. Just hit [Rip DVD] and done (of course after some hours).See ya,Adrian

I posted that I didn’t got my G450 to work with DRI. Now i did! I post this because I know from the official Matroxforum and some other people that there has been severall problems. Ok, the simple problem was my QDI Kinetiz 7B board with an VIA chipset. I simply upgraded the mainboard BIOS – and et voilla. It works! Before the Linux kernel loaded some VIA_IDE drivers, now it loads the VP_IDE driver. Dont’ ask.. and prepare to disable the build in modem via bios setup. If I do, it hangs after loading the VP_IDE drivers. Sounds wired, i know… ;-). But hey, finally it works. I catched the newest QDI bios from www.qdigrp.com. How many hours did i spent to fix this.. and again it was so simple… well.Ok, now i’ll go for a tuxracer game.Cya,Adrian

Thank you for the tip, but that wasn’t really the problem since i read that article too ;-). In fact, for me DRI initialises fine, but when i run an OpenGL app it just crashes my X11 and puts my G450 card in a weird state and i have to reboot my box. There has to some conflict with.. i don’t have a clue. Some ppl on other forums have reported the same problem as mine and they use nearly the same hardware as I do. Well, agpgart and everything is loaded fine, also new mga.o modules out of the XFree sources, but still, a GL app when run with the xlibmesa crashes. With soft (mesag3 deb) acceleration everything works fine, well but with 0,5frames/s ;-). I have no clue why it doesn’t work. I also asked matrox suppord – no solution. Maybe it’s a very simple mistake i did.. but i would be grateful for any further help.Adrian

I’ve just spent a couple of weeks tuning my G400 to the max. I run on an old K6-2 500 so every bit helps.

What worked for me ?

I checked out XFree86 4.1.0 from CVS and compiled by hand with optimizations for my system – -O4 -march=k6 …a few other optflags…

WOW ! I’m amazed at the 3D acceleration I can get now. If you’re running Debian, set all the xfree86 packages to a hold state to keep apt from overwritiing the stuff you compile by hand.

Compiling X meant a lot of reading but there was very little to hack (just config files). And the payoffs are pretty big. I stay away from the matrox drivers (although I do use the HAL library) since they are for XFree86 4.0.3.

Thanks for the tip on QT_XFT ! Opera (dynamically linked version) with anti-aliased fonts is awesome to look at !!!!

aviplay file.avi file.sub — that is the syntax for aviplay I saw somewhere. I had problems runninig it tough, so I wrote a C program that can display subtitles in another window. The major problem with it is that it has it’s own timer — doesn’t sync with movie timer so subtitles won’t work if you scroll the movie. That is my second C program, but works for me 🙂If you want it email me at otoboski@sgsp.edu.pl

i am able to play encrypted dvds with xine , and at a lot less trouble. i compiled it myslef with the css decryption built in (complete source from here) the sound and the video are perfectly synced, too. it hasn’t had any problem with any of my dvds, either. it has a great full screen mode, and an easy interface to use. btw, have a g450 on X 4.0.3 running on sid. i have had xinerama working, and it does work great. the only bad thing is that the aa fonts get all screwed up like AGL said in the acrticle. maybe the render extension will be available to both heads in a later release of X. i also have a tv card whose display will only show up on one display when using xinerama. the only other hitch is non-xinerama compliant window managers. sawfish is for the most part. i spend most of my time in kde, though. i read on kernel cousin kde that someone had patched kwin and ksplash to be xinerama compliant.

forgot to mention that there was no need to recompile any kernel modules in order to get xine working (using 2.4.5). i did grab the new matrox drivers from their site . haven’t tried the powerdesk suite they released for linux yet. really no need since i have X set up the way i want anyway.

Why build from source?If you’re running sid, you can just install xine from Debian packages (apt-get install xine-ui)Using the DVDnav plugin (package xine-dvdnav), you can even play menus and some other special features…

Okay, that’s all on non-encrypted DVDs so far, but if you got libcss installed, that will be used by libdvdread which in turn is used by the DVDnav plugin, so: works as well!