home *** CD-ROM | disk | FTP | other *** search
- Linux XFree-to-Xinside mini-HOWTO
- by Marco Melgazzi, marco@techie.com
- version 1.3 / 1997 September
-
- How to convert an XFree86 modeline into an XInside/XiGraphics one
-
- 1. Introduction
-
- During the spring of 1996 I've seen a lot of posts in comp.os.linux.x
- asking how to convert video modes between XFree86 and one of its
- commercial alternatives: XInside ( now named XiGraphics, note anyway
- that in this document I'll use the old product name, since I will
- mainly refer to that version )
-
- I had evaluated before the product and had this evaluation version
- still floating on my hard disk: since I like problem solving, I've
- decided to give it a try and, after a couple of hours of fiddling and
- calculating, I came up with a supposedly informative article that was
- promptly posted.
-
- The discussions about how to convert suddendly vanished and I received
- 1 (one) mail thanking me for the article so, since maybe somebody else
- could need this information in the future, I decided to transform that
- post in the mini-HOWTO you are reading.
-
- Let me state something first: I do NOT work for XInside and I only had
- access to the evaluation 1.2 version for Linux. I know that nowadays (
- May 97 ) AccelX has reached revision 3.1, but I do think that the
- information included in this document, if not verbatim, is still
- applicable.
-
- Due to the fact that this HOWTO has been written with the help of a
- pretty old Xinside version, it may well happen that some of the
- information contained here is not completely accurate: as you will
- read later, thanks to the birth of XFree 3.2, I haven't bought this
- commercial server, so if you have, and if you notice any incorrect
- information here please take the time to email me.
-
- Notice anyway that fiddling with monitor timings can be hazardous and,
- for this reason, I absolutely make no guarantees. If it works for you
- , fine, if you blow up your computer I shall not be held responsible
- for it.
-
- As you may have noticed from may name, I'm not a native speaker of
- English so you will probably find some errors here and there, I
- apologize for them and I ask you to please avoid flooding my mailbox
- with language-related flames. Thanks !
-
- 2. Why should I need it ?
-
- I think that the Xinside policy of not giving you an utility to tweak
- your video modes ( like xvidtune ) and/or to import your existing
- XFree ones in the evaluation ( and AFAIK commercial ) version is
- incomprehensible. I've spent about three hours putting this together
- ( hint: I've compared the VESA 1024x768@70Hz entry in the two formats
- ( and I'm nearly an electronic engineer ;-)) while an Xinside
- programmer could have written a comparable article in a fraction of
- this time...
-
- I haven't downloaded any evaluation version from 1.3 onwards and I
- really hope they have fixed this. Well, if they have, this mini-HOWTO
- could be considered useless but, alas, if you read it you will learn
- something more about how everything works...
- 3. Let's go
-
- Let's suppose that you have your oh-so-tweaked XFree86 mode and you
- want to evaluate Xinside in the same conditions: follow the steps
- described below and you should be able to do it; we will use my
- default video mode as a real-life example and I will explain what you
- will have to do to convert it.
-
- An Xfree86 entry looks like this:
-
- Modeline "blahblah" DOTCLK A B C D a b c d
-
- Every one of the A-D and a-d numbers has a meaning: if you want you
- can search for it in the 'The Hitchhiker's Guide to X386/XFree86 Video
- Timing' ( /usr/lib/X11/doc/VideoModes.doc ) but you don't need to know
- the theory behind all this to perform a succesful conversion...
-
- My modeline in /usr/lib/X11/XF86Config is:
-
- Modeline "1168x876" 105 1168 1256 1544 1640 876 877 891 900
- | | | | | | | | |
- DOT_CLK A B C D a b c d
-
- In Xinside, you have to add an entry in the Xtimings file, which
- should be located in etc/ ( from now on we suppose you are in the top
- Xaccel directory that should be something like
- /usr/X11/lib/X11/AcceleratedX )
-
- ! Somewhere in the file, put here the name you want
-
- [PREADJUSTED_TIMING]
- PreadjustedTimingName = "1168x876 @ 72Hz";
-
- !
- ! These four are obvious
- !
- HorPixel = 1168; // pixels
- VerPixel = 876; // lines
- PixelWidthRatio = 4;
- PixelHeightRatio = 3;
-
- !
- ! hsync: DOT_CLK / D * 1000 [KHz]
- !
- ! hsync = 105 / 1640 * 1000 = 64.024 KHz
- !
- ! vsync: ( 1 / (( D / DOT_CLK ) * d) ) * 1,000,000 [Hz]
- !
- ! vsync: ( 1 / (( 1640 / 105 ) * 900) ) * 1,000,000
- ! ( 1 / 14057.1428571 ) * 1,000,000 = 71.138 Hz
- !
-
- HorFrequency = 64.180; // kHz
- VerFrequency = 71.138; // Hz
-
- ! Obvious
-
- ScanType = NONINTERLACED;
-
- !
- ! Put here the +/-hsync +/-vsync XFree86 options
- !
- HorSyncPolarity = POSITIVE;
- VerSyncPolarity = POSITIVE;
-
- ! Shouldn't change
-
- CharacterWidth = 8; // pixels
-
- ! DOT_CLK here
-
- PixelClock = 105.000; // MHz
- !
- !
- ! horizontal timings section: [usec]
- !
- HorTotalTime = D / DOT_CLK = 15.619;
- HorAddrTime = A / DOT_CLK = 11.124;
- HorBlankStart = A / DOT_CLK = 11.124;
- HorBlankTime = HorTotalTime - HorBlankStart = 4.495;
- HorSyncStart = B / DOT_CLK = 11.962;
- HorSyncTime = C / DOT_CLK - HorSyncStart = 2.743;
-
- !
- ! vertical timings section: [msec]
- !
-
- VerTotalTime = ( HorTotalTime * d ) / 1000 = 14.057;
- VerAddrTime = ( HorTotalTime * a ) / 1000 = 13.682;
- VerBlankStart = ( HorTotalTime * a ) / 1000 = 13.682;
- VerBlankTime = VerTotalTime - VerBlankStart = 0.375;
- VerSyncStart = ( HorTotalTime * b ) / 1000 = 13.698;
- VerSyncTime = ( HorTotalTime * ( c - b ) ) / 1000
- = 0.219
- ! Finished !
-
- Now you have to put this newly created mode in the files shown below
- in the appropriate place.
-
- 4. Fixing up things
-
- In the excerpts shown below the -> sign tells you what was modified:
- do NOT include it in your files!
-
- Monitor entry ( mine is monitors/mfreq/mfreq64.vda)
-
- [ESTABLISHED_TIMINGS]
- "640x480 @ 60Hz",
- "640x480 @ 72Hz",
- "640x480 @ 75Hz",
- "800x600 @ 56Hz",
- "800x600 @ 60Hz",
- "800x600 @ 72Hz",
- "800x600 @ 75Hz",
- "1024x768 Interlaced",
- "1024x768 @ 60Hz",
- "1024x768 @ 70Hz",
- "1024x768 @ 75Hz",
- "1152x900 Interlaced",
- "1152x900 @ 60Hz",
- "1152x900 @ 67Hz",
- -> "1168x876 @ 72Hz",
- "1280x1024 Interlaced",
- "1280x1024 @ 60Hz",
- "1600x1200 Interlaced";
-
- Board info file ( mine is boards/s3/764-2.xqa , I wonder why they have
- nearly all the Hercules boards but not MINE: Terminator 64/Dram )
-
- [VISUAL]
- BitsPerPixel = 8;
- MemoryModel = Packed;
- ColorModel = Indexed;
- BitsRGB = 6;
- NumberOfColors = 256;
-
- [RESOLUTIONS]
- 640x480,
- 800x600,
- 1024x768,
- -> 1168x876,
- 1152x900,
- 1280x1024
-
- [DESKTOPS]
- 640x480,
- 800x600,
- 1024x768,
- 1152x900,
- -> 1168x876,
- 1280x1024,
- 1600x1200
-
- If the dot clock is low enough ( NOT in this case for my board ) you
- can put the entry even in the 16bpp and 32bpp sec- tions.
-
- The /etc/Xaccel.ini will look something like this
-
- --------------------------------------------------------------
- Board = "s3/764-2.xqa";
- Monitor = "mfreq/mfreq64.vda";
- Depth = 8;
- -> Desktop = 1168x876;
-
- [RESOLUTIONS]
- -> 1168x876,
- 1024x768;
-
- The actual Xinside mode entry in etc/Xtimings
-
- --------------------------------------------------------------
- [PREADJUSTED_TIMING]
- PreadjustedTimingName = "1168x876 @ 72Hz";
-
- HorPixel = 1168; // pixels
- VerPixel = 876; // lines
- PixelWidthRatio = 4;
- PixelHeightRatio = 3;
- HorFrequency = 64.024; // kHz
- VerFrequency = 71.138; // Hz
- ScanType = NONINTERLACED;
- HorSyncPolarity = POSITIVE;
- VerSyncPolarity = POSITIVE;
- CharacterWidth = 8; // pixels
- PixelClock = 105.000; // MHz
- HorTotalTime = 15.619; // (usec) = 205 chars
- HorAddrTime = 11.124; // (usec) = 146 chars
- HorBlankStart = 11.124; // (usec) = 146 chars
- HorBlankTime = 4.495; // (usec) = 59 chars
- HorSyncStart = 11.962; // (usec) = 157 chars
- HorSyncTime = 2.743; // (usec) = 36 chars
- VerTotalTime = 14.057; // (msec) = 900 lines
- VerAddrTime = 13.682; // (msec) = 876 lines
- VerBlankStart = 13.682; // (msec) = 876 lines
- VerBlankTime = 0.375; // (msec) = 24 lines
- VerSyncStart = 13.698; // (msec) = 877 lines
- VerSyncTime = 0.219; // (msec) = 14 lines
-
- You can check your conversion by running the vgaset program with no
- parameters while running the Xinside server: it will output an XFree-
- like line and, if everything went OK, this line will be equal to the
- line you started from ( except if b and c are equal, I haven't been
- able to reproduce this situation in Xinside: the best case was c=b+1
- ).
-
- 5. The end...
-
- That's all folks ! I hope this will be useful to you. I don't think
- I'll buy the XiGraphics server in the near future for one simple
- reason: the release of XFree86 3.2 solved all of the text speed
- problems I was having on my humble Trio 64 video board ;)
-
- It seems anyway that the XiGraphics server supports a much wider array
- of chipsets and video boards than XFree, so it may well happen that
- the commercial 'alternative' is the only viable one for you. If this
- is the case, and you bought the XiGraphics server, I would really like
- to hear from you to know if the information presented here has been
- useful to you, or if you found it too complex or whatever.
-
- 6. Automating the process
-
- This small script automates most of the work. Be very careful with the
- ScanType and with the two Polarity lines: the script do not set them
- and, if you are too lazy to correct them, the risks of blowing up your
- monitor increase quite a lot.
-
- Notice that I don't know if the 'Doublescan' flag has meaning in
- XInside: if you try to convert a low-res doublescan mode BE CAREFUL,
- you can easily kill your monitor since the refresh rate that you get
- is doubled ( in fact my 400x300@72Hz became a 400x300@144Hz !).
-
- #!/bin/sh
- ##########################################################################
- # XF2XInside
- #
- # This script converts modelines from XF86Config format to XInside
- # format as needed for the etc/Xtiming file.
- #
- # This is a quick hack, so don't expect much error checking (not to
- # speak of anything like user friendlyness).
- #
- # If you call it without arguments it should tell you what to do.
- #
- # ( July 1996, hcz@tazlwurm.bb.bawue.de)
- #
- # Btw: New modes created as described in the HOWTO work, but don't
- # show up in Xsetup's menu. Anybody who knows why?
- #
- ##########################################################################
- #----------------------------------------------- Here we go:
- # Change this if your modeline file lives somewhere else:
- XF=/usr/X11/lib/X11/XF86Config
- if [ $# -ne 1 ] ; then
- echo "usage: ${0##*/} <mode>"
- echo " example: ${0##*/} 1024x764"
- echo -e " function: converts $XF modeline entry into\n Xinside Format (stdout)"
- exit 1
- fi
- egrep -i "^[\t ]*modeline.+\"$1\"" /usr/X11/lib/X11/XF86Config |
- gawk '
- NF < 11 { print "! invalid Modeline:\n! " $0 "\n!"; next }
- {
- print "//", $0 ":"
- name = $2
- DOT_CLK = $3;
- A = $4;
- B = $5;
- C = $6;
- D = $7;
- a = $8;
- b = $9;
- c = $10;
- d = $11;
- VerFrequency = 1000000 / ((D / DOT_CLK) * d)
- print "[PREADJUSTED_TIMING]"
- printf " PreadjustedTimingName = \"%dx%d @ %.0dHz\";\n", A, a, VerFrequency
- print " HorPixel\t\t= " A ";"
- print " VerPixel\t\t= " a ";"
- print " PixelWidthRatio\t= 4;\n PixelHeightRatio\t= 3;"
- print " HorFrequency\t\t= " DOT_CLK / D * 1000 ";\t// kHz"
- print " VerFrequency\t\t= " VerFrequency ";\t// Hz"
- print " ScanType\t\t= NONINTERLACED;\t\t// *CHECK*"
- print " HorSyncPolarity\t= NEGATIVE;\t\t\t// *CHECK*"
- print " VerSyncPolarity\t= NEGATIVE;\t\t\t// *CHECK*"
- print " CharacterWidth\t= 8;"
- print " PixelClock\t\t= " DOT_CLK ";"
- HorTotalTime = D / DOT_CLK
- print " HorTotalTime\t\t= " HorTotalTime ";"
- print " HorAddrTime \t\t= " A / DOT_CLK ";"
- print " HorBlankStart\t\t= " A / DOT_CLK ";"
- print " HorBlankTime\t\t= " D / DOT_CLK - A / DOT_CLK ";"
- print " HorSyncStart\t\t= " B / DOT_CLK ";"
- print " HorSyncTime\t\t= " C / DOT_CLK - B / DOT_CLK ";"
- VerTotalTime = ( HorTotalTime * d ) / 1000
- print " VerTotalTime\t\t= " VerTotalTime ";"
- print " VerAddrTime\t\t= " ( HorTotalTime * a ) / 1000 ";"
- VerBlankStart = ( HorTotalTime * a ) / 1000
- print " VerBlankStart\t\t= " VerBlankStart ";"
- print " VerBlankTime\t\t= " VerTotalTime - VerBlankStart ";"
- print " VerSyncStart\t\t= " ( HorTotalTime * b ) / 1000 ";"
- print " VerSyncTime\t\t= " ( HorTotalTime * ( c - b ) ) / 1000
- print ""
- }'
-
- 7. Thanks to
-
- ╖ Heike Claudia Zimmerer hcz@tazlwurm.bb.bawue.de for pointing out a
- small inconsistency and for sending me a script that automates most
- of the work.
-
- ╖ Bartosz Maruszewski B.Maruszewski@zsmeie.torun.pl for translating
- this mini HOWTO in Polish and for pointing out a small typo.
-
- 8. Copyright/legalese
-
- (c)opyright 1996-7 by Marco Melgazzi (marco@techie.com) - the GPL (Gnu
- Public License) applies. To obtain a copy of the GPL write to the Free
- Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
-
- Trademarks are owned by their owners. There is no warranty on the
- accuracy and/or the usefulness of the information given in this
- document.
-
-