MGA Millennium a XF86 3.2

Lubor Dedina lubord na watson.bajt.cz
Pondělí Prosinec 2 23:27:08 CET 1996


Nazdar vsichni,

posilam sem ponekud delsi pokec, ktery je nasledkem me snahy uvest do 
chodu XFree86 3.2 s moji kartou Matrox MGA Millennium. Omlouvam se, 
ze je to napsano chatrnou anglictinou, ale posilal jsem to do 
mezinarodni linuxove X konference a proste jsem uz nemel energii to 
prekladat do cestiny.

Pokud vam to nekomu aspon trochu pomohlo, tak vezte, ze jsem rad.

Ahoj,                        Lubor



Hallo everybody,

this is for people using the Matrox MGA Millennium card. I describe
here, how to compute those "magic numbers" used in the XF86Config file
(section Monitor). There are only two things required for this: you
are able to run Windows95 (besides Linux) and you have XFree86 3.2
installed on your computer.

There is a monitor calibration program in the Matrox's driver pack for
Win95 called MGA Monitor. You enter it by clicking the right mouse
button on desktop and choosing Properties | MGA Monitor. I won't
describe it in detail, but it allows you to play with your vertical
frequency by increasing it by 1 Hz, set the size and position of the
image. So you can explore, what's your maximum reachable vertical
frequency (but you shouldn't go over maximum horizontal frequency
given by the manufacturer). It's very easy, because the MGA Monitor
program shows all necessary information.

After reaching the maximum vertical frequency for a particular
resolution and setting proper size and position you can write down
these numbers:

Pixel Clock; horizontal and vertical: F.Porch, B.Porch, Sync.

The line in the XFree86 configuration file can look like this:

#           Modename   clock    horiz. timing     vert. timing
# --------------------------------------------------------------
ModeLine "resolution"   PCl     A   B   C   D     E   F   G   H

where:
resolution  =  your required resolution (mode)
PCl  =  Pixel Clock reached at the maximum vertical frequency
A  =  horizontal resolution for given mode
B  =  A + horizontal F.Porch
C  =  B + horizontal Sync.
D  =  C + horizontal B.Porch
E  =  vertical resolution for given mode
F  =  E + vertical F.Porch
G  =  F + vertical Sync.
H  =  G + vertical B.Porch

The A, B, C and D numbers MUST be evenly divisible by eight (and yes,
they are :-)

An example:
-----------
I have the Samtron 726GXL monitor, the Matrox MGA Millennium adapter
(2064W, 220MHz, 4MB WRAM) and Win95 driver 4.03.00.3170
(ftp.matrox.com). I got these numbers (for 1280x1024/24bit/81Hz):
Pixel clock: 145.752 MHz
horizontal: F.Porch 16, B.Porch 248, Sync 144 (pixels)
vertical:   F.Porch  1, B.Porch  38, Sync   3 (lines)

So I put this in my configuration file:

ModeLine "1280x1024" 145.752 1280 1296 1440 1688 1024 1025 1028 1066

After starting X I got a perfect picture, exactly centered, required
resolution, absolutely flicker-free. I even didn't bother with the 
usual VGA 640x480/16 mode (it needs another server - MGA needs
XF86_SVGA).

