5.4 XFree86 Configuration

Contributed by Christopher Shumway.

5.4.1 Before Starting

Before configuration of XFree86 4.X, the 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 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 current working directory called XF86Config.new. 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 preform this task, the user needs to run:

    # XFree86 -xf86config XF86Config.new

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

Next, tune the XF86Config.new configuration file to taste. Open up the file in a text editor such as emacs(1) or ee(1). The first thing to do is 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 where entered.

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

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

The DefaultColorDepth 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. 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.

To run at a resolution of one thousand twenty four pixels by seven hundred sixty eight pixels at twenty four bits per pixel, then add the DefaultColorDepth keyword with the value of twenty four, and add to the "Display" subsection with the desired Depth the Modes keyword with the resolution the user wishes to run at. Note that only VESA standard modes are supported as defined by the target system's graphics hardware.

Finally, write out the configuration file and test it using the test mode given above. If all is well, then 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).

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 to drive the card. To agpgart, the agp.ko kernel loadable module needs to be loaded into the kernel with kldload(8). This can be done automatically with the loader(8) at boot time. Simply add this line to /boot/loader.conf:

    agp_load="YES"

Next, 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

This will allow configuration the hardware as any other graphics board.

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>.