Next Previous Contents

4. Configuring XFree86

4.1 Normal Configuration

Configuring XFree86 to use your mouse, keyboard, monitor, and video card correctly used to be something of a black art, requiring extensive hand-hacking of a complex configuration file. No more; the 3.2/3.3 release made the process nearly trivial. All you do is fire up the program XF86Setup.

This program depends on the fact that all new PC hardware these days ships with EGA/VGA capable monitors. It invokes the VGA16 server and uses it to bring up X in a lowest-common-denominator 640x480 mode. Then it runs an interactive program that walks you through a series of five configuration panels -- mouse, keyboard, (video) card, monitor, and `other' (miscellaneous server options). The whole process is quite painless.

(If you're running Red Hat Linux, you may see a different program called xf86config. This works fairly similarly to XF86Setup but does not itself use an X interface and the VGA16 server.)

One minor point to keep in mind is that, if you're like most people using a current PC, your keyboard is actually what XF86Setup calls `Generic 102-key PC (intl)' rather than the default `Generic 101-key PC'. If you pick the default (101) the key cluster on the extreme right of your keyboard (numeric keypad and friends) may stop working.

If you're not sure of your monitor type, you can try the listed ones in succession. Work your way from top down (upper choices involve lower dot-clock speeds and are less demanding on the hardware). Back off if you get hash or a seriously distorted picture. Minor distortions (picture slightly too large, slightly too small, or slightly off-center) are no problem; you'll get a chance to correct those immediately by fine-tuning the mode.

And, when the program brings up xvidtune to allow you to tweak your video mode, don't let the initial warning box make you nervous. Modern multisync monitors (unlike their fixed-frequency predecessors) are not easy to damage this way.

XF86Config may assume that your mouse device is /dev/mouse. If you find this doesn't work, you may need to link /dev/mouse to whatever /dev/ca[01] the mouse is on. If you find that XFree86 gives you a "mouse busy" error when gpm is running, you may need to link to /dev/ttyS[01] instead.

The configuration process operates by selecting a server corresponding to to the general type of your video card (such as XF86_VGA16, XF86_Mach64, or XF86_S3) and configuring an XF86Config that the server will read on startup to get specific parameters for your installation. The location of XF86Config varies depending on your OS, but one place to look for it is /etc/X11.

On older versions of XFree86, XF86Setup links the `X' command directly to the chosen server. In recent versions, `X' is instead linked to a set-user-id wrapper program called Xwrapper. The idea is that all the setuid root stuff gets localized in Xwrapper so the server doesn't have to run setuid root.

4.2 Troubleshooting

Occasionally, something will not be quite right when you initially fire up the X server. This is almost always caused by a problem in your configuration file. Usually, the monitor timing values are off, or the video card dot clocks set incorrectly. Minor problems can be fixed with xvidtune; a really garbled screen usually means you need to go back into XF86Setup and choose a less capable monitor type.

If your display seems to roll, or the edges are fuzzy, this is a clear indication that the monitor timing values or dot clocks are wrong. Also be sure that you are correctly specifying your video card chipset, as well as other options for the Device section of XF86Config. Be absolutely certain that you are using the right X server and that /usr/X11R6/bin/X is a symbolic link to this server.

If all else fails, try to start X ``bare''; that is, use a command such as:

X > /tmp/x.out 2>&1 
You can then kill the X server (using the ctrl-alt-backspace key combination) and examine the contents of /tmp/x.out. The X server will report any warnings or errors---for example, if your video card doesn't have a dot clock corresponding to a mode supported by your monitor.

Remember that you can use ctrl-alt-numeric + and ctrl-alt-numeric - to switch between the video modes listed on the Modes line of the Screen section of XF86Config. If the highest resolution mode doesn't look right, try switching to lower resolutions. This will let you know, at least, that those parts of your X configuration are working correctly.

Also, check the vertical and horizontal size/hold knobs on your monitor. In many cases it is necessary to adjust these when starting up X. For example, if the display seems to be shifted slightly to one side, you can usually correct this using the monitor controls.

The USENET newsgroup comp.windows.x.i386unix is devoted to discussions about XFree86, as is comp.os.linux.x. It might be a good idea to watch that newsgroup for postings relating to your video configuration---you might run across someone with the same problems as your own.

4.3 Custom Configuration

You will need to hand-hack your X configuration to get optimal performance if your monitor can support 1600x1200 -- the highest canned resolution XF86Setup supports is 1280x1024.

If you want to hand-hack your video configuration for this or any other reason, go see the LDP's XFree86 Video Timings HOWTO, http://metalab.unc.edu/LDP/HOWTO/XFree86-Video-Timings-HOWTO.html. (This is the up-to-date HTML version of XFree86's `Videomodes.doc' file.)

4.4 Using 16-bit Color

By default, X uses 8-bit color depth giving 256 colors. To circumvent this restriction, many applications allocate their own colormaps, resulting in sudden color jumps when the cursor moves between two windows each having a color map of its own. The Arena WWW browser does it this way.

If you want to use advanced graphic applications 256 colors may be not sufficient. You may need to go to 16-bit color depth (65,536 colors). But beware, not all applications will work with 16bit colors.

You can use 16bit color depth with 65K different colors simply by starting X with


    startx -- -bpp 16

or putting


    exec X :0 -bpp 16

into your .xserverrc file. In order for this to work, however, you need to have a


screen

section in your XF86Config with


    DefaultColorDepth 16

If you're using xdm, you may need to change the Xservers file, which is probably located in /etc/X11/xdm/. A typical configuration has just one uncommented line, looking something like


      :0 local /usr/X11R6/bin/X

Add


-bpp 16

to the startup options:


      :0 local /usr/X11R6/bin/X -bpp 16

Also, you'll need to add to the `screen' section of your X configuration a Display part with a Depth value of 16. Generally you can just duplicate the 8-bit Display section and change the Depth field.

More colors makes your video card transfer more data during the same time. If your video card cannot cope, then either the resolution has or the refresh rate has to be reduced. By default, XFree reduces the resolution. If you want to keep the resolution and reduce the refresh rate, you must insert a new appropriate Modeline into your XF86Config file which defines that resolution with a lower refresh rate. For instance replace the old value

Modeline "1024x768"  75  1024 1048 1184 1328 768 771 777 806 -hsync -vsync
with
Modeline "1024x768"  65  1024 1032 1176 1344 768 771 777 806 -hsync -vsync.
The magic numbers 75 and 65 are the respective clock rates which you find reported by X in your .X.err file. Consult the monitors file in the XF86 documentation for Modelines suitable to the maximum clock rate your video card can deliver under 16bit color depth.


Next Previous Contents