Voodoo 3 TV-out (BT869)

Some models of 3Dfx's Voodoo 3 series were equipped with TV-out using a Brooktree BT869 chip. The quality is very good at a native PAL resolution of 720x576, and presumably also at 720x480 NTSC, but there is some overscan (edges of picture missing); this is fairly common with most TV picture sources, so should not be a problem for watching TV and video files. It can also display 800x600 and 640x480, but loses a lot of quality in the scaling and introduces large borders. For the interlaced native PAL (and NTSC?) modes see the interlacing section.

These cards are readily available on eBay for about £10, and are widely compatible with video software due to being able to display X on the TV output, so they are a good choice when putting together a HTPC, provided you have enough CPU power for software deinterlacing if necessary.

So you thought AGP was “a standard

Do check that your motherboard is compatible, because several different flavours of AGP have evolved over the years, and Voodoo 3s are quite old now. See http://www.ertyu.org/~steven_nikkel/agpcompatibility.html. The connector on mine indicates that it's a 1.5V card. The vast majority of motherboards should be OK with this.

Activating the TV-out

Most of the information in this section came from http://www.linuxnetmag.com/en/issue7/printm7tvout2.html and the documentation for lm_sensors' bt869 driver.

In common with many cards the TV-out is activated automatically when the PC boots, but loses sync when you change mode eg by starting X. Unlike most of the other cards, reenabling it is not done by the XFree86 driver, but via the card's I2C interface, and requires specialised modelines detailed in the bt869 driver documentation. It requires the Voodoo 3 and Brooktree BT869 I2C drivers.

Installing the I2C modules for 2.4 kernels

Download the latest versions of lm_sensors and i2c from http://secure.netroedge.com/~lm78/. Installation is basically a case of making sure the kernel's own I2C support is disabled, then running:

make
make install 
 

for the i2c and lm_sensors source trees in turn.

Also make sure your kernel supports the /proc filesystem and that it's mounted in /etc/fstab. This is nearly always essential anyway, so you can probably take it for granted that it's already working.

Installing the I2C modules for 2.6 kernels

Downloading and applying a patch

The bt869 driver is not supported in kernel 2.6, but you can add the driver as a patch. I originally found a suitable patch by Toby Reed at http://archives.andrew.net.au/lm-sensors/msg18457.html and have been sent updated versions since.

Martijn Uffing has undertaken to keep the driver up to date for recent kernels (2.6.14 and later) and to host his patches at http://sarijopen.student.utwente.nl/caligula/kernel/patches/. He also provides versions with the flicker filter enabled.

To apply one of these patches:

cd /usr/src/linux/
patch -p1 < /path/to/downloaded/patch
 

You can now skip to Configuring the kernel.

For kernel 2.6.12 Henrik Persson sent me a patch which you can download from here.

To apply this:

cd /usr/src/linux/
zcat /path/to/downloaded/patch | patch -p1
 

You can now skip to Configuring the kernel.

The original patch was for kernel 2.6.8.1 and also works up to kernel 2.6.9. If you have one of these kernel versions download kernel-2.6.8.1-bt869.patch.gz and apply it thus:

cd /usr/src/linux/drivers/i2c
zcat /path/to/downloaded/patch | patch -p0

If you have kernel 2.6.10, apply the 2.6.8/9 patch above, followed by bt869-2.6.9-to-2.6.10.patch.gz, also supplied by Toby Reed. cd into the chips subdirectory and apply it as above.

Unfortunately I do not know which patches work, if any, with kernels 2.6.11 and 2.6.13. If you have one of these versions and can nout upgrade you will have to try the patches for the nearest version. If you find a patch only partially works and you need to undo the changes it made, use the same command as you used to apply it but add the -R option.

Configuring the kernel

Configure the kernel in your favourite manner, and go to the I2C section in Device Drivers. You will probably want to enable the drivers as modules rather than built into the kernel. Enable at least I2C support, I2C bit-banging interfaces (in I2C Algorithms), Voodoo 3 (in I2C Hardware Bus Support) and Brooktree BT869 (the one we added with the patch, in I2C Hardware Sensors Chip Support). You may also need to enable EXPERIMENTAL ie Code maturity level options => Prompt for development and/or incomplete code/drivers to access all of these, especially if you added the bt869 driver as a patch. Compile and install as usual.

It may be worth your while to download lm_sensors even though it isn't necessary, so you can read the documentation for the bt869 module.

Using the I2C drivers to configure Voodoo TV-out

Make sure both drivers are loaded with

modprobe bt869
modprobe i2c-voodoo3

Some pseudo-files will be created under /proc or /sys depending on whether you have a 2.4 or 2.6 kernel respectively. The directory containing them is fairly easy to find in /proc: it is called /proc/sys/dev/sensors/bt869* where * will look something like -i2c-0-44 but varies slightly from system to system. In 2.6's /sys it's somewhat more obscure. I use this script fragment to find it:

DEVDIR=/sys/devices/ # for 2.6 kernels, or
DEVDIR=/proc/sys/dev/sensors/ # for 2.4 kernels
DEVDIR="$(dirname $(find $DEVDIR -name svideo))"

or, to work on either kernel version (until something newer than 2.6 comes along):

if `uname -r | grep -q 2.6` ; then
    DEVDIR=/sys/devices/
else
    DEVDIR=/proc/sys/dev/sensors/
fi
DEVDIR="$(dirname $(find $DEVDIR -name svideo))"

The useful files are: res, depth, ntsc, svideo and colorbars.

To select the resolution, echo it to the res file eg:

echo 720 576 > $DEVDIR/res

Similarly for colour depth:

echo 24 > $DEVDIR/depth

although some people seem to find it only works at the default of 16-bit. Make sure it matches your X configuration.

Select PAL instead of NTSC by echoing 0 to ntsc (1 if you want to use NTSC after all). I presume 1 to svideo confirms you want the default of S-Video while 0 selects Composite.

The above commands should be run when starting X, so I run them from .xinitrc or .xsession. However, you will need root access so I put them in a separate script and call it with sudo. They also tend not to work first time at each startup of X. One solution offered by the bt869 documentation is to turn colorbars on and off (echo 1 and 0 respectively) after applying the other settings, or simply read the colorbars file with cat. Or you can try applying the other settings again after a short delay eg, if they're in a script /usr/local/sbin/voodootv:

sudo /usr/local/sbin/voodootv
(sleep 2 && sudo /usr/local/sbin/voodootv) &

XFree86 modelines for the BT869

The BT869 is compatible with these modes:

ModeLine "640x480PAL"  29.50  640 675 678 944  480 530 535 625
ModeLine "720x576PAL"  27.50  720 744 800 880  576 581 583 625
ModeLine "800x600PAL"  36.00  800 818 820 960  600 653 655 750
ModeLine "640x480NTSC"  28.195793  640 656 658 784  480 520 525 600
ModeLine "720x480NTSC"  27.5  720 744 800 872  480 483 485 525
ModeLine "800x600NTSC"  38.769241  800 812 814 880  600 646 649 735

You will need to select a mode that matches the one passed to the i2c driver. I recommend using 720x576PAL or 720x480NTSC to avoid the somewhat ropey scaling.