XWindows Help

David C. Snyder dsnyder at dsnyder.mindspring.com
Sun Feb 18 09:46:37 EST 1996


Hello,

What Linux package did you purchase?  If you purchased a Slackware Linux,
you are probably missing a symbolic link to your X server.  You should
have the following:

   file:     /usr/X11R6/bin/XF86_SVGA
   link:     /var/X11R6/bin/X -> /usr/X11R6/bin/XF86_SVGA
   link:     /usr/X11R6/bin/X -> /var/X11R6/bin/X

To create this, use the following commands:

  1. Install the XF86_SVGA server in /usr/X11R6/bin.  You should be
     able to get this from your CD-ROM distribution.  Also make sure the
     ownership and permissions are correct:

       chown root.root /usr/X11R6/bin/XF86_SVGA
       chmod 4755 /usr/X11R6/bin/XF86_SVGA

  2. ln -s /usr/X11R6/bin/XF86_SVGA /var/X11R6/bin/X

  3. ln -s /var/X11R6/bin/X /usr/X11R6/bin/X

I suspect that this will only be the beginning of your solution
though.  It can be tricky to concoct an XF86Config file that will work
with some monitor and graphics card combinations.  Below are some
instructions that I typed up for folks at my work so that they could
get started with this.  Below that is the source code for the vmode
program that the instructions refer to.  Also, there is a sample
XF86Config file that you can use as a starting point.  Good luck...

-- David
   dsnyder at mindspring.com


