home *** CD-ROM | disk | FTP | other *** search
/ CD Actual 13 / CDA13.ISO / DOC / HOWTO / MINI / XFREE86_ < prev    next >
Encoding:
Text File  |  1996-08-02  |  13.6 KB  |  370 lines

  1.   Linux XFree-to-Xinside mini-HOWTO
  2.   by Marco Melgazzi, s64912@athena.polito.it
  3.   version 1.1 / 1996 July
  4.  
  5.   How to convert an XFree86 modeline into an XInside one
  6.  
  7.   1.  Introduction
  8.  
  9.   During the past few months I've seen a lot of posts in comp.os.linux.x
  10.   asking how to convert video modes between XFree86 and one of its
  11.   commercial alternatives: XInside.
  12.  
  13.   I had evaluated before the product and had this evaluation version
  14.   still floating on my hard disk: since I like problem solving, I've
  15.   decided to give it a try and, after a couple of hours of fiddling and
  16.   calculating, I came up with a supposedly informative article that was
  17.   promptly posted.
  18.  
  19.   The discussions about how to convert suddendly vanished and I received
  20.   1 (one) mail thanking me for the article so, since maybe somebody else
  21.   could need this information in the future, I decided to transform that
  22.   post in the mini-HOWTO you are reading.
  23.  
  24.   Let me state something first: I do NOT work for XInside and I only had
  25.   access to the evaluation 1.2 version for Linux. Fiddling with monitor
  26.   timings can be hazardous and, for this reason, I absolutely make no
  27.   guarantees. If it works for you , fine, if you blow up your computer I
  28.   shall not be held responsible for it.
  29.  
  30.   As you may have noticed from may name, I'm not a native speaker of
  31.   English so you will probably find some errors here and there, I
  32.   apologize for them and I ask you to please avoid flooding my mailbox
  33.   with language-related flames. Thanks !
  34.  
  35.   2.  Why should I need it ?
  36.  
  37.   I think that the Xinside policy of not giving you an utility to tweak
  38.   your video modes ( like xvidtune ) and/or to import your existing
  39.   XFree ones in the evaluation ( and AFAIK commercial ) version is
  40.   incomprehensible.  I've spent about three hours putting this together
  41.   ( hint: I've compared the VESA 1024x768@70Hz entry in the two formats
  42.   ( and I'm nearly an electronic engineer ;-)) while an Xinside
  43.   programmer could have written a comparable article in a fraction of
  44.   this time...
  45.  
  46.   I haven't downloaded the 1.3 evaluation version and I really hope they
  47.   have fixed this. Well, if they have, this mini-HOWTO could be
  48.   considered useless but, alas, if you read it you will learn something
  49.   more about how everything works...
  50.  
  51.   3.  Let's go
  52.  
  53.   Let's suppose that you have your oh-so-tweaked XFree86 mode and you
  54.   want to evaluate Xinside in the same conditions: follow the steps
  55.   described below and you should be able to do it; we will use my
  56.   default video mode as a real-life example and I will explain what you
  57.   will have to do to convert it.
  58.  
  59.   An Xfree86 entry looks like this:
  60.  
  61.   Modeline "blahblah" DOTCLK  A B C D  a b c d
  62.  
  63.   Every one of the A-B and 1-4 numbers has a meaning: if you want you
  64.   can search for it in the 'The Hitchhiker's Guide to X386/XFree86 Video
  65.   Timing' ( /usr/lib/X11/doc/VideoModes.doc ) but you don't need to know
  66.   the theory behind all this to perform a succesful conversion...
  67.  
  68.   My modeline in /usr/lib/X11/XF86Config is:
  69.  
  70.        Modeline "1168x876" 105  1168 1256 1544 1640  876 877 891 900
  71.                             |     |    |    |    |    |   |   |   |
  72.                          DOT_CLK  A    B    C    D    a   b   c   d
  73.  
  74.   In Xinside, you have to add an entry in the Xtimings file, which
  75.   should be located in etc/ ( from now on we suppose you are in the top
  76.   Xaccel directory that should be something like
  77.   /usr/X11/lib/X11/AcceleratedX )
  78.  
  79.   !    Somewhere in the file, put here the name you want
  80.  
  81.   [PREADJUSTED_TIMING]
  82.       PreadjustedTimingName = "1168x876 @ 72Hz";
  83.  
  84.   !
  85.   !    These four are obvious
  86.   !
  87.       HorPixel          = 1168;         // pixels
  88.       VerPixel          = 876;          // lines
  89.       PixelWidthRatio   = 4;
  90.       PixelHeightRatio  = 3;
  91.  
  92.   !
  93.   !   hsync: DOT_CLK / D * 1000 [KHz]
  94.   !
  95.   !   hsync = 105 / 1640 * 1000 = 64.024 KHz
  96.   !
  97.   !   vsync: ( 1 / (( D / DOT_CLK ) * d) ) * 1,000,000 [Hz]
  98.   !
  99.   !   vsync: ( 1 / (( 1640 / 105 ) * 900) ) * 1,000,000
  100.   !           ( 1 / 14057.1428571 ) * 1,000,000 = 71.138 Hz
  101.   !
  102.  
  103.       HorFrequency      = 64.180;        // kHz
  104.       VerFrequency      = 71.138;        // Hz
  105.  
  106.   !   Obvious
  107.  
  108.       ScanType          = NONINTERLACED;
  109.  
  110.   !
  111.   !   Put here the +/-hsync +/-vsync XFree86 options
  112.   !
  113.       HorSyncPolarity   = POSITIVE;
  114.       VerSyncPolarity   = POSITIVE;
  115.  
  116.   !   Shouldn't change
  117.  
  118.       CharacterWidth    = 8;             // pixels
  119.  
  120.   !   DOT_CLK here
  121.  
  122.       PixelClock        = 105.000;       // MHz
  123.   !
  124.   !
  125.   !   horizontal timings section: [usec]
  126.   !
  127.       HorTotalTime  = D / DOT_CLK                  = 15.619;
  128.       HorAddrTime   = A / DOT_CLK                  = 11.124;
  129.       HorBlankStart = A / DOT_CLK                  = 11.124;
  130.       HorBlankTime  = HorTotalTime - HorBlankStart =  4.495;
  131.       HorSyncStart  = B / DOT_CLK                  = 11.962;
  132.       HorSyncTime   = C / DOT_CLK - HorSyncStart   =  2.743;
  133.  
  134.    !
  135.    !  vertical timings section:    [msec]
  136.    !
  137.  
  138.       VerTotalTime  = ( HorTotalTime * d ) / 1000  = 14.057;
  139.       VerAddrTime   = ( HorTotalTime * a ) / 1000  = 13.682;
  140.       VerBlankStart = ( HorTotalTime * a ) / 1000  = 13.682;
  141.       VerBlankTime  = VerTotalTime - VerBlankStart =  0.375;
  142.       VerSyncStart  = ( HorTotalTime * b ) / 1000  = 13.698;
  143.       VerSyncTime   = ( HorTotalTime * ( c - b ) ) / 1000
  144.                                                    = 0.219
  145.    ! Finished !
  146.  
  147.   Now you have to put this newly created mode in the files shown below
  148.   in the appropriate place.
  149.  
  150.   4.  Fixing up things
  151.  
  152.   In the excerpts shown below the -> sign tells you what was modified:
  153.   do NOT include it in your files!
  154.  
  155.   Monitor entry ( mine is monitors/mfreq/mfreq64.vda)
  156.  
  157.            [ESTABLISHED_TIMINGS]
  158.                "640x480 @ 60Hz",
  159.                "640x480 @ 72Hz",
  160.                "640x480 @ 75Hz",
  161.                "800x600 @ 56Hz",
  162.                "800x600 @ 60Hz",
  163.                "800x600 @ 72Hz",
  164.                "800x600 @ 75Hz",
  165.                "1024x768 Interlaced",
  166.                "1024x768 @ 60Hz",
  167.                "1024x768 @ 70Hz",
  168.                "1024x768 @ 75Hz",
  169.            "1152x900 Interlaced",
  170.                "1152x900 @ 60Hz",
  171.                "1152x900 @ 67Hz",
  172.        ->      "1168x876 @ 72Hz",
  173.                "1280x1024 Interlaced",
  174.                "1280x1024 @ 60Hz",
  175.            "1600x1200 Interlaced";
  176.  
  177.   Board info file ( mine is boards/s3/764-2.xqa , I wonder why they have
  178.   nearly all the Hercules boards but not MINE: Terminator 64/Dram )
  179.  
  180.   [VISUAL]
  181.       BitsPerPixel   = 8;
  182.       MemoryModel    = Packed;
  183.       ColorModel     = Indexed;
  184.       BitsRGB        = 6;
  185.       NumberOfColors = 256;
  186.  
  187.       [RESOLUTIONS]
  188.       640x480,
  189.       800x600,
  190.       1024x768,
  191.   ->  1168x876,
  192.       1152x900,
  193.       1280x1024
  194.  
  195.       [DESKTOPS]
  196.       640x480,
  197.       800x600,
  198.       1024x768,
  199.       1152x900,
  200.   ->  1168x876,
  201.       1280x1024,
  202.       1600x1200
  203.  
  204.   If the dot clock is low enough ( NOT in this case for my board ) you
  205.   can put the entry even in the 16bpp and 32bpp sec- tions.
  206.  
  207.   The /etc/Xaccel.ini will look something like this
  208.  
  209.        --------------------------------------------------------------
  210.            Board   = "s3/764-2.xqa";
  211.            Monitor = "mfreq/mfreq64.vda";
  212.            Depth   = 8;
  213.        ->  Desktop = 1168x876;
  214.  
  215.            [RESOLUTIONS]
  216.        ->      1168x876,
  217.                1024x768;
  218.  
  219.   The actual Xinside mode entry in etc/Xtimings
  220.  
  221.   --------------------------------------------------------------
  222.   [PREADJUSTED_TIMING]
  223.       PreadjustedTimingName = "1168x876 @ 72Hz";
  224.  
  225.       HorPixel          = 1168;          // pixels
  226.       VerPixel          = 876;           // lines
  227.       PixelWidthRatio   = 4;
  228.       PixelHeightRatio  = 3;
  229.       HorFrequency      = 64.024;        // kHz
  230.       VerFrequency      = 71.138;        // Hz
  231.       ScanType          = NONINTERLACED;
  232.       HorSyncPolarity   = POSITIVE;
  233.       VerSyncPolarity   = POSITIVE;
  234.       CharacterWidth    = 8;             // pixels
  235.       PixelClock        = 105.000;       // MHz
  236.       HorTotalTime      = 15.619;        // (usec) =  205 chars
  237.       HorAddrTime       = 11.124;        // (usec) =  146 chars
  238.       HorBlankStart     = 11.124;        // (usec) =  146 chars
  239.       HorBlankTime      =  4.495;        // (usec) =   59 chars
  240.       HorSyncStart      = 11.962;        // (usec) =  157 chars
  241.       HorSyncTime       =  2.743;        // (usec) =   36 chars
  242.       VerTotalTime      = 14.057;        // (msec) =  900 lines
  243.       VerAddrTime       = 13.682;        // (msec) =  876 lines
  244.       VerBlankStart     = 13.682;        // (msec) =  876 lines
  245.       VerBlankTime      =  0.375;        // (msec) =   24 lines
  246.       VerSyncStart      = 13.698;        // (msec) =  877 lines
  247.       VerSyncTime       =  0.219;        // (msec) =   14 lines
  248.  
  249.   You can check your conversion by running the vgaset program with no
  250.   parameters while running the Xinside server: it will output an XFree-
  251.   like line and, if everything went OK, this line will be equal to the
  252.   line you started from ( except if b and c are equal, I haven't been
  253.   able to reproduce this situation in Xinside: the best case was c=b+1
  254.   ).
  255.  
  256.   5.  The end...
  257.  
  258.   That's all folks ! I hope this will be useful to you. I don't know if
  259.   I'll buy Xinside: it's quite good and the text speed is really
  260.   unbelievable compared to XFree ( try to move xteddy over an xterm
  261.   window to understand what I mean ) but I'm only a student and I don't
  262.   have a lot of money to spend...
  263.  
  264.   Of course, if somebody at Xinside thinks that this mini-HOWTO is worth
  265.   some support, I wouldn't really mind an 1.3 complete server to ┤test┤
  266.   :)
  267.  
  268.   6.  Automating the process
  269.  
  270.   This small script automates most of the work. Be very careful with the
  271.   ScanType and with the two Polarity lines: the script do not set them
  272.   and, if you are too lazy to correct them, the risks of blowing up your
  273.   monitor increase quite a lot.
  274.  
  275.   Notice that I don't know if the 'Doublescan' flag has meaning in
  276.   XInside: if you try to convert a low-res doublescan mode BE CAREFUL,
  277.   you can easily kill your monitor since the refresh rate that you get
  278.   is doubled ( in fact my 400x300@72Hz became a 400x300@144Hz !).
  279.  
  280.        #!/bin/sh
  281.        ##########################################################################
  282.        # XF2XInside
  283.        #
  284.        # This script converts modelines from XF86Config format to XInside
  285.        # format as needed for the etc/Xtiming file.
  286.        #
  287.        # This is a quick hack, so don't expect much error checking (not to
  288.        # speak of anything like user friendlyness).
  289.        #
  290.        # If you call it without arguments it should tell you what to do.
  291.        #
  292.        #                               ( July 1996, hcz@tazlwurm.bb.bawue.de)
  293.        #
  294.        # Btw: New modes created as described in the HOWTO work, but don't
  295.        # show up in Xsetup's menu. Anybody who knows why?
  296.        #
  297.        ##########################################################################
  298.        #----------------------------------------------- Here we go:
  299.        # Change this if your modeline file lives somewhere else:
  300.        XF=/usr/X11/lib/X11/XF86Config
  301.        if [ $# -ne 1 ] ; then
  302.          echo "usage: ${0##*/} <mode>"
  303.          echo " example: ${0##*/} 1024x764"
  304.          echo -e " function: converts $XF modeline entry into\n Xinside Format (stdout)"
  305.          exit 1
  306.        fi
  307.        egrep -i "^[\t ]*modeline.+\"$1\""  /usr/X11/lib/X11/XF86Config |
  308.        gawk '
  309.        NF < 11  { print "! invalid Modeline:\n! " $0 "\n!"; next }
  310.        {
  311.          print "//", $0  ":"
  312.          name = $2
  313.          DOT_CLK = $3;
  314.          A = $4;
  315.          B = $5;
  316.          C = $6;
  317.          D = $7;
  318.          a = $8;
  319.          b = $9;
  320.          c = $10;
  321.          d = $11;
  322.          VerFrequency =  1000000 / ((D / DOT_CLK) * d)
  323.          print "[PREADJUSTED_TIMING]"
  324.          printf "  PreadjustedTimingName = \"%dx%d @ %.0dHz\";\n", A, a, VerFrequency
  325.          print "  HorPixel\t\t= " A ";"
  326.          print "  VerPixel\t\t= " a ";"
  327.          print "  PixelWidthRatio\t= 4;\n  PixelHeightRatio\t= 3;"
  328.          print "  HorFrequency\t\t= " DOT_CLK / D * 1000 ";\t// kHz"
  329.          print "  VerFrequency\t\t= " VerFrequency  ";\t// Hz"
  330.          print "  ScanType\t\t= NONINTERLACED;\t\t// *CHECK*"
  331.          print "  HorSyncPolarity\t= NEGATIVE;\t\t\t// *CHECK*"
  332.          print "  VerSyncPolarity\t= NEGATIVE;\t\t\t// *CHECK*"
  333.          print "  CharacterWidth\t= 8;"
  334.          print "  PixelClock\t\t= " DOT_CLK ";"
  335.          HorTotalTime = D / DOT_CLK
  336.          print "  HorTotalTime\t\t= " HorTotalTime ";"
  337.          print "  HorAddrTime \t\t= " A / DOT_CLK ";"
  338.          print "  HorBlankStart\t\t= " A / DOT_CLK ";"
  339.          print "  HorBlankTime\t\t= " D / DOT_CLK - A / DOT_CLK ";"
  340.          print "  HorSyncStart\t\t= " B / DOT_CLK ";"
  341.          print "  HorSyncTime\t\t= " C / DOT_CLK - B / DOT_CLK ";"
  342.          VerTotalTime  = ( HorTotalTime * d ) / 1000
  343.          print "  VerTotalTime\t\t= " VerTotalTime ";"
  344.          print "  VerAddrTime\t\t= " ( HorTotalTime * a ) / 1000 ";"
  345.          VerBlankStart = ( HorTotalTime * a ) / 1000
  346.     print "  VerBlankStart\t\t= " VerBlankStart ";"
  347.     print "  VerBlankTime\t\t= " VerTotalTime - VerBlankStart ";"
  348.     print "  VerSyncStart\t\t= " ( HorTotalTime * b ) / 1000 ";"
  349.     print "  VerSyncTime\t\t= " ( HorTotalTime * ( c - b ) ) / 1000
  350.     print ""
  351.   }'
  352.  
  353.   7.  Thanks to
  354.  
  355.   ╖  Heike Claudia Zimmerer hcz@tazlwurm.bb.bawue.de for pointing out a
  356.      small inconsistency and for sending me a script that automates most
  357.      of the work.
  358.  
  359.   8.  Copyright/legalese
  360.  
  361.   (c)opyright 1996 by Marco Melgazzi (s64912@athena.polito.it) - the GPL
  362.   (Gnu Public License) applies. To obtain a copy of the GPL write to the
  363.   Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139,
  364.   USA.
  365.  
  366.   Trademarks are owned by their owners. There is no warranty on the
  367.   accuracy and/or the usefulness of the information given in this
  368.   document.
  369.  
  370.