[Slackware notice: this procedure worked great for me, so I upgraded it
to become part of the Slackware X release. It did, however, cause my
monitor to make some awfully strange sounds on a few of the improper
screen resolutions. If you use it, use it at your own risk, and I would
not suggest leaving the screen on out of sync settings any longer than
needed to figure out which resolutions work for you.

Once you've got stable screens, you might want to use "vgaset" to adjust
the screen position and borders.

The 512K version was not converted, so if you have one of those (rare these
days) and you're going to try to use 256 color X, cut out the SVGA modes
first. The file referred to in the documentation below as Xconfig.1M was
converted to XFree-86 1.3 specs and can be found as:
	/usr/X386/lib/X11/Xconfig.1M

The standard Xconfig in this directory supports 800x600 Trident 8900c. If
you have a tvga8900c, you might want to keep a copy of it in case you want
to switch back to it later. Doesn't seem to be any way around having to do
*some* tweaking when setting up X...

Patrick Volkerding <volkerdi@mhd1.moorhead.msus.edu> ]


-------------------------

From the TAMU release:

[Some of this information is dated, but you'll get the idea about switching
through the possible video modes. For more current information about editing
the other stuff in the Xconfig, you'll probably want to use 'man XFree86'. ]

***SIMPLIFIED X Window Configuration!!!!
***YOU have GOT to try this!!!
***(it even works for trident cards!)

In /usr/lib/X11 there are several Xconfig templates:
	Xconfig.tamu     -  *DEFAULT* - working copy of Xconfig.1M
	Xconfig.1M       -  the install version for 1MB vga cards
	Xconfig.512K     -  the install version for 512K vga cards
	Xconfig          -  working copy of Xconfig.master
	Xconfig.master   -  standard X11 release version (manual install)
	Xconfig.drs      -  this is my tailored copy of Xconfig.1M

By default, when you run "startx", the server will use Xconfig.tamu,
as the hostname is "tamu". This file is a working copy of the .1M
easy installation version for 1MB vga cards.  If your vga card has
only 512K bytes of memory, it can not run in the 1024x768 resolution
modes, so you need to use the Xconfig.512K instead. Do this with:
	[ cp Xconfig.512K Xconfig.tamu ]

Then, in Xconfig.tamu:

1. check the mouse definitions, and if necessary, comment out the default
   (microsoft mouse on ttys0, aka com1:) and uncomment the line
   corresponding to your mouse type and port.  If you are not sure
   what you have, try the mouse test program in
   /usr/X386/lib/X11/etc/v1.1/tst/mouse.
   ** NOTE: apparently the mouse executable in the distribution is bad.
   If it doesn't work for you, simply recompile it with:
	gcc -o mouse mouse.c
   If your mouse has 3 buttons, comment out the "Emulate3Buttons" line.

2. run "startx"
   There will be 48 available "modes" that are essentially all possible
   combinations of clocks and resolutions. You can cycle through all of
   these modes by pressing control-alt-keypad+.  (If your vga card has
   512K, there will be only 32 modes). The modes are named "1" through
   "48" and appear in that order.  Most of these modes will show
   garbage on your screen. Jot down the number (ie 1 - 48) of any
   mode that presents a reasonable display (minor size or x/y offset
   errors can be trimmed out later.) Hopefully you will find at least
   one good mode for each of 1024x768, 800x600, and 640x480 display
   resolutions.  Exit X using control-alt-backspace, and then edit
   Xconfig.tamu, to delete the "bad" mode numbers out of the "Modes"
   line, leaving just the few good ones you jotted down. (You can look 
   at my final version in Xconfig.drs, which left just three modes on 
   the "Modes" line.)

That should be it! No puzzling over the vga database, frequencies,
clocks, or dot calculations!  This has been tested on several machines
with Tseng, trident, and paradise cards.  On my own tseng clone,
in 1 minute I discovered two very nice modes that I had missed in
hours of testing using other methods!

(2.1 If necessary, you may need to tweak the dot values in the corresponding
   mode entries in the ModeDB section, if the display is a little off center.
   Each mode line in the ModeDB section has 4 numbers for horizontal dots,
   and four numbers for vertical dots. If the display is a little off in
   the horizontal or vertical position, try adjusting the MIDDLE two
   numbers in the respective horizontal or vertical set by 10 or 20 dots.
   This needs to be done by trial and error, but at least you have a good
   starting point. ) 

MANUAL X Window Configuration Instructions
==========================================

    If for some reason the simplified method doesn't work, you will
    need to delete Xconfig.tamu, and manually edit the basic Xconfig file.
    First, read the man pages on X and X386.
    There are basically two steps in configuring X.  The mouse configuration
    and the screen configuration.  Both are done by editing the "Xconfig"
    file.  I will describe these by explaining what the certain lines in
    "Xconfig" mean and how to use appropriate values in them.

    Let us first turn to the mouse configuration.  There are two things
    to consider: what is the type of your mouse and which COM port it
    is connected to.  In order to determine you should run the "mouse"
    program.

 1. Go to the /usr/X386/lib/X11/etc/v1.1/tst/mouse directory.  Run the "mouse"
    program and move the mouse and push its buttons.  You should see
    some output from the program indicating that the mouse is operating
    successfully.  Note down the arguments to "mouse" for the next step.

    [ cd /usr/X386/lib/X11/etc/v1.1/tst/mouse ]
    [ mouse Microsoft /dev/ttys1 ]

    (Here the first argument to "mouse" is the name of your mouse.  The
    known mice are: Microsoft, MouseSystems, MMseries, Logitech.  The
    second argument is the COM port or the serial line.  Legal values here
    are "/dev/ttys0", "/dev/ttys1", "/dev/ttys2", "/dev/ttys3".

    If no output appears following the execution of "mouse" and your moving
    the mouse, try different combinations of the two command line arguments.
    You should find one that works, note it down.

    Now enter these in the "Xconfig" file.

 2. Go to the /usr/X386/lib/X11 directory and edit the "Xconfig" file.
    Find the section that describes the mice.  Look for the line similar
    to the following:

              Microsoft     "/dev/ttys2"

    Uncomment the line corresponding to your mouse type and specify your
    mouse serial line as determined by the "mouse" program.

    [ cd /usr/X386/lib/X11 ]
    [ vi Xconfig ]

 3. If you have a two button mouse, you will need to emulate 3 buttons.
    To do this just uncomment the line

              Emulate3Buttons

    (This will make the simultaneous click of both buttons behave as your
    middle mouse button.)

 4. Save "Xconfig" and exit the editor.

    (Let us now turn to the video side of X.  There are 5 things to
    consider.  All four of these appear as lines in "Xconfig".

       1. Chipset -- the chipset of your video card
       2. Clocks -- the driving frequencies of your video card
       3. Modes -- the resolutions, e.g., 800x600, of screen
       4. Virtual -- the "virtual" screen size -- more later
       5. ModeDB -- timing information

    You may be able to get the first four from a vga database of
    known working configurations.  The database is in /usr/X386/lib/X11/doc
    directory and is called "vga.dbase".  Look for your video card in
    that file.  The entry corresponding to my setup looked like this:

         #######################################################################
         # Card:                 Orchid Prodesigner II
         # Contributor:          John LoSecco [losecco@undpdk.hep.nd.edu]
         # Last Edit Date:       10/20/91
         #
         # chip    ram   virtual    clocks                   default-mode  flags
          ET4000  1024  1152 900    25 28 32 36 40 45 50 65  "800x600"

    Look at the last line.  The chipset is "ET4000", clocks are "25 28 32 40
    45 50 65", the mode is "800x600" and virtual screen size is 1152x900.
    If you don't find an entry in the database corresponding to your
    configuration, use your video board's manual.

    Let us look at these 5 Xconfig lines one at a time.  The "Chipset" line
    specifies the chipset used by your video card.  The supported values are
    "et4000", "et3000", "gvga", "pvga1".  This is probably not an exhaustive
    list, there may be more.  You can get your chipset from the "vga.dbase"
    file, or your video card's user's manual, or by opening up your PC and
    looking at the video card and reading the numbers painted on the chip.
    My "Chipset" line looks like this:

        Chipset "et4000"

    The  "Clocks line specifies the driving frequencies that your video
    card supports.  This information can be obtained from several sources.
    You may look it up in "vga.dbase" file, if an entry for your video
    card exists.  You may also look it up in your video card's manual.
    The third method is to run the X server and catch its startup output
    in a file and then read it from that file.  To do that do the
    following:

        a. Comment out the Clocks line from "Xconfig" file
        b. Start the X server with "startx" command
        c. Read the line starting with "clocks" and note
           down the printed values

    My "Clocks" line looks like this:

        Clocks 25 28 32 36 40 45 50 65

    The "Modes" line specifies the resolution of your screen.  The standard
    values are "640x480", "800x600", "1024x768i", "1024x768", "1280x1024i",
    "1280x1024".  These are the standard values, others are certainy
    possible.  You should choose the highest mode that your video card
    supports.  I will describe shortly how to determine which value to
    use.  For the time being we will stop at saying that this is the
    number of pixels that your monitor will display on screen.

    My "Modes" line looks like this:

        Modes     "1024x768"

    The "Virtual" line specifies the virtual resolution of your screen.  This
    resolution is the same as or larger than your "Modes" resolution.  Think
    of virtual resolution as being the area that your programs think your
    screen is.  The real resolution is a sliding window on your virtual
    screen that lets you view part of the virtual screen at a time.  For
    example, you could make your virtual screen 1152 by 900 and your real
    screen 1024 by 768.  When the X server starts, you will be looking
    at the top left corner of the 1152 by 900 screen.  As you bring the
    mouse to the right edge of the screen, your screen will scroll to
    the right to show the 128 horizontal pixels that could not be shown
    before.

    My "Virtual" line looks like this:

        Virtual 1024 768

    And now to bring the whole thing together, we will discuss the "ModeDB"
    lines.  You should find the "ModeDB" line at the end of the "Xconfig"
    file.  You should not need to change these.  If you do, use the values
    found in "Xconfig.sample" first since these are the standard.

    Your video card is usually capable of driving your monitor at several
    frequencies.  These are the "Clocks" that we saw before.  These numbers
    are the clock frequencies in Mega Hertz.  The higher resolution you
    choose, the higher driving frequencies are needed.  Its only natural,
    since you need to paint more pixels, you need to do it faster, otherwise
    the previous pixels will fade before you can paint them again.  And this
    fading is the cause of flicker in monitors.  You wish to use the
    highest resolution that your video card can drive and that your video
    card has the memory to support.

    Let us look at a "ModeDB" line:

        # name        clock   horizontal timing     vertical timing      flags
         "1024x768"    65     1024 1032 1176 1344    768  771  777  806

    The first entry is the name of the "Mode", in this case "1024x768".  The
    second entry is the frequency needed to drive this mode, in this case
    65MHz.  From my "Clock" line above, I know that my card has a 65MHz
    clock.  The next eight numbers are the horizontal and vertical timings
    at that resolution and clock.

    There is one more thing that I need to ensure before I can be certain
    that my hardware will support this resolution: Video memory.  In order
    to display 1024 by 768 pixels at each pixel taking a byte of memory, I
    will need 1024 x 768 = 768 KB.  Since my video card has 1 MB of memory,
    I am OK.  If I had only 512 KB of video memory, I could only use the
    800 x 600 mode as my highest resolution since it only requires 468.75 KB
    of memory.  Since the virtual screen is stored in video memory, this
    restriction applies to the "Virtual" screen resolution also.

    My "ModeDB" lines look like this:

ModeDB
# OFFICIAL VESA Monitor timings + IBM Standards - TRY THESE FIRST
# Contributor:          Thomas Roell [roell@sgcs.com]
# Last Edit Date:       3/29/92
#
# name        clock   horizontal timing     vertical timing      flags
 "640x480"     25      640  664  760  800    480  491  493  525
               31      640  664  704  832    480  489  492  520
 "800x600"     36      800  824  896 1024    600  601  603  625
               40      800  840  968 1056    600  601  605  628
               50      800  856  976 1040    600  637  643  666
 "1024x768i"   44     1024 1040 1216 1264    768  777  785  817  Interlace
 "1024x768"    65     1024 1032 1176 1344    768  771  777  806
               75     1024 1048 1184 1328    768  771  777  806
               85     1024 1032 1152 1360    768  784  787  823
 "1280x1024i"  80     1280 1296 1512 1568   1024 1025 1037 1165  Interlace
 "1280x1024"  110     1280 1328 1512 1712   1024 1025 1028 1054
              135     1280 1312 1456 1712   1024 1027 1030 1064

    Once again, let me enphasize that one of the clocks supported by your
    video card must EXACTLY MATCH the clock shown in the above table.  If
    it doesn't, then you can look in some of the other "Xconfig" files for
    an entry that matches your clock and mode--and can be supported by
    your video memory.  If you still don't find an entry, you can make
    your own entry by following the instructions given in
    "/usr/X386/lib/X11/doc/video.tutorial".  If that happens, Good Luck!)

 5. Edit "Xconfig" and modify the "Chipset", "Clocks", "Modes", "Virtual", 
    and "ModeDB" lines as described above.

    My entries look like this:


        Chipset "et4000"
        Clocks 25 28 32 36 40 45 50 65
        Modes     "1024x768"
        Virtual 1024 768
ModeDB
# OFFICIAL VESA Monitor timings + IBM Standards - TRY THESE FIRST
# Contributor:          Thomas Roell [roell@sgcs.com]
# Last Edit Date:       3/29/92
#
# name        clock   horizontal timing     vertical timing      flags
 "640x480"     25      640  664  760  800    480  491  493  525
               31      640  664  704  832    480  489  492  520
 "800x600"     36      800  824  896 1024    600  601  603  625
               40      800  840  968 1056    600  601  605  628
               50      800  856  976 1040    600  637  643  666
 "1024x768i"   44     1024 1040 1216 1264    768  777  785  817  Interlace
 "1024x768"    65     1024 1032 1176 1344    768  771  777  806
               75     1024 1048 1184 1328    768  771  777  806
               85     1024 1032 1152 1360    768  784  787  823
 "1280x1024i"  80     1280 1296 1512 1568   1024 1025 1037 1165  Interlace
 "1280x1024"  110     1280 1328 1512 1712   1024 1025 1028 1054
              135     1280 1312 1456 1712   1024 1027 1030 1064

    (You should now be done with the configuration, so save the file
    and start the X server.)

 6. Save "Xconfig" and exit the editor.

 7. Start X by using the "startx" command.

    [ cd / ]
    [ startx ]

    (If everything works fine, you should be in X.  If they don't here are
    some things to check for:

    a.  If there is a grey pattern on the screen and the pointer is shaped
        like an X, but the mouse movement and keyboard activity does not
        generate a response,

        then, your mouse is probably configured incorrectly.  Reboot your
        system--recall that the system is not responding to mouse and keyboard
        activity and you don't have a choice.  Check the mouse with the
        "mouse" program as described earlier and make sure that the
        corresponding entry is correct in the "Xconfig" file.

    b.  If the server does not start and gives among may other lines a
        blurb along "not enough memory for the virtual resolution",

        then, you don't have enough memory for the virtual resolution that
        you specified.  Remember that virtual screen is kept in video
        memory and therefore its size is restricted by available memory
        the same way as the real resolution.  Make your virtual screen
        size smaller to something you can fit in available memory.

    c.  X comes up, but your pointer breaks up as you go to the right edge
        of the screen,

        then, the "ModeDB" entry is incorrect for your card.  Make sure that
        your chosen "Modes" resolution and one of your available "Clocks"
        MATCHES EXACTLY on of the entries under "ModeDB".  Remember,
        you should try one of the standard ones first and if these don't
        work try others.  Also, you can create your own by following the
        instructions in /usr/X386/lib/X11/video.tutorial.