----------------------------------Cut Here-------------------------------------

   g. set up the XF86Config file to get X-Windows working

      Setting up a well optimized X-Windows display is arguably the
      toughest part of installing Linux.  It's well worth the effort
      though.  With patience and practice, you will most likely be
      able to achieve higher resolutions with less flicker than is
      possible under MS-Windows.

      The process involves the following steps:

         1. Probing the card
         2. Selecting the dot clock
         3. Generating the Mode section
         4. Testing the display
         5. Tuning the display


      1. Probing the card

         Edit the /etc/X11/XF86Config file.  Under the "Monitor"
         section, set the "Bandwidth", "HorizSync", and "VertRefresh"
         to the values specified in your video monitor's manual.
         Also, remove the "Mode" subsections from the "Monitor"
         section.  Then run SuperProbe as follows:
       
            SuperProbe -verbose > probe.log 2>&1

         If the installed SVGA driver was able to detect your
         hardware, run X as follows to get a list of valid dot clocks:

            X -probeonly > x.log 2>&1


      2. Selecting the dot clock

         Look at the list of clocks in the x.log file.  They should be
         on lines that begin with the word "clocks:".  Choose the
         second to the highest dot clock that is less than or or equal
         to your monitor's "Bandwidth".  For example, if your
         monitor's bandwidth is 80MHz and your clocks line looks like
         the following, you would choose 39.99 for your dot clock:

            clocks:  28.32  41.16  36.08  31.50  39.99  45.08  89.35


      3. Generating the Mode section

         Use /usr/local/bin/vmode to generate a Mode subsection that
         is based on the dot clock that you picked.  For example, if
         your monitor's maximum horizontal scan rate is 64KHz, you
         might use:

            /usr/local/bin/vmode 60 64 39.99

         This would produce:

            Mode "824x618"
                DotClock      40.0
                HTimings      824  856 1008 1040
                VTimings      618  620  626  649
            EndMode
            # HSF = 38.5 khz
            # VSF = 59.3 Hz

         Make sure that the horizontal resolution is divisible by 32.
         Increase the refresh rate if necessary to achieve this.  In
         the example above, 824 is not divisible by 32.  You could try
         to force the resolution down to 800x600 by increasing the
         refresh rate, or you could lower the refresh rate just a tad
         to bring the resolution up to 832x624.  You may want to try
         both to see if you can live with the increased flicker that
         results from lowering the refresh rate.  For example:

            /usr/local/bin/vmode 59 64 39.99

            Mode "832x624"
                DotClock      40.0
                HTimings      832  864 1016 1048
                VTimings      624  626  632  655
            EndMode
            # HSF = 38.2 khz
            # VSF = 58.3 Hz

         If you have a video card that uses the S3 chipset, do the
         following:

            cd /var/X11R6/bin
            rm X
            ln -s /usr/X11R6/bin/XF86_S3 X

         This will make the S3 driver your default X-server.  Repeat
         the steps above to generate a mode for your display.  Many S3
         cards have programmable dot clocks, so there may not be any
         clocks listed in the x.log file.  Start with a dot clock of
         80MHz (if your monitor's bandwidth is at least 80MHz) and go
         down if necessary.


      4. Testing the display

         Add the Mode subsection generated by vmode to the "Monitor"
         section in your /etc/X11/XF86Config file just below the
         "VertRefresh" line.  Set the "Mode" and "Virtual" values in
         the "Screen" section to match the resolution you selected.
         Re-run X as described above and look at the x.log file to
         make sure that there are no errors in your XF86Config file.

         Before you can actually start X-Windows, you must kill gpm,
         the console mouse program.  This program allows you to use
         your mouse to cut and paste text between virtual consoles,
         but most systems can not run X-Windows with gpm running.  To
         kill it, type:

            killall gpm

         There may be a couple of lines in your /etc/rc.d/rc.local
         file that start gpm every time your machine boots up.  You
         will want to comment them out by putting a '#' in front of
         them once you have X-Windows working.  One more note about
         mice, if your mouse is not a PS/2 style mouse, you will need
         to change the "Protocol" value in the "Pointer" section of
         your XF86Config file to reflect the type of mouse you have.
         You may also have to point the /dev/mouse symbolic link to a
         different device.  See the man page for "XF86Config" for more
         information.

         To start X-Windows, type 'startx'.  If the image is distorted
         or unreadable, use 'CTRL+ALT+Backspace' to exit from
         X-Windows immediately.  Try using a lower dot clock with the
         vmode program to generate a stable display.


      5. Tuning the display

         Once you have a stable display, the image may be too far to
         the left or right, or there may be faint vertical lines
         through the middle of the screen, etc.  To fine tune the
         display, start an xterm and run the vgaset program.  Use a
         command like the following:

            vgaset -d80 -x30 -X64 -y50 -Y100 -v 1120 840

         See the man page for vgaset to find out what each of these
         switches mean, but you will need to specify all of the
         switches I have listed above to get any meaningful display
         tuning done.
             
         The commands for vgaset are as follows (from the man page):

            l - decrease the left margin
            L - increase the left margin
            r - decrease the right margin
            R - increase the right margin
            h - decrease the horizontal sync pulse width
            H - increase the horizontal sync pulse width
            t - decrease the top margin
            T - increase the top margin
            b - decrease the bottom margin
            B - increase the bottom margin
            v - decrease the vertical sync pulse
            V - increase the vertical sync pulse
            x - decrease x-resolution
            X - increase x-resolution
            y - decrease y-resolution
            Y - increase y-resolution 
            ? - reset initial values
            CR - redisplay the settings.
            q - quit
            EOT - quit

         The vgaset program displays the current mode information
         after every command you enter.  Try adjusting the top and
         left margins to center the image, try setting the horizontal
         and vertical sync pulses to the center of their stable values.
         Once you have a well-tuned display, you'll need to copy
         the mode information to your /etc/X11/XF86Config file.  The
         mode information is in a line that looks like the following:

            80     1120 1152 1192 1456     840 842 850 875

         This mode information goes in the section produced by vmode.
         The '80' is the "DotClock" value , the "1120 1152 1192 1456"
         is the "HTimings" value, and the "840 842 850 875" is the
         "VTimings" value.  For example:

             Mode "1120x840"
                 DotClock      80.0
                 HTimings      1120 1152 1192 1456
                 VTimings      840 842 850 875
             EndMode
             # HSF = 54.1 khz
             # VSF = 61.3 Hz

         Once you have made the changes to your XF86Config file, start
         up X-Windows to verify that the display is working correctly.
         You may have to use the controls on your monitor to expand
         the image to the edges of the screen.

         For more information on setting up X-Windows displays, take a
         look at the following files:

            /usr/doc/faq/howto/XFree86-HOWTO
            /var/X11R6/lib/doc/README.*
            /usr/local/src/vmode.c
            /var/X11R6/lib/doc/VideoModes.doc

----------------------------------Cut Here-------------------------------------

/*
  >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>

  vmode - XF86Config Monitor Video Mode Generator, v.0.1

  Introduction
    If you've hacked on an Xconfig file to get your display working in X386
    or XFree86, then you probably know what this program is for.  It
    generates an Xconfig (or XF86Config) mode definition for your display.
    It's based entirely on "The Hitchhiker's Guide to X386/XFree86 Video
    Timing (or, Tweaking your Monitor for Fun and Profit)" by Eric Raymond,
    et. al.  My copy was in /var/X11R6/lib/doc/VideoModes.doc (slakware
    2.02) or something like that.  I would recommend reading it if you're
    interested in what this program does.

  Getting the Dot Clocks
    Before you use this program, it's best to know what dot clocks are
    available from your video card.  Fortunately, the X server should be
    able to probe your card to get these for you.  You can use one of the
    sample XF86Config files (e.g. XF86Config.eg), but make sure you comment
    out all of the "Clocks" lines.  Run "X -probeonly" 10 to 20 times and
    write down the clock frequencies that occur most frequently for each
    column of clock output.

  Horizontal Scan Frequency and Video Bandwidth
    If you have a manual for your video display, look in the specifications
    section.  Horizontal scan frequency is given as a range for multisync
    displays.  Write down the largest number in the range.  Also note the
    video bandwidth for your display.

  Refresh Rate
    This is how many times per second your screen is refreshed.  If the
    value is too low, your screen will appear to flicker (and probably give
    you a headache).  The VESA ergonomic standard is 72 Hz.  Most people
    can live with 60 Hz.  It's best to stay somewhere between these two
    values.

  Compiling vmode
    To compile vmode, use a command line like:  cc -o vmode vmode.c -lm

  Running vomde
    Now that you have an executable and you understand the command line
    arguments, here's the command synopsis:

      vmode <refresh rate> <max horizontal scan freq. (khz)> [dot clock (Mhz)]

    If You Know max horizontal scan freq:
      Leave off the dot clock argument for your first run of vmode.  The
      program will calculate a dot clock to you get started.  Pick the dot
      clock from the list you made above that is closest to the value vmode
      generated (must NOT be higher than your display's bandwidth).  Run
      the program again with the dot clock you picked.

    If You Don't:
      Pick a high value for max horizontal scan freq. (like 200).  Run
      vmode with dot clocks from the list you made above.  It's best to
      try numbers from the middle of the range first.

  The Output
    Put the output in your XF86Config file under the "Monitor" Section.
    For example:

      Section "Monitor"
          Identifier     "Generic Monitor"
          VendorName     "Unknown"
          ModelName      "Unknown"
          Bandwidth      30
          HorizSync      30-37
          VertRefresh    50-90
          Mode "712x534"    # Generated by vmode 60 37 30
              DotClock      30.0
              HTimings      712  744  864  896
              VTimings      534  536  541  561
          EndMode
          # HSF = 33.5 khz
          # VSF = 59.7 Hz
      EndSection

    My favorite way to do this is to edit XF86Config with vi(1), move the
    cursor down to the VertRefresh line (for example), and type:

       :r !vmode ...

  Tweaking
    Given favorable circumstances, vmode can usually generate a mode that
    will be stable if not optimal.  You may have to try a few runs to get
    something that works, however.  From there, try a program called
    vgaset to fine tune your screen.

    The more data you have on your display, the closer vmode can come to an
    optimal setting.  If, for example, your know your display's horizontal
    and vertical sync pulse durations and its horizontal and vertical guard
    times, you can compile them into vmode with a compile line like:

      cc -DHSP=0.0000031 -DHGT=29.0 -DVSP=0.000091 -DVGT=0.0 -o vmode ...

  Author:  dsnyder at mindspring.com (David C. Snyder) 11/10/94
  <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
*/

#include <stdio.h>
#include <math.h>

#ifndef HSP
#define HSP    0.0000037   /* Horizontal Sync Pulse Duration in seconds */
#endif

#ifndef HGT
#define HGT   32.0         /* Horizontal Guard Time in clock ticks */
#endif

#ifndef VSP
#define VSP    0.00015     /* Vertical Sync Pulse Duration in seconds */
#endif

#ifndef VGT
#define VGT    2.0         /* Vertical Guard Time in clock ticks */
#endif

main(int argc, char *argv[])
{
  double hsfm,   /*  max horizontal sync frequency              */
         hsf,    /*  horizontal sync frequency                  */
         rr,     /*  refresh rate                               */
         dcf,    /*  driving clock frequency (or dot clock)     */
         hfl,    /*  horizontal frame length                    */
         hr,     /*  horizontal screen resolution               */
         hdif,   /*  a temporary variable                       */
         vr,     /*  vertical screen resolution                 */
         vfl,    /*  vertical frame length                      */
         mem,    /*  minimum video memory required for hr & vr  */
         hspt,   /*  horizontal sync pulse time (duration)      */
         hsp,    /*  horizontal sync pulse width                */
         hgt,    /*  horizontal guard time                      */
         vspt,   /*  vertical sync pulse time (duration)        */
         vsp,    /*  vertical sync pulse width                  */
         vgt,    /*  vertical guard time                        */
         sh1,    /*  start tick of horizontal sync pulse        */
         sh2,    /*  end tick of horizontal sync pulse          */
         sv1,    /*  start tick of vertical sync pulse          */
         sv2;    /*  end tick of vertical sync pulse            */

  if (argc < 3)
  {
    fprintf(stderr, "Usage: vmode <refresh rate> "
                    "<max horizontal scan freq. (khz)> "
                    "[dot clock (Mhz)]\n");
    exit(1);
  }

  sscanf(argv[1], "%lf", &rr);
  sscanf(argv[2], "%lf", &hsfm);
  hsfm *= 1000.0;

  if (argc > 3)
  {
    sscanf(argv[3], "%lf", &dcf);
    dcf *= 1000000.0;
    hsf = sqrt(dcf*rr*1.05*0.75/1.25);
    hsf = (hsf < hsfm) ? hsf : hsfm;
  }
  else
  {
    hsf = hsfm;
    dcf = 1.25*hsf*hsf/rr/1.05/0.75;
  }
  dcf = floor(dcf/100000.0+0.5)*100000.0;

  hspt = HSP;
  vspt = VSP;
  hgt  = HGT;
  vgt  = VGT;
  hfl  = ceil(dcf/hsf/8.0) * 8.0;
  hsp  = floor(dcf*hspt/8.0+0.5) * 8.0;
  hr   = floor(dcf/hsf*0.8/8.0+0.5) * 8.0;
  hdif = (hsp+2.0*hgt)-(hfl-hr);
  if (hdif > 0.0) /* not enough space between hfl and hr for hsp and 2 hgt's */
  {
    hfl = floor((hfl+hdif/2.0)/8.0+0.5) * 8.0;
    hsf = dcf/hfl;
    hr  = floor((hr-hdif/2.0)/8.0+0.5) *8.0;
  }
  vr   = 0.75*hr;
  vfl  = floor(1.05*vr+0.5);
  mem  = ceil(hr*vr/1024.0);
  vsp  = floor(vspt*dcf/hfl+0.5);
  sh1  = floor(hr+hgt+0.5);
  sh2  = floor(hfl-hgt+0.5);
  sv1  = floor(vr+vgt+0.5);
  sv2  = floor(vr+vgt+vsp+0.5);

  printf("    Mode \"%.0lfx%.0lf\"\n", hr, vr);
  printf("        DotClock      %.1lf\n", dcf/1000000.0);
  printf("        HTimings      %.0lf %4.0lf %4.0lf %4.0lf\n",hr,sh1,sh2,hfl);
  printf("        VTimings      %.0lf %4.0lf %4.0lf %4.0lf\n",vr,sv1,sv2,vfl);
  printf("    EndMode\n");
  printf("    # HSF = %.1lf khz\n", dcf/hfl/1000.0);
  printf("    # VSF = %.1lf Hz\n", dcf/hfl/vfl);

  return (0);
}

----------------------------------Cut Here-------------------------------------

Section "Files"
    RgbPath	"/usr/X11R6/lib/X11/rgb"
    FontPath	"/usr/X11R6/lib/X11/fonts/misc/"
    FontPath	"/usr/X11R6/lib/X11/fonts/Type1/"
    FontPath	"/usr/X11R6/lib/X11/fonts/Speedo/"
    FontPath	"/usr/X11R6/lib/X11/fonts/75dpi/"
#   FontPath	"/usr/X11R6/lib/X11/fonts/100dpi/"
EndSection

Section "ServerFlags"
EndSection

Section "Keyboard"
    Protocol	"Standard"
#    Protocol	"Xqueue"
    AutoRepeat	500 5
    ServerNumLock
EndSection

Section "Pointer"
    Protocol	"PS/2"
    Device	"/dev/mouse"
#    BaudRate	9600
#    SampleRate	150
    Emulate3Buttons
EndSection

Section "Monitor"
    Identifier	"CrystalScan"
    VendorName	"Gateway2000"
    ModelName	"CrystalScan 1572FS"
    Bandwidth	80
    HorizSync   30-64
    VertRefresh 50-100
    Mode "832x624"
        DotClock      40.0
        HTimings      832  864  912 1080
        VTimings      624  626  632  645
    EndMode
    # HSF = 37.0 khz
    # VSF = 57.4 Hz
    Mode "800x600"
        DotClock      40.0
        HTimings      800  832  928 1064
        VTimings      600  602  608  619
    EndMode
    # HSF = 37.6 khz
    # VSF = 60.7 Hz
EndSection

Section "Device"
    Identifier	"Cirrus"
    VendorName	"Gateway2000"
    BoardName	"CL-GD5428"
#   Chipset	"Trio64"
#   VideoRam	2048
#   Clocks	25.2 28.3
EndSection

Section "Screen"
    Driver	"svga"
    Device	"Cirrus"
    Monitor	"CrystalScan"
    Subsection  "Display"
        Depth	    8
        Modes	    "832x624" "800x600"
        ViewPort    0 0
        Virtual     832 624
    EndSubsection
EndSection






More information about the Ale mailing list