From rab@tauon.ph.unimelb.edu.au Mon Jul 18 09:28:20 EDT 1994 Article: 44315 of comp.os.linux.help Path: bigblue.oit.unc.edu!concert!gatech!swrinde!ihnp4.ucsd.edu!munnari.oz.au!ariel.ucs.unimelb.EDU.AU!tauon.ph.unimelb.edu.au!rab From: rab@tauon.ph.unimelb.edu.au (Richard Brown) Newsgroups: comp.windows.x.i386unix,comp.os.linux.help Subject: ANNOUNCE: awk script for generating Xconfig timings Date: 16 Jul 1994 05:03:46 GMT Organization: School of Physics, University of Melbourne Lines: 119 Message-ID: <307pni$esg@ariel.ucs.unimelb.EDU.AU> References: NNTP-Posting-Host: tauon.ph.unimelb.edu.au Xref: bigblue.oit.unc.edu comp.windows.x.i386unix:10789 comp.os.linux.help:44315 > p_quinn@ECE.Concordia.CA (Paul Quinn) writes: >> >>I just downloaded the xserver for the #9GXE64 from ftp.cdrom.com. Does >>anyone have an Xconfig for this card. I have a Sony 1730 monitor. Since people keep asking for Xconfig files, i thought i'd post this handy awk script for generating timings. If you know the specs of your monitor, you can specify them and give the script resolution and dot clock frequency. If you have set the maximum scan frequencies correctly, then everything should be OK, but just in case, as always, don't blame me if you fry your monitor: know what you are doing. However, this works well for me, and it's easier than using a calculator. It writes output suitable for direct inclusion in Xconfig so you can do: % awk -f xconfig.awk HR=1024 VR=768 DCF=110 < /dev/null >> Xconfig and it includes the refresh rate and horizontal scan frequency. Save this as xconfig.awk: ----------------------x snip x-------------------------------------- # # xconfig.awk - awk script for calculating Xconfig parameters for # XFree86, given the monitor specs and dot clock frequencies. # The default values are for the Viewsonic 15. # # Example Usage: # awk -f xconfig.awk HR=1024 VR=768 DCF=110 < /dev/null (or ^D input) # # The variable names and meanings are given below. # # Author: Richard Brown rab@tauon.ph.unimelb.edu.au # BEGIN{ # Sensible defaults if not specified: HR = 1024 # Horizontal Resolution VR = 768 # Vertical Resolution DCF = 110.0 # Dot Clock Frequency (MHz) HFrontMIN = 0.50 # Horizontal Front Porch Minimum (us) HsyncMIN = 1.20 # Horizontal Sync Pulse Width Minimum (us) HBackMIN = 1.25 # Horizontal Back Porch Minimum (us) HBlankMIN = 4.00 # Horizontal Blank Period Minimum (us) HSFMAX = 64.0 # Max Horizontal Scan Frequency (kHz) VFrontMIN = 0.0 # Vertical Front Porch Minimum VsyncMIN = 45.0 # Vertical Sync Pulse Width Minimum VBackMIN = 500.0 # Vertical Back Porch Minimum VBlankMIN = 600.0 # Vertical Blank Period Minimum VSFMAX = 90.0 # Max Vertical Scan Frequency (Hz) verbose = 0 } END{ # Horizontal Scan Lines: Hfront = HFrontMIN * DCF + HR if( Hfront%8 ) Hfront = 8 * (1 + int(Hfront/8) ) # if( (Hfront - HR) < HFrontMIN * DCF ) Hfront += 8 Hsync = HsyncMIN * DCF + Hfront if( Hsync%8 ) Hsync = 8 * (1 + int(Hsync/8) ) Hblank = HBlankMIN * DCF HFL = HR + Hblank if( HFL%8 ) HFL = 8 * (1 + int(HFL/8) ) # Vertical: Vtick = HFL / DCF # us Vfront = VR + VfrontMIN / Vtick Vsync = Vfront + VsyncMIN / Vtick Vback = VBackMIN / Vtick Vblank = VBlankMIN / Vtick VFL = Vsync + Vback if( VFL < VR + Vblank ) VFL = VR + Vblank RR = 1000000 * DCF / (HFL * VFL) HSF = 1000 * DCF / HFL # Done: generate some output: if( verbose ) { printf "\n# Horizontal:\n" printf "# Front Porch = %.2f us, Sync = %.2f, Back Porch = %.2f, ", (Hfront - HR) / DCF, (Hsync - Hfront) / DCF, (HFL - Hsync) / DCF printf "Blank = %.2f\n\n", (HFL - HR) / DCF } printf "# Refresh Rate: %.2f Hz, Horizontal Sync Frequency: %.2f kHz\n", RR, HSF printf " \"%dx%d\"\t%.2f\t%d %d %d %d %d %d %d %d\n", HR, VR, DCF, HR, Hfront, Hsync, HFL, VR, Vfront, Vsync, VFL if( HSF > HSFMAX ) printf("\nWarning: the Horizontal sync frequency may be too high for the monitor!\n") if( RR > VSFMAX ) printf("\nWarning: this refresh rate may be too high for the monitor!\n") } ----------------------x snip x-------------------------------------- rab -- ------------------------------------------------------------------------ Richard Brown | E-mail: rab@tauon.ph.unimelb.EDU.AU School of Physics | Phone : +61 3 344 5081 University of Melbourne | Fax : +61 3 347 4783 Parkville Victoria AUSTRALIA 3052 | Telex : AA35185