Site hosted by Build your free website today!

Matrox Marvel G200 Video 4 Linux infos

This page was a forum dedicated to writing a V4L2 capture driver for the Matrox Marvel G200. ;-) But since the new existing driver by Ryan Drake is aktually usable and pretty organized I did just drop my attempts to write a driver by my own.

Seams like there are some problems with videotext support for PAL: Its not possible to mask out all lines of videotext with VINCTL. So its necessary to read all lines in the VINADDR memory windows as raw video data and convert the videotext or teletext manualy. The picture lines will start somewhere in this memory window. So there should be an offset to the real picture data in the captured raw video data. Maybe the zoran mjpeg encoder will have a problem with this but I can't tell yet. I have a small black border on the left hand side which changes wide depending on the brightness of the picture.

What is matrox doing with these hardware problems ? It's amazing: They tried quite successful to mask this problem from the user. The (with the backend scaler) displayed frame is smaller than the captured frame. All video data is captured and stored in 353*288 pixel with some videotext lines and a black border at the left side of the frame. These bad regions will be removed with the backend scaler. This is obvious when playing the avi files on an other computer or using a sofware decoder of a video editing program for example. So most Windoze users will say: What's this junk on Your screen ? On my computer with the matrox marvel this plays perfect.

What else ? The backend scaler has some problems when using high resolutions (32/24Bit color). The windoze error message is very specific so I can't say if this will improve with extended memory.

My first program for the new driver (not working with cvs versions) is a commandline tool activating the backend scaler.
usage: xbs [-hvdbcfr] [-k color] [-p xpos ypos] [-s width height] [device]
This program fires up the backend scaler of the Marvel G200.
-h : displays this help message
-v : adds some infos
-d : debug infos
-b : for 32bit color X-Servers.
-c : close backend scaler.
-k : croma key format rgb 24bit (default is overlay mode).
-p : pos xpos ypos. The position of the top left corner of the window.
-s : size width height. The width and height of the window.
-f : full screen.
-r : set window in bottom right corner of the screen.

Since no memory write operations are made from the backend scaler it does not disturb the X-Server. It just gives you accelerated tv in a box on your screen. Oh and you must make a small modification to your mgavideo driver in the v4l2cap.c file in the v4l2_ioctl section:

  struct v4l2_window* win = (struct v4l2_window*)arg;
  int red, green, blue;

  if( ( win->clips != NULL ) || ( win->clipcount != 0 ) )
    return -EINVAL;

  memcpy( &dev->window, win, sizeof(dev->window) );

  /* set on hardware */
  mgavideo_set_window( dev->mga, win->x, win->y, win->width, win->height );

  if ((long)win->chromakey<0) mgavideo_set_overlay( dev->mga );      //<---- This line is new <---- This line is new
  else {          //<---- This line is new <---- This line is new
    red = (win->chromakey >> 16) & 0xff;
    green = (win->chromakey >> 8) & 0xff;
    blue = (win->chromakey >> 0) & 0xff;
    mgavideo_set_colorkey( dev->mga, red, green, blue );
  }          //<---- This line is new <---- This line is new
  return 0;
  mgavideo_ivsync_enable( dev-> mga, *(int*)arg );      //<---- This line is new <---- This line is new
  mgavideo_preview_enable( dev->mga, *(int*)arg );
  return 0;

These modifications are already made in version 0.0.7-mb2 of mgavideo.

Available files:
Video for Linux Two Matrox Marvel G200 Source Code
Commandline tool for backend scaler v0.1: xbs.c xbs0.1.tgz 1999-08-18 (4KB)
Commandline tool for backend scaler v0.2: xbs.c xbs0.2.tgz 1999-09-28 (4KB)


Video 4 Linux 2 Homepage
The home of the Video 4 Linux 2 project in general.

Matrox Home
This is Windows realated only but they have the G200 specifications.

Matrox Marvel G200/Rainbow Runner Addon and support in Linux via Video 4 Linux 1 and 2
This site tries to bring together in one place all efforts to have the Matrox Marvel's work under linux, for tv viewing, capture, tv/out, and video/in and it's the home of the actual working driver.

Alexander Werth
Last modified: Thu Nov 4 00:44:45 MET 2004