You can use this method for easy calculation of your "magic numbers"
and you even don't have to know, what they mean.
If you would like to use other than usual mode that MGA Monitor
supports (let's say something like 888x777 :-) you will have to know,
what the numbers like F.Porch etc. mean. This is their meaning:

A - horizontal size of the visible picture in pixels (it's the same
like saying "in dot clocks produced by MGA card's generator" or even
"in time necessary for writing them to the screen" - each pixel (dot)
is created and written in one cycle that lasts the same amount of time,
so you can not only count these pixels, but to measure the time if you
know how many they were generated and what's the generator's frequency
- so called "pixel or dot clock")

h.F.Porch - number of pixels (i.e. clocks of your card) that are
written to the screen after the visible line, (these are "invisible",
they are at the right side of the visible line, because your card
doesn't tell the electron beam to go back immediately after writing 
the last pixel of the visible line - it lets the electron gun "to 
hesitate" a little)

h.Sync - number of pixels (again - the time necessary for producing 
them) that would be written to your screen during the time, when the 
electron beam returns back from the right side to the left side of your 
screen. These pixels are invisible as well and this number is only used
for measuring time for this operation.

h.B.Porch - number of pixels, the card has to produce before it starts
writing your visible line. After reaching the left side of your screen,
the electron beam has to "hesitate" again.

The same concerns v.F.Porch, v.B.Porch, v.Sync and E - the only
difference is, that these number mean lines:

E - vertical size of the visible picture in lines (or "time necessary
to create the whole visible picture")

v.F.Porch - time (number of lines) between writting the last bottom 
line of the visible picture and returning back to the top of the screen
(hesitation time)

v.Sync - time necessary for going back from the lowest part of your 
screen to the top of the screen (from the right bottom corner to the left
top corner)

v.B.Porch - another hesitation time, now before writing the first
visible line.

Of course, during the "hesitation time" the electron gun doesn't 
sleep - it moves, but works only at minimum intensity (it writes nothing).


The MGA Monitor program can help you in this case as well. Because:

HFL = A + F.Porch + B.Porch + Sync. (horiz.)
VFL = E + F.Porch + B.Porch + Sync. (vert.)
Video bandwith = maximum Pixel Clock you have reached (without a
distorted picture)
It also tells you, what's your maximum reachable horizontal 
frequency.
(look in VidModes file to understand, what HFL etc. mean).

Remarks:
--------
- if you get horizontal frequency let's say 86Hz in the MGA Monitor
  program, it's possible, that you will have to increase it to 87Hz
  when entering HorizSync in the XF86Config file (my case)
- monitors usually don't allow you to damage them by "overclocking"
  (nowadays, but be careful if you have an old type - simply don't
  try to go over the maximum horiz. frequency more than about 5%)
- you can go over the maximum pixel clock given by the manufacturer.
  My monitor shouldn't go over 135MHz, but I use those 146MHz and
  I have even tried 175MHz with no problem (basic thing in this case
  is not damage of your monitor, but distorted or not sharp picture)
- if I write something about "reaching maximum vertical frequency by
  this resolution", it's not a must, of course. But it's highly
  recomended (because you have paid for it ;-).
- there is a new program for setting XFree86 3.2 called XF86Setup in 
  the X package. After starting it you should do required things in 
  graphic environment, maybe you don't need anything I described above.
  I don't know, because in my case this program caused my computer to
  freeze (hard reset was necessary, so I didn't try to freeze it again).
- my XF86Config file looks like this:

Section "Files"

RgbPath	        "/usr/X11R6/lib/X11/rgb"

FontPath	"/usr/X11R6/lib/X11/fonts/misc/"
FontPath	"/usr/X11R6/lib/X11/fonts/75dpi/:unscaled"
FontPath	"/usr/X11R6/lib/X11/fonts/100dpi/:unscaled"
FontPath	"/usr/X11R6/lib/X11/fonts/Type1/"
FontPath	"/usr/X11R6/lib/X11/fonts/Speedo/"
FontPath	"/usr/X11R6/lib/X11/fonts/75dpi/"
FontPath	"/usr/X11R6/lib/X11/fonts/100dpi/"
FontPath        "/usr/X11R6/lib/X11/fonts/cyrillic/"

Section "Keyboard"

    Protocol	"Standard"
    AutoRepeat	500 5

EndSection

Section "Pointer"

    Protocol	"PS/2"
    Device	"/dev/mouse"

EndSection

Section "Monitor"

    Identifier	"Samtron"
    VendorName	"Samtron Seoul, Suwon, Korea"
    ModelName	"SC-726GXL"
    HorizSync	30-87         
    VertRefresh	50-121

# Modes for Samtron 
#
#  640x 480/120Hz/61kHz/24bit
#  800x 600/120Hz/76kHz/24bit
# 1024x 768/104Hz/85kHz/24bit
# 1152x 864/ 93Hz/85kHz/24bit
# 1280x1024/ 81Hz/86kHz/24bit
# 1600x1200/ 69Hz/86kHz/16bit (just in case)

ModeLine   "640x480"  50.818   640  696  752  832   480  481  484  509
ModeLine   "800x600"  79.354   800  832  896 1048   600  601  604  631
ModeLine  "1024x768" 111.341  1024 1040 1136 1312   768  773  776  816 
ModeLine  "1152x864" 128.541  1152 1184 1312 1504   864  869  872  919
ModeLine "1280x1024" 145.752  1280 1296 1440 1688  1024 1025 1028 1066
ModeLine "1600x1200" 175.500  1600 1616 1720 2128  1200 1205 1208 1261

EndSection

Section "Device"
    Identifier	"Matrox"
    VendorName	"Matrox Graphics Inc., Quebec, Canada"
    BoardName	"MGA Millennium"
EndSection

Section "Screen"

#switch between modes: <Ctrl-Alt-"NumMinus">

    Driver	"svga"
    Device	"Matrox"
    Monitor	"Samtron"
    Subsection "Display"
        Depth	    24 
        Modes	    "1280x1024" "1152x864"
                    "1024x768"  "800x600"  "640x480"
        ViewPort    0 0
        Virtual     1280 1024 
    EndSubsection

EndSection

And that's all folks. I hope this pamphlet could help some people.
If yes, I'm very glad.

                             Bye,        Lubor

Lubor Dedina, Prague, Czech Republic     lubord na bajt.cz


Další informace o konferenci Linux