2. XFree86

Virtually every Linux distribution comes with XFree86's X Window System implementation. This project, of course, provides us the X server, but also includes an extensive suite of utilities and applications to help implement a fully functional GUI environment.

In fact, the list would be just too long to list everything that comes with XFree86. In addition to the X server itself, here are a few of the noteworthy utilities:

xdm - the X Display Manager.

xfs - the X Font Server.

twm - a lightweight Window Manager.

xterm - the best known terminal emulator. Also, xterm3d and nxterm.

xwd - a screen and window image capturer.

xf86config - X server configuration utility.

xdpyinfo - X display information utility. This shows great detail about the X server.

xlsclients - lists currently connected X server clients.

xlsfonts - lists fonts available to X.

appres - lists the X "resources" that a program will use.

xfontsel - an application for viewing or selecting fonts.

xprop - a tool for displaying window "properties", such as the Class name of the client.

xset - sets user preferences for many things, including mouse, keyboard, sound (bell), etc.

xsetroot - a program for changing the "root window" appearance, e.g. setting a background color.

xvidtune - an application to adjust X server video modes and monitor related settings.

xwininfo - displays information about a selected "window".

xmodmap - a utility for manipulating keyboard and mouse button mappings.

Many, many fonts. And quite a bit of documentation as well.

There are many more. We'll just touch on a few of these utilities here. But feel free to explore the others. Most should have their own man pages.

2.1. Hardware

The X server controls both input (keyboard, mouse, etc) and output (display, monitor) devices.

Compatible hardware is a tough topic, since it is very much a moving target. We are forced here to avoid specifics, since this would surely change by the time you read this. And would be tediously lengthy anyway.

So let's settle for some generalities. Most PC type hardware is supported to one degree or another. Big help ;-)

Rule of thumb: if it is a device that uses a long-standing, commonplace protocol (e.g. PS/2), it should be well supported. Conversely, if it is something relatively new, with ground-breaking technology, the odds are not as good. This is just the nature of the beast with open source development versus manufacturers that cater more to the most popular platforms. Some manufacturers are more co-operative than others too.

Now, some general guidelines:

You can check the "hardware compatibility list" at your distribution's web site too. This should give a very good idea of what should work with your release.

Newer versions of XFree86 obviously will have better hardware support. If you are using an older Linux version and don't have full hardware support, see about upgrading XFree86. Check first to see if your distribution has updates for your release.

2.2. XF86Config

The primary configuration file for XFree86 is XF86Config, which may exist on your system as XF86Config-4 for XFree86 v4.x, or possibly other variations (see man page). It is typically located as /etc/X11/XF86Config, though again, there may be variations in the path. If both a XF86Config-4 and XF86Config exist, XFree86 v4.x will use the former. This is a required file.

XF86Config file defines hardware devices, and other critical components of the X server environment.

While this is a plain text file, and is editable, it is most often created during installation by whatever utility your vendor uses for this purpose. XFree86 also includes the xf86config utility for this, but many distributions have their own such utilities. These utilities can be run after installation if need be, to alter the configuration, or if new hardware is installed. Read your locally installed documentation first. If you attempt to hand edit this file, be sure to make a backup copy first since X will not start if this file is not to its liking ;-)

This file contains various "sections". Each section defines some fundamental aspect of XFree86, such as "InputDevice" (mouse, keyboard, joystick, etc), "monitor", or "screen". The XF86Config man page describes the sections and common values for each. Note that the values listed in the man page is not a comprehensive listing. There are many device specific "options". Check http://xfree86.org for notes and tips on your hardware.

The author's current XF86Config-4, as generated by Red Hat's installer for XFree86 4.1:


Section "ServerLayout"
	Identifier "XFree86 Configured"
	Screen      0  "Screen0" 0 0
	InputDevice    "Mouse0" "CorePointer"
	InputDevice    "Keyboard0" "CoreKeyboard"
EndSection

