knowplace.org

XFree86 Modelines Conversion Guide

(Updated 03/21/98)

Well, I hope that you've found this info useful. Maybe someday you'll be able to just pick the name and model of your monitor, and have all this set up in X-Windows. I wouldn't recommend holding your breath.

Linux has always possessed a well deserved reputation for being difficult to use and setup, not to mention X-Windows. After my little adventure of trying to convert the monitor timings I used in Win95 to the modelines used in XF86Config, I decided to write yet another page for cutting to the chase. If you want to know more about anything that is not covered here, you should go to XFree86 Video Timing HOWTO. Chances are, if the answer you're seeking is not on the page you're currently feasting your eyes on, I know nothing about it.

Basically, in Win95 (or other operating systems), you can often edit your monitor timings (via video card settings) to vary the display width, height, size or centering. You can also do the same thing in X-Windows. However, it occurred to me that as long as I'm going to be using the same resolutions in both X-Windows and Win95, why shouldn't I just use the same timings?

Well, easier said then done. After quite a bit of research, and desparate plees for help, I finally managed to get the timings converted to the XF86Config modelines. My sincere thanks to Bob Myers (myers@fc.hp.com) and Mark Vojkovich (mvojkovi@ucsd.edu) for shedding light on things. As it turns it, the conversion is actually quite simple. Guess it's just a Linux convention to make everything as tough as possible to the uninitiated.

Without further babbling, you can often find timings for your monitor in the form of (I used the standard VESA timings for 1024x768@85Hz):

Pixel Clock: 94500
Horizontal Display: 1024
Horizontal Front Porch: 48
Horizontal Sync: 96
Horizontal Back Porch: 208
Horizontal Sync Polarity: Positive
Vertical Display: 768
Vertical Front Porch: 1
Vertical Sync: 3
Vertical Back Porch: 36
Vertical Sync Polarity: Positive

The corresponding XF86Config modeline would look like: Modeline "1024x768" 94.5 1024 1072 1168 1376 768 769 772 808 +HSync +VSync.

Modeline "1024x768" identifies the content of this line as settings for a mode called "1024x768." 94.5 is the pixel clock or dot clock expressed in MHz (1x10^6 Hertz). The info for my monitor timings is expressed in KHz (1x10^3 Hertz), so I had to divide 94500 by 1000. 1024 is the horizontal resolution or display width. 1072 is the value of the front porch (48) plus the value of the horizontal display width (1024). 1168 is the sum of the horizontal sync value (96) plus the previous sum (1072). 1376 is the sum of the horizontal back porch (208) plus the previous sum (1168). 768 is the vertical resolution or display height. The method for obtaining the vertical modeline values are exactly as the horizontal values. You should be able to figure that out for yourself. +HSync is the syntax for setting the horizontal sync polarity to positive. -HSync would be the syntax for setting it to negative.

Below is a simple diagram to explain how to convert the settings.
Monitor Timing Conversions Diagram

Below are the standard VESA timings that I have:


[*Vesa Monitor @75Hz (1600X1200)]   [*Vesa Monitor @85Hz (1600X1200)]
PIXEL CLK  = 202500                 PIXEL CLK  = 229500
H DISP     = 1600                   H DISP     = 1600
H FPORCH   = 64                     H FPORCH   = 64
H SYNC     = 192                    H SYNC     = 192
H BPORCH   = 304                    H BPORCH   = 304
H SYNC POL = Positive               H SYNC POL = Positive
V DISP     = 1200                   V DISP     = 1200
V FPORCH   = 1                      V FPORCH   = 1
V SYNC     = 3                      V SYNC     = 3
V BPORCH   = 46                     V BPORCH   = 46
V SYNC POL = Positive               V SYNC POL = Positive


