Matrox G400 and SVGATextMode

Problem

I have experienced a conflict between the Matrox G400 XFree86 driver and SVGATextMode. The conflict manifests itself as loss of video sync when switching from the X virtual terminal (typically on F7) to one of the text mode virtual terminals. Typically, it is not possible to switch back to X. Linux is still running: the host can be contacted via telnet or from a serial terminal, however the VT's are inaccessible. Specifically, I have experienced this problem with:

Work Around

The problem is with the matrox HAL driver. The problem can be eliminated by removing the mga_hal_drv.o file from /usr/X11R6/lib/modules/drivers . Removing the hal driver didn't seem to have any effect on quake3, but maybe some other applications need it. So it would be better to exit X, toggle the HAL driver in and out, then restart X. Here is a script which will toggle the HAL driver:

#$/bin/bash
  if [ -f /usr/X11R6/lib/modules/drivers/mga_hal_drv.o ]; then
  echo "Moving mga_hal_drv.o to mga_hal_drv.o.backup"
  mv -f /usr/X11R6/lib/modules/drivers/mga_hal_drv.o /usr/X11R6/lib/modules/drivers/mga_hal_drv.o.backup
  exit
  fi
  if [ -f /usr/X11R6/lib/modules/drivers/mga_hal_drv.o.backup ]; then
  echo "Copying mga_hal_drv.o.backup to mga_hal_drv.o"
  cp -f /usr/X11R6/lib/modules/drivers/mga_hal_drv.o.backup /usr/X11R6/lib/modules/drivers/mga_hal_drv.o
  exit
  fi
  echo "usage:    mga_hal"
  echo " "
  echo "function: 1. If mga_hal_drv.o is present in the X11R6 drivers directory,"
  echo "             then this script moves it to
  mga_hal_drv.o.backup"
  echo "          2. If mga_hal_drv.o is not present, but
  mga_hal_drv.o.backup is present, then"
  echo "             then this script copies
  mga_hal_drv.o.backup to mga_hal_drv.o"
  echo "          3. If nieither mga_hal_drv.o nor
  mga_hal_drv.o.backup are present,"
  echo "             then this script prints this
  message"
  echo " "
Andrew Howlett January 2002