5.4 XFree86™ Configuration

Contributed by Christopher Shumway.

5.4.1 Before Starting

Before configuration of XFree86™ 4.X, the following information about the target system is needed:

The specifications for the monitor are used by XFree86 to determine the resolution and refresh rate to run at. These specifications can usually be obtained from the documentation that came with the monitor or from the manufacturer's website. There are two ranges of numbers that are needed, the horizontal scan rate and the vertical synchronization rate.

The video adapter's chipset defines what driver module XFree86 uses to talk to the graphics hardware. With most chipsets, this can be automatically determined, but it is still useful to know in case the automatic detection does not work correctly.

Video memory on the graphic adapter determines the resolution and color depth which the system can run at. This is important to know so the user knows the limitations of the system.

5.4.2 Configuring XFree86 4.X

Configuration of XFree86 4.X is a multi-step process. The first step is to build an initial configuration file with the -configure option to XFree86. As the super user, simply run:

# XFree86 -configure

This will generate a skeleton XFree86 configuration file in the /root directory called XF86Config.new (in fact the directory used is the one covered by the environment variable $HOME, and it will depend from the way you got the superuser rights). The XFree86 program will attempt to probe the graphics hardware on the system and will write a configuration file to load the proper drivers for the detected hardware on the target system.

The next step is to test the existing configuration to verify that XFree86 can work with the graphics hardware on the target system. To perform this task, the user needs to run:

# XFree86 -xf86config XF86Config.new

If a black and grey grid and an X mouse cursor appear, the configuration was successful. To exit the test, just press Ctrl+Alt+Backspace simultaneously.

Note: If the mouse does not work, be sure the device has been configured. See Section 2.9.10 in the FreeBSD install chapter.

Next, tune the XF86Config.new configuration file to taste. Open the file in a text editor such as emacs(1) or ee(1). First, add the frequencies for the target system's monitor. These are usually expressed as a horizontal and vertical synchronization rate. These values are added to the XF86Config.new file under the "Monitor" section:

Section "Monitor"
        Identifier   "Monitor0"
        VendorName   "Monitor Vendor"
        ModelName    "Monitor Model"
        HorizSync    30-107
        VertRefresh  48-120
EndSection

The HorizSync and VertRefresh keywords may not exist in the configuration file. If they do not, they need to be added, with the correct horizontal synchronization rate placed after the Horizsync keyword and the vertical synchronization rate after the VertRefresh keyword. In the example above the target monitor's rates were entered.

X allows DPMS (Energy Star) features to be used with capable monitors. The xset(1) program controls the time-outs and can force standby, suspend, or off modes. If you wish to enable DPMS features for your monitor, you must add the following line to the monitor section:

        Option       "DPMS"

While the XF86Config.new configuration file is still open in an editor, select the default resolution and color depth desired. This is defined in the "Screen" section:

Section "Screen"
        Identifier "Screen0"
        Device     "Card0"
        Monitor    "Monitor0"
        DefaultDepth 24
        SubSection "Display"
                Depth     24
                Modes     "1024x768"
        EndSubSection
EndSection

The DefaultDepth keyword describes the color depth to run at by default. This can be overridden with the -bpp command line switch to XFree86(1). The Modes keyword describes the resolution to run at for the given color depth. Note that only VESA standard modes are supported as defined by the target system's graphics hardware. In the example above, the default color depth is twenty-four bits per pixel. At this color depth, the accepted resolution is one thousand twenty-four pixels by seven hundred and sixty-eight pixels.

Finally, write the configuration file and test it using the test mode given above. If all is well, the configuration file needs to be installed in a common location where XFree86(1) can find it. This is typically /etc/X11/XF86Config or /usr/X11R6/etc/X11/XF86Config.

# cp XF86Config.new /etc/X11/XF86Config

Once the configuration file has been placed in a common location, configuration is complete. In order to start XFree86 4.X with startx(1), install the x11/wrapper port. XFree86 4.X can also be started with xdm(1).

Note: There is also a graphical tool for configuration, xf86cfg(1), that comes with the XFree86 4.X distribution. It allows to interactively define your configuration by choosing the appropiate drivers and settings. This program can be used under console as well, just use the command xf86cfg -textmode. For more details, refer to the xf86cfg(1) manual page.

5.4.3 Advanced Configuration Topics

5.4.3.1 Configuration with Intel® i810 Graphics Chipsets

Configuration with Intel® i810 integrated chipsets requires the agpgart AGP programming interface for XFree86 to drive the card. The agp(4) driver is in the GENERIC kernel since releases 4.8-RELEASE and 5.0-RELEASE. On prior releases, you will have to add the following line:

device agp

in your kernel configuration file and rebuild a new kernel. Instead, you may want to load the agp.ko kernel module automatically with the loader(8) at boot time. For that, simply add this line to /boot/loader.conf:

agp_load="YES"

Next, if you are running FreeBSD 4.X or earlier, a device node needs to be created for the programming interface. To create the AGP device node, run MAKEDEV(8) in the /dev directory:

# cd /dev
# sh MAKEDEV agpgart

Note: FreeBSD 5.X or later will use devfs(5) to allocate device nodes transparently, therefore the MAKEDEV(8) step is not required.

This will allow configuration of the hardware as any other graphics board. Note on systems without the agp(4) driver compiled in the kernel, trying to load the module with kldload(8) will not work. This driver has to be in the kernel at boot time through being compiled in or using /boot/loader.conf.

If you are using XFree86 4.1.0 (or later) and messages about unresolved symbols like fbPictureInit appear, try adding the following line after Driver "i810" in the XFree86 configuration file:

Option "NoDDC"

This, and other documents, can be downloaded from ftp://ftp.FreeBSD.org/pub/FreeBSD/doc/.

For questions about FreeBSD, read the documentation before contacting <questions@FreeBSD.org>.
For questions about this documentation, e-mail <doc@FreeBSD.org>.