[*Vesa Monitor @75Hz (1280X1024)]   [*Vesa Monitor @85Hz (1280X1024)]
PIXEL CLK  = 135000                 PIXEL CLK  = 157500
H DISP     = 1280                   H DISP     = 1280
H FPORCH   = 16                     H FPORCH   = 64
H SYNC     = 144                    H SYNC     = 160
H BPORCH   = 248                    H BPORCH   = 224
H SYNC POL = Positive               H SYNC POL = Positive
V DISP     = 1024                   V DISP     = 1024
V FPORCH   = 1                      V FPORCH   = 1
V SYNC     = 3                      V SYNC     = 3
V BPORCH   = 38                     V BPORCH   = 44
V SYNC POL = Positive               V SYNC POL = Positive


[*Vesa Monitor @75Hz (1152X864)]    [*Vesa Monitor @85Hz (1152X864)]
PIXEL CLK  = 108000                 PIXEL CLK  = 121500
H DISP     = 1152                   H DISP     = 1152
H FPORCH   = 64                     H FPORCH   = 64
H SYNC     = 128                    H SYNC     = 128
H BPORCH   = 256                    H BPORCH   = 224
H SYNC POL = Positive               H SYNC POL = Positive
V DISP     = 864                    V DISP     = 864
V FPORCH   = 1                      V FPORCH   = 1
V SYNC     = 3                      V SYNC     = 3
V BPORCH   = 32                     V BPORCH   = 43
V SYNC POL = Positive               V SYNC POL = Positive


[*Vesa Monitor @75Hz (1024X768)]    [*Vesa Monitor @85Hz (1024X768)]
PIXEL CLK  = 78750                  PIXEL CLK  = 94500
H DISP     = 1024                   H DISP     = 1024
H FPORCH   = 16                     H FPORCH   = 48
H SYNC     = 96                     H SYNC     = 96
H BPORCH   = 176                    H BPORCH   = 208
H SYNC POL = Positive               H SYNC POL = Positive
V DISP     = 768                    V DISP     = 768
V FPORCH   = 1                      V FPORCH   = 1
V SYNC     = 3                      V SYNC     = 3
V BPORCH   = 28                     V BPORCH   = 36
V SYNC POL = Positive               V SYNC POL = Positive


[*Vesa Monitor @75Hz (800X600)]     [*Vesa Monitor @85Hz (800X600)]
PIXEL CLK  = 49500                  PIXEL CLK  = 56250
H DISP     = 800                    H DISP     = 800
H FPORCH   = 16                     H FPORCH   = 32
H SYNC     = 80                     H SYNC     = 64
H BPORCH   = 160                    H BPORCH   = 152
H SYNC POL = Positive               H SYNC POL = Positive
V DISP     = 600                    V DISP     = 600
V FPORCH   = 1                      V FPORCH   = 1
V SYNC     = 3                      V SYNC     = 3
V BPORCH   = 21                     V BPORCH   = 27
V SYNC POL = Positive               V SYNC POL = Positive


[*Vesa Monitor @75Hz (640X480)]     [*Vesa Monitor @85Hz (640X480)]
PIXEL CLK  = 31500                  PIXEL CLK  = 36000
H DISP     = 640                    H DISP     = 640
H FPORCH   = 16                     H FPORCH   = 56
H SYNC     = 64                     H SYNC     = 56
H BPORCH   = 120                    H BPORCH   = 80
H SYNC POL = Negative               H SYNC POL = Negative
V DISP     = 480                    V DISP     = 480
V FPORCH   = 1                      V FPORCH   = 1
V SYNC     = 3                      V SYNC     = 3
V BPORCH   = 16                     V BPORCH   = 25
V SYNC POL = Negative               V SYNC POL = Negative

Some of you might have noticed that the timings above were obtained from a text file called "mga.mon" from Matrox. Please don't email me to request it. The quickest way to get a hold of it is to download it at http://www.matrox.com/mga/drivers/bios/home.htm as a part of the BIOS package. Thanks to Frederic Devernay (devernay@istar.fr), there is now a PERL script (mga2modelines.tgz) to convert the MGA.MON file to the modelines you all know and love. As I do not know PERL or any other programming languages, I couldn't help you even if I wanted to; please send all your questions and comments of "mga2modelines.pl" to Frederic Devernay.

 

 

 

 
Shane Tzen © 2010