Section "Files"
   # The location of the RGB database.
   RgbPath     "/usr/X11R6/lib/X11/rgb"

   # Multiple FontPath entries are allowed (they are concatenated together)
   # By default, Red Hat 6.0 and later now use a font server independent of
   # the X server to render fonts.
   FontPath "unix/:7100"
EndSection

# Module loading section

Section "Module"
	Load  "dbe"		# Double-buffering
	Load  "GLcore"		# OpenGL support
	Load  "dri"		# Direct rendering infrastructure
	Load  "glx"		# OpenGL X protocol interface
	Load  "extmod"		# Misc. required extensions
	Load  "v4l"		# Video4Linux
#    Load  "fbdevhw"
     Load  "pex5"
     Load  "record"
     Load  "xie"
EndSection


Section "InputDevice"
	Identifier  "Keyboard0"
	Driver      "keyboard"
	Option      "XkbLayout"	"us"

#    Option  "AutoRepeat"    "500 5"

# when using XQUEUE, comment out the above line, and uncomment the
# following line
#    Option  "Protocol"      "Xqueue"

# Specify which keyboard LEDs can be user-controlled (eg, with xset(1))
#    Option  "Xleds"         "1 2 3"

# To disable the XKEYBOARD extension, uncomment XkbDisable.
#    Option  "XkbDisable"

# To customize the XKB settings to suit your keyboard, modify the
# lines below (which are the defaults).  For example, for a non-U.S.
# keyboard, you will probably want to use:
#   Option  "XkbModel"      "pc102"
# If you have a US Microsoft Natural keyboard, you can use:
#   Option  "XkbModel"      "microsoft"
EndSection

Section "InputDevice"
	Identifier  "Mouse0"
	Driver      "mouse"
	Option      "Device" "/dev/mouse"
	Option      "Protocol" "IMPS/2"
	Option      "Emulate3Buttons" "off"
	Option      "ZAxisMapping" "4 5"
EndSection

Section "Monitor"
	Identifier "Sylvania F74"
	VendorName "Unknown"
	ModelName  "Unknown"
	HorizSync   30 - 70
	VertRefresh 55 - 120
	Option "dpms"
#    Modelines go here if necessary. Use xvidtune to get proper values.
EndSection

Section "Device"
	Identifier "ATI Rage 128"
	Driver "r128"
	BoardName "Unknown"
EndSection

Section "Device"
	Identifier "Linux Frame Buffer"
	Driver "fbdev"
	BoardName "Unknown"
EndSection

Section "Screen"
	Identifier "Screen0"
	Device "ATI Rage 128"
	Monitor "Sylvania F74"
	DefaultDepth 24
	Subsection "Display"
		Depth 24
		Modes "1400x1050" "1280x1024" "1152x864" "1024x768" "800x600"
	EndSubSection
	Subsection "Display"
		Depth 16
		Modes "1600x1200" "1400x1050" "1280x1024" "1152x864" "1024x768" "800x600"
	EndSubSection
	Subsection "Display"
		Depth 8
		Modes "1024x768" "800x600" "640x480"
	EndSubSection
EndSection

Section "DRI"
	Mode 0666
EndSection

 

Yours may look quite different. This is just one possible configuration with gratuitous comments from Red Hat (and me), and is for a fairly ordinary set up. There is nothing exotic here like multiple screens or displays.

It is beyond the scope of this document to explain this in detail. See the XF86Config man page. Also, consider visiting xfree86.org and look for specific options that might apply to your card or other hardware.

Just one quick note on the "Screen" section above. Notice there are three sub-sections, identified as "Display". Each sub-section has a different "Depth" specified, (a.k.a. ColorDepth). The "Modes" also vary somewhat according to the respective "Depth" setting. The active "Display" sub-section that will be used, is determined by the "DefaultDepth" setting (unless over-ridden by command line options). The default in this example is defined as "24", so the first sub-section will be used. Also, the highest "Mode" listed in this sub-section will be the default mode (resolution), which here is the first one listed. The first listed mode also determines the viewable screen area, which can be smaller than the mode (resolution) itself. In which case, you would have a virtual desktop that is larger than the viewable screen. To have the viewable screen, and resolution match, have the largest value as the first value listed for each "Mode".

