devel.reinikainen.net
HomeDocumentsCodeBugtrackerSearchreinikainen.netJB Consulting
Home arrow Technical Documents arrow Linux: Desktop Solutions arrow MPlayer + Matrox TV-Out
MPlayer + Matrox TV-Out PDF Print
User Rating: / 2
PoorBest 
Written by Jani Reinikainen   
Mar 21, 2007 at 09:51 AM

Introduction

Hardware: Matrox G400 32mb AGP.
Software: Debian GNU/Linux Sarge (aka. testing), MPlayer 0.90rc3, Linux kernel 2.4.20.

This guide will show you how to use your Matrox graphics card with TV-Out in Linux. Unfortunately, hardware acceleretion is not available on the second head under Linux :-(

Kernel Configuration

Code maturity level options  --->
  [*] Prompt for development and/or incomplete code/drivers

Processor type and features  --->
  [*] MTRR (Memory Type Range Register) support

Character devices  --->
  I2C support  --->
    <M> I2C support
    <M> I2C bit-banging interfaces

Console drivers  --->
  Frame-buffer support  --->
    [*] Support for frame buffer devices
    <M>   Matrox acceleration
    [*]     G100/G200/G400/G450/G550 support
    <M>       Matrox I2C support
    <M>       G400 second head support


MPlayer Installation


# apt-get install libpng2 libpng2-dev xlibs-dev libgtk1.2-dev \
libvorbis-dev libdv-dev liblzo-dev libmad0-dev
# /usr/share/doc/libdvdread3/examples/install-css.sh

$ mkdir /usr/lib/win32; cd /usr/lib/win32
$ tar xfvj win32codecs.tar.bz2

$ mkdir /usr/lib/xanim/mods; cd /usr/lib/xanim/mods
$ tar xfvj xanimddls.tar.bz2

$ tar xfvj mplayer-<version>.tar.bz2
$ cd mplayer-<version>
$ ./configure --enable-gui --enable-xinerama --enable-menu
$ make
# make install

$ cd TVout/matroxset
$ make
# cp matroxset /usr/local/bin

$ cd ../fbset
$ make
# cp fbset /usr/local/bin

$ cd ../../drivers
$ make
# cp mga_vid.o /lib/modules/<kernel-version>
# mknod /dev/mga_vid c 178 0
# insmod mga_vid.o
# depmod -a
$ vim matroxtv
$ chmod +x matroxtv

Usage


$ cd <mplayer-source>/TVout/modules
# ./matroxtv

My shell script for starting MPlayer in the framebuffer-enabled console ("matrox" is maven-prog, which is available at http://platan.vc.cvut.cz/~vana/ftp/pub/linux/matrox-latest/maven-prog.tgz):

#!/bin/sh

if [ "$#" -gt 0 ]; then

 # Disable cursor
 setterm -cursor off

 # Disable screen blanking
 setterm -blank 0
 
 # Adjust second head contrast and hue
 ./matrox 0x1e 0xd0
 ./matrox 0x20 0xff
 ./matrox 0x22 0xff

 # Clear the screen
 clear

 # Start MPlayer and load the specified file
 mplayer -vo mga -fs -screenw 640 -screenh 512 $* >/dev/null 2>&1

 # Once MPlayer has exited, turn cursor back on
 setterm -cursor on

else

 echo "Error: Need at least one argument (filename)."
 echo "Usage: $0 [filename]"
 exit

fi

Below is my other shell script for starting a new X server just for TV-out. Fluxbox is my choice of window manager, you probably want to replace that with yours. Also, note that I have separate Fluxbox and XFree86 configuration files for TV-out.

#!/bin/sh

if [ "$#" -gt 0 ]; then

 # Backup existing xinitrc
 mv ~/.xinitrc ~/.xinitrc.bak

 # Generate auto-starting MPlayer
 touch ~/.xinitrc
 echo "fluxbox -rc ~/.fluxbox/init-tvout & wmpid=$!" >> ~/.xinitrc
 echo "mplayer -vo x11 -fs -zoom $* &" >> ~/.xinitrc
 echo "wait $wmpid" >> ~/.xinitrc

 
 # Adjust second head contrast and hue
 ./matrox 0x1e 0xd0
 ./matrox 0x20 0xff
 ./matrox 0x22 0xff 


 # Checks for open displays and starts X on next available
 for display in 0 1 2 3 4 5
 {
    if [ ! -f "/tmp/.X$display-lock" ]
    then
       startx -- :$display -xf86config XF86Config-4-tvout
       break
    fi
 }

 # Restore original xinitrc
 mv ~/.xinitrc.bak ~/.xinitrc
 
else

 echo "Error: Need at least one argument (filename)."
 echo "Usage: $0 [filename]"
 exit

fi

User Comments

Security Check. Please enter this code.

Copyright © 2007 Jani Reinikainen. All rights reserved.
Permission granted to replicate information found on these pages, provided that all copyright headers/footers remain intact.