Linux

Linux 101: Video configuration, take 2

While Jack Wallen tried to stuff all the video configuration information he could into one Linux 101, he found another class in order. Pull up a seat; school's in session.

Video configuration can be a complicated task. Whether you're using Windows or Linux, settings must be configured perfectly for the best video resolution.

Installing a video card is only half the battle. Even if you’ve got the card working, you’ll want to ensure you’ve maximized its capabilities.

Did you miss it?
If you missed the earlier Linux 101 addressing video display configuration, you can read it here .

Post-install configuration
We've taken a look at the information-gathering stage, and you already have a working Linux installation. However, the display just doesn't seem right. After running startx, everything seems to be okay, but after using your X Windows System awhile, you notice that either your eyes have had a serious injection of caffeine or your monitor is doing a two—step to Rammstein.

Well, more than likely, it's just a poorly configured display adapter. Hopefully, one of the many Linux configuration tools can help you out. These "front-end" tools are simply applications that write the XF86Config configuration file that is found in most popular distributions in the /usr/X11R6/lib/X11 directory. This file contains all of the configuration routines for your X Windows Session, and if you know what you're doing, it can be changed manually.

Common configuration tools
Red Hat Linux has a very nice X configuration tool called, easy enough, Xconfigurator. The Xconfigurator tool can be run at anytime (by root) and will step through all of the questions necessary to get your video display up and running. There is, of course, a more standard tool for the configuration of the X Windows—XF86Setup—or even more standard is the text-based xf86config tool.

The XF86Setup routine was written by Joe Moss and is normally used either to perform the initial setup of the XFree86 X servers or to make adjustments to the existing configuration. To see the latest news about any of the XFree86 tools, visit the XFree86 Web site . The xf86config tool is a much more standardized application and is run without any graphical elements. This makes it more flexible yet more intimidating to new users. Of course, there is always the tried-and-true hacker's method of editing the file manually with a favorite text editor.

