Subject: grfconfig changes
To: None <port-amiga@NetBSD.ORG>
From: Bernd Ernesti <netbsd@arresum.inka.de>
List: port-amiga
Date: 07/30/1997 01:35:53
Hi,

i commited some changes to src/usr.bin/grfconfig and src/sys/arch/amiga/dev
which makes it possible to use the XFree modes for the grfconfig mode file.
That means that the mode format changed so you have to edit your mode file.

Please read the new grfconfig manpage before you install a new kernel and a
new grfconfig. You have to install the new grfconfig _and_ the new kernel
after you installed the grfconfig or the kernel, otherwise you get an error
from grfconfig.

This is a quick note what has changed, you better still read the new manpage
before you go on:
This are three old example mode entries:

  num clk      wid hi  dep hbs hss hse hbe ht  vbs vss vse vbe  vt
  1   31000000 640 480  8  640 688 768 816 832 480 489 492  517  520
  2   31000000 640 480  8  640 688 768 816 832 240 244 246  258  260
  3   31000000 640 480  8  640 688 768 816 832 960 978 984 1034 1040

This are three new example mode entries:

  num clk      wid hi  dep hbs hss hse ht  vbs vss vse vt  flags
  1   31000000 640 480  8  640 688 768 832 480 489 492 520 default
  2   31000000 640 480  8  640 688 768 832 480 489 492 520 interlace
  3   31000000 640 480  8  640 688 768 832 480 489 492 520 doublescan

You see that the 9th and the 14th field are gone and a new field is added
at the end:

  flags   By default every mode uses negative horizontal and vertical sync
          pulses, it is non-interlaced and does not use scandoubling.

               default        Use the default flags: -hsync -vsync
               doublescan     Doublescan mode
               interlace      Interlace mode
               +hsync         Positive horizontal sync pulses
               -hsync         Negative horizontal sync pulses
               +vsync         Positive vertical sync pulses
               -vsync         Negative vertical sync pulses
               sync-on-green  Composite sync on green

And you can see that the old interlace and doublescan format are now gone.
See Mode #2 and #3 for what has changed for the vertical values and the new
flags field.

grf3 (grfcl), grf5 (grfcv) and grf6 (grfet) supports the above flags, but
not the sync-on-green flag which is not supported for this VGA chipsets.

Bernd

P.S: This is a small script which can convert the old NetBSD grfconfig format
     to the new format, BUT please check the output by hand, because I CAN'T
     guarantee that the conversion works correct in all cases:

Use this command line to convert the old mode file /etc/grfmodes to
the new mode file /etc/grfmodes-new (don't forget to rename this files
or change your /etc/rc.local for the new mode filename):

sh ./grfconfig2grfconfig < /etc/grfmodes > /etc/grfmodes-new

# This is a shell archive.  Save it in a file, remove anything before
# this line, and then unpack it by entering "sh ./file".  Note, it may
# create directories; files and directories will be owned by you and
# have default permissions.
#
#
# This archive contains:
#
#	grfconfig2grfconfig
#
echo x - grfconfig2grfconfig
sed 's/^X//' >grfconfig2grfconfig << 'END-of-grfconfig2grfconfig'
X#!/bin/sh
X
Xuplim=0
Xlowlim=0
Xflags=""
X
Xwhile read x1 x2 x3 x4 x5 x6 x7 x8 x9 x10 x11 x12 x13 x14 x15
Xdo
X  case $x1 in
X    \#*|"")
X	echo "$x1 $x2 $x3 $x4 $x5 $x6 $x7 $x8 $x9 $x10 $x11 $x12 $x13 $x14 $x15"
X	;;
X    *)
X	if [ `expr $x10 \< $x3 / 4` = 1 ]; then
X	  x6=`expr $x6 \* 8`
X	  x7=`expr $x7 \* 8`
X	  x8=`expr $x8 \* 8`
X	  x10=`expr $x10 \* 8`
X	fi
X	uplim=`expr $x4 + $x4 / 4`
X	lowlim=`expr $x4 - $x4 / 4`
X	if [ `expr $x15 \* 2 \> $lowlim` = 1 ] && [ `expr $x15 \* 2 \< $uplim` = 1 ]
X	then
X	  x11=`expr $x11 \* 2`
X	  x12=`expr $x12 \* 2`
X	  x13=`expr $x13 \* 2`
X	  x15=`expr $x15 \* 2`
X	  flags="interlace"
X	elif [ `expr $x15 / 2 \> $lowlim` = 1 ] && [ `expr $x15 / 2 \< $uplim` = 1 ]
X	then
X	  x11=`expr $x11 / 2`
X	  x12=`expr $x12 / 2`
X	  x13=`expr $x13 / 2`
X	  x15=`expr $x15 / 2`
X	  flags="doublescan"
X	else
X	  flags="default"
X	fi
X
X	echo "$x1 $x2 $x3 $x4 $x5 $x6 $x7 $x8 $x10 $x11 $x12 $x13 $x15 $flags"
X	;;
X  esac
X
Xdone
X
END-of-grfconfig2grfconfig
exit