* DRI Accel
* FMV Playback
* Dualhead Consoles and X
* AA Fonts
* Playing DVDs
* DivX 😉 Encoding
Everything in this works for me except where I say something is
untested (only the TV out stuff). You might need to play about in
order to get some of this working because systems differ. If you
aren't confident building kernels, configuring X and so on - this isn't for you.
DRI Accel Brandon has X4.1.0 BETA debs packaged in his
area. Apt line: deb http://people.debian.org/%7Ebranden/
You can get the very latest X from there. This is what I'm using at
the moment and everything here works with it. Since I downloaded them,
Brandon has updated them and Xft was missing according to #debian - so
it is worth checking up on their state before downloading
them. Otherwise stick to the debs in sid. If you want to stick to
4.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 to
download the 3.x DRI modules from http://www.xfree86.org/~alanh/. Download
the source, not the binarys and build them. Before starting X you need
mga.o from that directory insmodded. If you are running
4.0.3 then these modules might be too recent, check startup logs.
In your /etc/X11/XF86Config-4 you need to have the line
Load "dri" in the Module section. You also need
an IRQ assigned to your AGP slot. You can usually do this in the
BIOS. I'm afraid that if you run Xinerama you have to disable it to
get DRI to load.
Now, start X and check /var/log/XFree86.0.log for lines
containing DRI and check for errors. The X utility glxinfo
will tell you if DRI is loaded. Look for the string Direct
Rendering. Once you have DRI running you can try tuxracer out 😉
AA Fonts You need recent versions of libqt to get AA fonts. You
can check if your QT can do AA by running ldd
/usr/lib/libqt.so can checking that the library is linked
against Xft and Xrender. You also need RENDER support in your X server
which you can check with xdpyinfo | grep RENDER. You should
also have the freetype and type1 X modules
If you have a font server configured you should disable them and make
sure you have a truetype font directory configured. You can get the
(free) MS font pack by installing the msttcorefonts package
which downloads the font pack from the Microsoft server.
fonts are configured by /etc/X11/XftConfig but the default
is a reasonable start.
Once you have all this configured
export QT_XFT=1 and run a QT app like konqueror. The fonts
should be anti-aliased. Unfortunately, AA fonts do not work well with
Xinerama (again) so you have to disable it for them to work.
Here is my X config Files section:
After seeing all the stuff above about how Xinerama breaks things you
might be wondering why you would want a dualhead system. Well, for
one, it is damm useful for coding and you don't have to run Xinerama
to get dualhead. Xinerama just binds 2 displays together into one but
if you run dualhead without it, you get 2 different displays. This means
that you can't move windows across the displays and so on - but it
To get dualhead working you need to config your G400 card as 2
different devices. Here is the section from my X config:
Option "AGPMode" "1"
Note that if you don't have a wonderful dualhead card you can run 2
different cards in the same way. This means you have to dig up a PCI
graphics card (I've never seen a motherboard with two AGP slots) but
they 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 these
You need to setup 2 Screen sections like you would normally and then a
Screen "Screen 1" RightOf "Screen 2"
Screen "Screen 2" 0 0
InputDevice "Mouse1" "CorePointer"
InputDevice "Keyboard1" "CoreKeyboard"
"Screen x" is just what I called my Screen sections. Also
make sure you get the direction round the right way. Matrox have
release a Linux version of their PowerDesk utility (pompous name for a
simple utility). You can get it from their
website (follow the links to the Linux drivers).
This utility also allows you to set the second head to output NTSC or
PAL output (for TVs) given that you have the Matrox HAL library
installed. This is a closed source library which you can get from the
Matrox website and enables Macrovision
(a really stupid system which upsets some VCRs). High-quality VCRs
aren't affected by Macrovision - but these are rare.
I've not tried running the output to a TV yet. The G400 comes with a
converter from a standard PC video out to S-VIDEO and something that
looks like a coax video cable. The coax connector isn't actually a
normal connector (it's a little too big) but you can get S-VIDEO->Coax
converters (in the UK, try Maplins).
By far the best video player I've found is MPlayer. This has played everything
I've thrown at it so far. It uses the avifile way of loading windows
DLLs for codecs so you need the set of DLLs in /usr/lib/win32 (you can
get them from the avifile site, I think)
However, it also comes with some interesting drivers for the
G200/G400. Under the drivers subdir of the mplayer source
there is a kernel module for the mga_vid device. This
allows applications to use the hardware scaling and colour conversion
which really speeds up playing.
After building and insmodding the mga_vid.o you need to
create a device for it with mknod /dev/mga_vid c 178
0. After this you need to run the configure script for mplayer
again and rebuild it. Once you have done this you can use the switch
-vo mga (console mode) or -vo xmga (in X) to use
it. Note that this conflicts with Xv (the X video extension, load the
extmod X module) and you might need to reboot to get Xv
working again. In X, Xv does almost the same thing that xmga does
except 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 drivers
installed in your kernel you can actually get dualhead console
mode. Now I don't find the matrox frame buffer is very stable when
switching to X and back - so keep those disks sync'ed. That being
said, switching to X via Alt-F7 locks my box up hard without
You need to persuade the kernel to build the i2c-matrox and
matrox-maven modules as well as all the normal Matrox
frame buffer ones. I couldn't find this in the normal
config and had to edit the .config file manually. The
lines are CONFIG_FB_MATROX_MULTIHEAD and
CONFIG_FB_MATROX_I2C. Note that this needs I2C support and
I2C bit-banging support (in the normal config under character
devices). I'd suggest building all of these as modules.
Insmodding all the modules can take a bit of time in order to get all
the depends right - but there is only a finite number of orders you
can insmod them in. It's best if you install the modules properly and
Now we go back to the mplayer source and into the TVout
subdir. This contains all the tools needed, so build each of
fbset, con2fb and matroxset. Running
the modules script will try to insmod all the needed
modules. Once you have all the modules installed you should have 2
frame buffer devices - fb0 is the primary head and fb1 is the secondary
The matroxset utility can setup the second head. matroxset -m
128 should activate the second head and con2fb/con2fb
/dev/fb1 /dev/tty2 should bind tty2 to it. You should now have
tty2 on the second head and another console on the primary head. You
can switch consoles as normal and see 2 at once. Note that consoles on
the second head are really slow.
You can also set the second head to TV mode with matroxset -m
x (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 it
should work) is using mplayer's fbdev mode (-vo fbdev
option on the command line) and setting $FRAMEBUFFER to
/dev/fb/1 (this maybe /dev/fb1 if you don't run devfs) to play to a
VCR because I don't think this will have Macrovision.
You should have read the above section on FMV playback before reading
this. Also, if you are in the USA it might be illegal for you to read
this or try any of this. Just don't be surprised that the MPAA decrees
your head to be their intellectual property in 10 years time.
Firstly, you need a DVD drive. I have an SR-8585-B and it
works for me. Before investing you might want to check which DVD
drives 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 UDF
support in (or as a module). Get a DVD (they can be quite expensive
but you can rent one to try it out) and try to mount it with
mount -t udf /dev/hdd /cdrom. I'll be using
/dev/hdd as my DVD device, change it to fit your
system. I'll also be using /cdrom as my mount point, again,
change to fit your system. Once mounted, you should see a
VIDEO_TS directory and a few files in it.
You can't actually read those files (yet) because of CSS - the
encryption system which DVDs use. You must have heard all about CSS by
now - so I won't talk about the legal/social aspects here. One other
trick DVDs have is regions. All DVDs have a region marker which the
DVD reads (Region 1 = USA, 2 = Europe, ... up to region 8). Some DVDs
are hardwired only to read certain region DVDs, some are region-free
and will read anything and some use the 5 strikes system where the DVD
drive will change regions 5 times and lock on the 5th
time. If you happen to put a odd region in on the 5 change - you are
stuck with it.
With my drive I can use the regionset utility from LinuxTV.org
to set the region of my drive.
Now grab libcss from LiViD and build and install it. You
can now reconfigure mplayer with the --with-csslibdir and
--with-cssincdir options (these are required) to use
libcss. 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 get
the 2048 byte disc key for the DVD and dump it in a file called
disc-key. Then run ./tstdvd /dev/hdd
/cdrom/VIDEO_TS/VTS_01_1.VOB (you may need to put in a valid
filename here). This will get the title-key from the DVD. If getting
the title key fails with an I/O error it usually means the region is
wrong - check your syslog.
If that went well, mplayer should be able to play the DVD (you did
rebuild mplayer with libcss support, right?). So run mplayer -vo
xv -dvd /dev/hdd -aid 128 /cdrom/VIDEO_TS/VTS_01_1.VOB and
hope. The -aid option selects the audio track and 128 seems
to be English for me, without it I get only the sound-track (no
speech). Interestingly, AID 130 gives me a commentary.
If the audio isn't in sync with the video (you can see this as soon as
someone 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 above
I'm not getting into the legal/social aspects here.
Firstly - you need to get the unencrypted MPEG file from the DVD. You
can use the css_cat utility from the libcss source to get
this. It needs the disc-key and title-key files
produced by tstdvd above. Note that different titles (the
first number in the VTS filename) may have different
keys. 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 can
actually make DivX using the Project Mayo encode code - but it has no
audio. However, x2dixv
works well. With x2divx I didn't get any audio until I used the CVS
version of avifile - your luck may vary. x2divx can take a -b
option to set the DivX bit rate and I find a value of 6000 gives good
quality and a 5:1 compression ratio.
As always - have fun. AGL