[mythtv] Matrox G200 TV out works! HOWTO!

Bernard Johnson mythtv-dev@snowman.net
Wed, 18 Dec 2002 04:00:54 -0700

I have a Matrox Marvel G400-TV (from what I read, it should work the same as
what you are performing below).  However, when I execute the two matroxset
commands, I get:

root@localhost# matroxset -f /dev/fb0 -m 3
ioctl failed: Invalid argument
root@localhost# matroxset -f /dev/fb0 -o 1 2
ioctl failed: Invalid argument

"matroxset -f /dev/fb0 -m 1", however, works fine.

lspci says:
"VGA compatible controller: Matrox Graphics, Inc. MGA G400 AGP (rev 04)"

I would think that this would be a result of not using the right option
somewhere when compiling something into the kernel, but I basically have the
same thing you do except for the Matrox /proc interface, which I don't think
is actually required.

I was mostly using this information:

If anyone could help me along, I would really appreciate it.  And yes, I can
provide you with the config file for the kernel that I've built.


----- Original Message -----
From: "Colin Panisset" <mythtv@clabber.com>
To: <mythtv-dev@snowman.net>
Sent: Tuesday, December 17, 2002 5:17 PM
Subject: [mythtv] Matrox G200 TV out works! HOWTO!

> Since I've just spent a hair-pulling time getting this lot going, I
> I'd share the joy and perhaps help others work out how to get this beast
> set up. Perhaps it'll even be useful for those using a G400 with TV-out on
> the second head.
> This is kinda long...
> ** keep a rescue floppy/CD!
> ** don't blame me if you fry your hardware/TV/monitor trying this.
> video card settings at the register level can cause signals which may
> display hardware beyond their design specs. You can kill hardware like
> this.
> ** no warranty expressed or implied, contents under pressure, not suitable
> for children, not a floatation device, sell-by date on bottom of package.
> So, here we go:
> Step 1: Upgrade the G200 BIOS
> Step 1.1: Download the latest BIOS for the card from
> http://www.matrox.com/mga/support/drivers/bios/home2.cfm
> Step 1.2: You'll need to use DOS to flash the BIOS -- I used the FreeDOS
> install floppy (available from
> as a temporary boot disk. dd the image to a floppy, then mount it. Delete
> most of the contents, except for the command.com and kernel.sys. Copy in
> all the .bin files from the bios .ZIP, plus ubiosdos.exe, dos4gw.exe,
> english.mmf,  and progbios.exe.
> Leave the disk writeable.
> Step 1.3: boot the machine from the FreeDOS floppy, and execute:
> ubiosdos
> I didn't make a backup disk, just pressed enter and let it flash
> (note: if things screw up, this could be your undoing)
> Step 1.4: force the G200 BIOS to turn on the TV out at boot time:
> progbios -maven ntsc (use pal for PAL, and off for, um, off)
> Step 1.5: reboot. At this point, I already had my TV connected to the
> external breakout box, and was delighted to see the Award BIOS boot
> messages. I was able to alter PC BIOS settings, and all. This could be
> important... :)
> Step 2: Build an appropriate kernel
> Step 2.1: I built the following into the kernel (not built as modules):
> Character devices -> I2C support -> I2C support
> Character devices -> I2C support -> I2C bit-banging interfaces
> Character devices -> I2C support -> I2C device interface
> Character devices -> I2C support -> I2C /proc interface
> Console drivers -> Frame-buffer support -> Matrox acceleration
> Console drivers -> Frame-buffer support -> G100/G200/ ...
> Console drivers -> Frame-buffer support -> Matrox I2C support
> Console drivers -> Frame-buffer support -> G400 second head support
> Console drivers -> Frame-buffer support -> Matrox /proc interface
> NOTE: you need the G400 second head support even if you have a G200. It
> builds the driver for the MAVEN chip, which actually does the TV-out
> conversion.
> Step 2.2: make dep, make bzImage, make modules, make modules_install. Copy
> bzImage to the boot wherever and lilo it. Read
> /usr/src/linux/Documentation/fb/matroxfb.txt for options you can pass to
> the Matrox framebuffer driver through lilo
> You could boot the new kernel at this point if you liked, but make sure
> you've kept your monitor attached to the PC, because the MGA console
> switches to a VESA mode that my TV couldn't display.
> Step 3: Set up XFree86
> Step 3.1: In your /etc/X11/XF86Config-4, put something like this:
> ---- Begin snippet ----
> Section "Monitor"
>         Identifier "TV"
>         VendorName "Unknown"
>         ModelName  "Unknown"
>         HorizSync 31-50
>         VertRefresh 60 # This is for NTSC. PAL should use 50
> EndSection
> Section "Device"
>         Identifier "My Video Card"
>         Driver "mga"
>         BoardName "Unknown"
>         Option "UseFBDev" "on"
>         Option "HWCursor" "off"
> EndSection
> Section "Device"
>         Identifier "Linux Frame Buffer"
>         Driver "fbdev"
>         BoardName "Unknown"
> EndSection
> Section "Screen"
>         Identifier "Screen0"
>         Device "My Video Card"
>         Monitor "TV"
>         DefaultDepth 16
>         Subsection "Display"
>                 Depth 16
>                 Modes "800x600"
>         EndSubSection
> EndSection
> ---- End snippet ----
> Step 3.2: restart X (ctrl-alt-backspace) to make sure it's using the fb
> device. Check /var/log/XFree86.0.log to make sure.
> Step 3.3: Get matroxset from the MPlayer distribution
> (http://www.mplayerhq.hu/homepage/), build and install it (it's in the
> TVout subdirectory of the source). Also build and install fbset from the
> same distribution.
> Get maven-prog from http://platan.vc.cvut.cz/~vana/matroxfb.html -- build
> it (it'll end up being called "matrox", but you can rename it) and install
> it.
> Step 3.4: Mirror the framebuffer onto the TV out with matroxset:
> matroxset -f /dev/fb/0 -m 3 # use -m 1 for monitor-only, -m 2 for TV only
> matroxset -f /dev/fb/0 -o 1 2 # set output 1 to NTSC. Use -o 1 1 for PAL
> Step 3.5: Tweak the display
> This is where you may end up typing blind. See
> http://davedina.apestaart.org/download/doc/Matrox-TVOUT-HOWTO-0.1.txt for
> great explanation
> When you have the size and location of the screen set to your liking, use
> "maven-prog" (or "matrox", if you didn't rename it) from above to set the
> black level, white level, saturation, hue, antialiasing, and whatnot. My
> settings are:
> matrox 0x0e 0x3f # sets the black level
> matrox 0x1e 0xcf # sets the white level
> matrox 0x22 0x76 # sets the hue
> See http://platan.vc.cvut.cz/~vana/maven/mavenreg.html for a description
> the MAVEN chip registers.
> I put the resulting fbset and matrox commands in my mythtv user's
> .xsession.
> Step 3.6: To put the text console back on the TV after the boot process
> turns it off, I put the following lines in /etc/rc.sysinit, right after
> devfsd is launched:
> /sbin/matroxset -f /dev/fb/0 -m 3       # both monitor and TV
> /sbin/matroxset -f /dev/fb/0 -o 1 2     # set TV to NTSC
> Step 4: Beer (or tea, coffee, wine, spring water, or whatever)
> That's it. I only wish it had been as quick and easy to figure out as it
> to type this up :)
> Notes:
> ** if you built ALSA drivers for a previous kernel, you'll probably have
> build and install them again.
> ** The G200 (and, presumably, the G400) will display up to 1024x768
> the miracle of scan conversion, but 800x600 works well for MythTV for me.
> ** don't be concerned if it seems like X is taking a long time to start up
> in a mode that the TV can sync to. My TV also flashes like crazy for about
> 5 seconds while this is going on. Eventually, it gets there.
> ** My Shuttle SV24 locks up sometimes with this card. It's reproducible,
> must be a driver problem. It happens when running "make xconfig" from the
> linux kernel tree, and sometimes when dragging the scrollbar up or down in
> Mozilla. Turning off various acceleration features may resolve this, but I
> haven't tried that yet.
> ** I have run mplayer with the normal Xvideo output in this mode, and it's
> just fine. You could also build it with the mga driver and have it use the
> hardware acceleration, but I haven't got there yet.
> _______________________________________________
> mythtv-dev mailing list
> mythtv-dev@snowman.net
> http://www.snowman.net/mailman/listinfo/mythtv-dev