Another note on the "Modes" here: what you see is the result of my choices during Red Hat's Xconfigurator's configuration. These are standard resolutions, but do not have to be! This is only limited by what your hardware can support. And you don't have to use standard width x height ratios either. Something like 1355x1112 is a valid setting (if your hardware supports it and it floats your boat!).

The X server will reject any "Modes" it thinks are invalid. You can cycle through valid modes to change screen resolution with Ctrl-Alt-+ and Ctrl-Alt-- (that's the keypad plus and minus keys).

In versions prior to v4.x, you would also see many "Modeline" statements that attempted to define the monitor's capabilities. These statements would look something like:


 # 1024x768 @ 100Hz, 80.21 kHz hsync
 Modeline "1024x768"  115.5  1024 1056 1248 1440  768  771  781  802 -HSync -VSync

 

Explicit "Modeline" definitions are not required as of 4.x ;-) This sometimes required hand editing to get optimal values in earlier versions of XFree86, though is generally not necessary with v4.x. The XFree86 Video Timings HOWTO has a nice, but rather technical, explanation of this.

If whatever configuration utility you are using, does not automatically recognize your video card or monitor specifications correctly, you are unlikely to get an optimal configuration. In such cases, you may have to manually supply the correct values. This should be available from your owner's manual (you kept that, right?). Or, check the manufacturer's web site.

Again, hand editing of this file is generally unnecessary. Should you decide this is indeed necessary, be careful. One small error may cause X to fail. Any changes to this file will require restarting X for the changes to take effect.

Using somebody else's XF86Config file, is generally a bad idea since they are unlikely to have identical hardware.

2.3. xvidtune and Monitor Tuning

You probably want to get the most out of your hardware. If X isn't configured optimally, consider re-running your vendor's X configuration utility and try to get better results. It is highly unlikely that you could hurt anything by experimenting. Most modern monitors now have safeguards that prevent a meltdown ;-)

If you over-do it though X may not be able to start. For this reason, I prefer to use the "startx" way of starting X (see below) while "experimenting". This way if X crashes, the display manager (GUI login) will not loop and cause you severe headaches. startx just gracefully goes back to a text console screen, where an error message may be visible.

Another way of tweaking monitor related settings is with XFree86's xvidtune program. This is run interactively and can be used to adjust various settings (see man page). The simple dialog box has sliders and buttons that allow user input and adjustment. The top part has horizontal monitor settings on the left, and vertical settings on the right. The buttons just below the sliders can be used to adjust each.

This is sometimes used to adjust the viewable screen area, such as to center it, or increase its size to fill the monitor's viewport. When xvidtune is launched, it defaults to the current settings.

The bottom left corner has buttons that can "Apply" new settings, "Test" new settings, or "Show" current settings (i.e. dump to screen), among other things. Any changes made here are not saved. If new settings are "Applied", it is just for the current session. Example output of xvidtune "Show":


 Vendor: Unknown, Model: Unknown
 Num hsync: 1, Num vsync: 1
 hsync range 0:  30.00 -  70.00
 vsync range 0:  55.00 - 120.00
 "1400x1050"   122.00   1400 1488 1640 1880   1050 1052 1064 1082 +hsync +vsync

 

The last line is the "Modeline" being used to drive the current screen. See The XFree86 Video Timings HOWTO , for more on "Modelines".

You can test modifications, and apply them to the current session. For changes to be made permanent, they will have to be added manually to the "Monitor" section of XF86Config (or XF86Config-4 for v.4.x) with a text editor.

xvidtune will dutifully warn of you of the hazards of playing with the monitor settings. It is unlikely you can hurt anything with modern monitors. But it is best used to make minor adjustments. Use at your own risk!