Xconfigurator: Video card
With the newer releases of Red Hat (6.0 and up), the Xconfigurator tool will do a good job of detecting your video card. Many cards are now supported with Red Hat Linux (even 3Dfx), but if you happen to own a card that is not detected, you will more than likely have to choose "unlisted card" and know some of the specifics of your card. Generally speaking, the Xconfigurator tool will, along with the card, determine what X Server to use in conjunction with that card. However, this is not always the best choice, and sometimes you will want to change that Server. (We'll talk about changing your X Server later.) Xconfigurator lets you choose a preconfigured monitor or a custom monitor. Although you might see your monitor listed in the database, it has been my experience that even choosing the exact model of monitor is not always best. Many times, there will be tiny differences between the configurations and actual monitors that will cause problems—problems you'd rather not have to deal with (such as frying your monitor because refresh rates didn't match). Because of this, I recommend that you go with the custom monitor setting and specify the sync frequencies on your own.

With the XF86Config file, you will see a section called Graphics device section, which contains two subsections. The first subsection is a generic section, Anynumber of graphics device, and the second subsection is the configuration determined by the Xconfigurator tool and looks like this:
# Device configured by Xconfigurator:
 Section "Device"
 Identifier "Matrox|MGA G200 AGP [Millennium] AGP"
 VendorName "Unknown"
 BoardName "Unknown"
 VideoRam 4096
 # Insert Clocks lines here if appropriate
EndSection

Do not alter this section unless you know EXACTLY what you are doing. Without the exact name of the Identifier, you will most certainly lose your X display. The only line you might have to or want to change in this section is the VideoRam. I've noticed that many times Xconfigurator will not detect the proper amount of video RAM, or it will comment out the VideoRam line in the above section. Should you notice the VideoRam section (in the # Device configured by Xconfigurator: section), and you know it's correct, uncomment that line (remove the #) and restart your X Session.

Xconfigurator: Monitor
Running Xconfigurator will offer you many different monitor choices (267 to be exact), but as I said earlier, it is best to choose custom monitor. Should you not feel comfortable choosing custom, you could easily go with generic or generic multisync, but this will often not result in the best configuration for your particular monitor.

When choosing the custom monitor setup, it is important to get the highest horizontal sync range you can. Any sync range below 60 Hz will almost guarantee you flicker. It is best to try to get over 65 Hz regardless of resolution. The best way to go about this (with Xconfigurator) is to simply choose the setup you think is best, follow through, and have the Screen Configuration probe for the default resolution. (This is safe with PCI cards; with ISA it's a gamble.) Once the screen blinks a few times, it will come back with the results. Often, these results are a bit off.

I've noticed that with new cards and monitors, the Probe will assign a higher resolution than you want. For instance, on my test machine, which has a 3Dfx Voodoo 3 2000 with a generic CTX 17" monitor, Xconfigurator comes back with a 32-bit Color Depth and 1600x1200 resolution. The 32-bit Color Depth is the best choice. However, when clicking Let Me Choose, the 32-bit Color Depth is no longer an option (at any resolution); resolutions from 640x480 to 1280x1024 (but not the original 1600x1200) are.

Tough choice: Do you take the default (in order to get the higher Color Depth) and accept the larger resolution (thereby making everything on your desktop smaller), or do you lose the 32-bit Color Depth to gain the size? This is really a matter of personal taste, but there is an alternative. Even after running the configuration routine, you can specify individual Color Depths at login. Let's say that you've run the configuration routine and ended up choosing 24-bit color at a resolution of 1024x768, but you want to run at 32-bit Color Depth. To do this, at the console BASH prompt (not in X) type:
startx -bpp 32

With the bpp argument attached to the startx command, you are explicitly calling X with 32-bit Color Depth. Now, when X starts, you will notice that it is running at a larger resolution. What is nice about this is you can put into your .bashrc file various aliases to start X Windows at various color depths. To do this, open up ~/.bashrc and enter the following:
alias 8="startx -- -bpp 8"
alias 16="startx -- -bpp 16"
alias 24="startx -- -bpp 24"
alias 32="startx -- -bpp 32"

Now that you have your aliases, you will want to allow X to connect to your X Server at those particular Color Depths. To do this, you need to edit your XF86Config file (located in /usr/X11R6/lib/X11/) and change the following section from:
Section "Screen"
 Driver "svga"
 # Use Device "Generic VGA" for Standard VGA 320x200x256
 #Device "Generic VGA"
 Device "Matrox|MGA G200 AGP [Millennium] AGP"
 Monitor "My Monitor"
 Subsection "Display"
 Depth 32
 Modes "1024x768"
 ViewPort 0 0
 EndSubsection
EndSection


to:

Section "Screen"

 Driver "svga"
 # Use Device "Generic VGA" for Standard VGA 320x200x256
 #Device "Generic VGA"
 Device "Matrox|MGA G200 AGP [Millennium] AGP"
 Monitor "My Monitor"
 Subsection "Display"
 Depth 32
 Modes "1024x768"
 ViewPort 0 0
 EndSubsection
 Subsection "Display"
 Depth 24
 Modes "1024x768"
 ViewPort 0 0
 EndSubsection
 Subsection "Display"
 Depth 16
 Modes "1024x768"
 ViewPort 0 0
 EndSubsection
 Subsection "Display"
 Depth 8
 Modes "1024x768"
 ViewPort 0 0
 EndSubsection
EndSection

Notice that the difference is the addition of the various Depth Subsections. This file will have to be edited as root, and each section labeled Section "Screen" (under the Screen section's main heading) will need to have the above added. You will then be able to start your X session in any of the four Color Depths with simple aliases (8, 16, 24, or 32). NOTE: It is possible to use the above only if you are not having your machine immediately boot into the graphical login screen.

XF86Setup
The XF86Setup is the XFree86 project's front end to the XF86Config file. This application is as user-friendly as Red Hat's Xconfigurator, only with many more options. With XF86Setup, you can configure the following:
  • Mouse
  • Keyboard
  • Card (video)
  • Monitor
  • Modeselection (resolution)
  • Optional Server settings

This makes XF86Setup one of the most extensive and useful graphical configuration tools available. (I can already hear the SuSE users crying YaST!) XF86Setup is more uniquely UNIX-looking than the Xconfigurator, but this does not hinder its usefulness. The one setback for XF86Setup occurs if you do not already have your mouse configured and running. Whereas Xconfigurator relies solely on the keyboard, XF86Setup uses either the keyboard or the mouse to navigate. Unfortunately, the keyboard navigation is not nearly as intuitive as Xconfigurator. This lack of intuitiveness might be due to the vast number of choices. Regardless, it is best to have a working mouse running before using XF86Setup.

One drawback of the XF86Setup tool is that it offers only 10 monitor sync ranges, whereas Xconfigurator offers 12. Missing from XF86Setup are any 1600x1200 options. Granted, it's a rare occasion that someone would need to run at 1600x1200, but having the option is certainly nice. One strong aspect of XF86Setup is the ability to see the various X Servers available. Along the top of the main window there are small buttons, each representing an X Server with the following choices:
Mono VGA16 SVGA 8514 AGX I128 Mach8 Mach32 Mach64 P9000 S3 S3V TGA W32 3DLabs

Below the Server selection is a row of drop-down boxes that allow you to choose Chipset, RamDac, or ClockChip. This is a real bonus because it allows you to explicitly declare the type of chip your video card uses. For instance, the video card (Voodoo 3 2000) on my Pogo Altura was set to "probed," which was a generic chipset, yet clicking on the drop-down box revealed the Voodoo3 chipset! Select that chipset with a mere click of the mouse.

An even better option than simply selecting the chipset would be to switch from the preconfigured SVGA X server to the 3DLabs server. Unfortunately, there was a problem when selecting the 3DLabs driver. In fact, when I looked into the installation and configuration of the 3Dfx drivers and cards, I realized that a simple configuration tool would not do the trick. In order to get the 3Dfx card (Voodoo 3 2000) working, I had to make a pit stop at one of the many Linux How to sites.

As much as I'd like to say that getting the 3Dfx card up and running with Linux is a snap, I can't since the support and source are only now becoming available for these cards in the Linux operating system. NOTE: This is not a manual on getting the 3Dfx drivers working with Linux, that will come later. Instead of choosing the 3DLabs drivers, I went with the SVGA driver and all was fine (instead of going through the configuration of the 3Dfx drivers).

The above issue will not be a problem for most people using cards other than the 3Dfx style. Many of the cards are going to work with either the SVGA or one of the Mach drivers. Also, the installation of the OS itself does a very good job of choosing the correct driver for the video card. Many times, the problem deals with sync or modeselection. The first step in reconfiguring a video card would be to change the mode (resolution) and/or the refresh rate.

xf86config
The xf86config tool is the most basic of all the X configuration tools. (NOTE: The xf86config tool is differentiated from the configuration file by means of capitalization.) This particular tool is text only, but don't let the lack of GUI fool you. This tool means business! The xf86config tool is started with the command (as root) xf86config and begins by configuring the mouse. As each configuration option is presented, the tool gives you various choices.

Once you've configured the mouse and keyboard, you’re ready to configure your monitor. The monitor configuration section is similar to its graphical counterparts, but you will still be required to enter full names and types of monitors. If you do not know exact name schemes and types of your video hardware, avoid this tool! There is no autoprobing feature here. With xf86config, you are on your own!

Conclusion
Both of the above tools do a fine job of configuring (reconfiguring) a display device. I have come to believe, however, that there is no better way to configure such a device than to know the configuration or setup file and how to tweak it manually. For those with a bit of time, patience, and nerve, doman XF86Config and read up on the manual configuration of your X Server! With the information supplied in this particular man page, it is possible to hand-write and fine-tune any X configuration you can imagine. Next time around, we'll visit the YaST (Yet Another Setup Tool from SuSE), Corel's latest tool, and Mandrake's Lothar.

Have a comment?
If you'd like to share your opinion, please post a comment below or send the editor an e-mail .

Jack Wallen, Jr., is pleased to have joined the TechRepublic staff as editor in chief of Linux content. Prior to his headfirst dive into the computer industry, he was a professional actor with film, TV, and Broadway credits. Now Jack is content with his new position of Linux evangelist.

About

Jack Wallen is an award-winning writer for TechRepublic and Linux.com. He’s an avid promoter of open source and the voice of The Android Expert. For more news about Jack Wallen, visit his website getjackd.net.

0 comments