Matrox G400 Dual Head

= Matrox G400 DualHead =

This information applies to the Matrox G400 DualHead MAX

Determine the graphic adapter
Run lspci helps determine which graphics adapter is installed. On this machine the output is:

Another way to check which Matrox adapter is installed is to look at the label! This is a Matrox G400 DualHead MAX label and this is a Matrox G550 label.

On this machine the line 01:00.0 VGA compatible controller: Matrox Graphics, Inc. G400/G450 (rev 04) tell you that either a G400 or G450 are installed.

Kernel 2.6 Patches
Under the DirectFB/patches directory there are three patches that can be installed. In the kernel build directory /usr/src/linux apply the patches with the following. These patches work up to kernel 2.6.12.

Kernel Settings
The following settings need to be set in the .config

There may be other drivers that need to be installed

Using make menuconfig the location is

Once the kernel is built and booted you should find two or more frame buffers in the /dev directory.

Shows the output from a system using devfs revealing three frame buffers.

Frame Buffer information
The fbset command is required

Running the command fbset -fb /dev/fb0 -i will generate the following output

The first frame buffer /dev/fb0 shows a Matrox G400 primary head card, /dev/fb1 shows the Matrox secondary head and /dev/fb2 shows a Hauppague PVR-350 frame buffer.

Building DirectFB
After the frame buffers are installed and working and DirectFB has been built.

I use this script to build the CVS version of DirectFB. Debug is turned on and the install prefix is /usr. You may want to install DirectFB into /usr/local. I'm using a Linux From Scratch system, so I prefer /usr.

The script includes a very simple package management system that reports when new files have been added to the system.

You may need either a ~/.directfbrc or a /etc/directfbrc, e.g.:

DirectFB info
The dfbinfo command generates the following output

You'll notice that the default primary layer has been attached to the secondary head.

TV-out
See Linux TV-out HowTo and DirectFB Matrox G400/G450/G550 TV-out HowTo they provide the information that is needed.

Not mentioned in either HowTo is that you need to specify either the option crtc2 to MPlayer's dfbmga video output or set primary-layer=2 in the .directfbrc

If the video appears like this screen shot, it seems to be caused by /dev/fb0 being set at 1024x768, changing the framebuffer to 1600x1200 before running MPlayer resolves this issue.

However, this patch from Ville Syrjälä when applied to the linux kernel fixed this problem:

{{Box Command|patch -Np1| diff -urN linux/drivers/video/matrox/matroxfb_DAC1064.c linux/drivers/video/matrox/matroxfb_DAC1064.c --- linux/drivers/video/matrox/matroxfb_DAC1064.c	2005-10-29 12:57:05.000000000 +0300 +++ linux/drivers/video/matrox/matroxfb_DAC1064.c	2005-10-29 12:57:35.000000000 +0300 @@ -980,7 +980,7 @@ 				hw->MXoptionReg |= 0x40;	/* FIXME... */ 				pci_write_config_dword(ACCESS_FBINFO(pcidev), PCI_OPTION_REG, hw->MXoptionReg); } -			mga_setr(M_EXTVGA_INDEX, 0x06, 0x50); +			mga_setr(M_EXTVGA_INDEX, 0x06, 0x00); } 	} 	if (ACCESS_FBINFO(devflags.g450dac)) { }}

You will need to use valid modes in your /etc/fb.modes file.

Matroxset
matroxset is a command for controlling which frame buffer is sent to which head and the video signal from the head.

There is little documentation on matroxset except the build in help.

The matroxset -o commands are global options, with one argument it gets the value for the primary (0) or secondary (1) heads. When two arguments are passed then it sets the values to PAL (1), NTSC (2) or monitor (128).

The matroxset -m commands apply to a specific frame buffer. The values are bit-mapped and a value of 0 turns off the outputs.

First, you need the modules i2c_matroxfb and matroxfb_maven loaded. Load them with: modprobe i2c_matroxfb && modprobe matroxfb_maven

Run this script to print out the settings.

The default frame buffer modes are printed out early on. Put the output from these commands in to your /etc/fb.modes. The /etc/fb.modes should include something like:

This script moves the console from the primary head to the secondary head and sets the video mode to PAL.

This script sets the framebuffers back to normal