Team LiB
Previous Section Next Section

Hack 94. Optimize Your Refresh Rates

Reduce eyestrain by fine-tuning your monitor's refresh rates.

Many of you reading this book spend a lot of time in front of a computer at work, at school, or in your home. As you rack up hours in front of the whirring machine, your eyes take the brunt of the physical effects of your computer use. Most people see flicker on their monitors when the monitor refresh rate is lower than 72MHz. This flicker causes eyestrain, headaches, and general fatigue. This hack explores how you can tune your X configuration to optimize your picture's quality and its refresh rates. But beware, using excessive refresh rates that your monitor does not support can potentially cause physical damage to the monitor in the same way revving an engine too high can destroy your engine. Although this is less common with modern monitors, you should be cautious when experimenting with this hack.

11.4.1. Find Out More About Your Monitor

To get the best use from your monitor, you need to determine its optimum refresh rate. You can do this by gathering some information about your monitor, running that information through a web-based tool that can determine your optimal settings, and then entering those settings in your X configuration file (usually /etc/X11/XF86Config-4 or xorg.conf).

The web-based tool requires a couple of pieces of information: your monitor's resolution and the dot clock frequency (also known as the pixel clock). But to complete this hack, you also need to know the horizontal and vertical sync (refresh) ranges.

You can gather some of the information you need from the label on the back of your monitor, your monitor's built-in menu system, your monitor's manual, and by Googling for your monitor specifications on the Web. I've always found a Google search to be a particularly effective way to get the horizontal and vertical sync ranges. You can also use the xvidtune utility:

foo@bar:~$ xvidtune

In the bottom right of the xvidtune window, you should see the "Vertical sync rate in Hz" box. If the setting in that box is lower than 72Hz, you likely can optimize your X configuration. The exception is if you are using an LCD monitor, which refreshes differently than a CRT and normally has a value of around 60Hz. The other values you need that this tool provides are the pixel clock rate and the HDisplay and VDisplay values, which combined make up your current monitor resolution.

To determine your optimal refresh rate, visit http://xtiming.sourceforge.net/cgi-bin/xtiming.pl, and enter your monitor specifications in the Basic Configuration section. Do not enter a value for Refresh Rate; that is what you are seeking to calculate. Unless you have a widescreen display, your Aspect Ratio is 4:3. Most modern monitors are noninterlaced, but if your monitor is more than four years old, you should double-check whether it is noninterlaced by Googling for specifications. There is seldom a reason to check Doublescan. Once you have filled out the information, click the Calculate Modeline button at the bottom.

When the web page refreshes, a new section at the top will provide you with a modeline to use in your XF86Config-4 file. Copy this so that you can use it later.

11.4.2. Configure Your Monitor

To optimize your monitor settings, you need to adjust your X configuration file (usually XF86Config-4, but if you are using Xorg, the file is xorg.conf). Before you change anything in your X configuration, though, you should back up your X configuration file with this, or a similar command:

foo@bar:~$ cp /etc/X11/XF86Config-4 /etc/X11/XF86Config-4.backup

Now you need to modify the configuration file. Within the XF86Config-4 is a section called Monitor where you can configure general monitor settings. Adjust the section using the information you have from the X timing web site and the information you received from your monitor and xvidtune:

Section "Monitor"
        Identifier      "Whizzbang MonitorMan"
        HorizSync       28-64
        VertRefresh     43-60
        Option          "DPMS"
        Modeline        "1152x864@88" 83.91 1280 1312 1624 1656 800 816 824 841"
EndSection

One intriguing option within this block is the DPMS setting. This highly recommended, power-saving feature puts your monitor into standby mode if you have not used it for a while. HorizSync and VertRefresh are the ranges you found earlier from your monitor's documentation or from searching the Web. Modeline, which describes to X your monitor's frequencies, timings, and resolution, comes from the X timing web site.

The name of the mode defined in the example is 1152x864@88. It is a unique identifier describing the preferred resolution at 88Hz (this is a crisp resolution).

11.4.3. Configure the Resolution and Refresh Rate

To change the resolution and refresh rate inside X, you need to adjust the Screen part of the configuration file. This section contains some important settings which, if configured incorrectly, could stop X from working properly.

The first part of the block contains information about your monitor. Some of the details you added to the Monitor block earlier should be copied over to this block. For the main part of this block, you need to set two things: the resolution and the color depth. You use the DefaultDepth option to set the color depth, and you use the Modes section to specify the first part of the custom mode you obtained from the X timing web site (1152x864@88 for this example). You should ensure that modes you don't use are removed from the Modes line. Here is an example block:

Section "Screen"
        Identifier  "Screen 1"
        Device      "Acme VideoKing"
        Monitor     "Whizzbang MonitorMan"
        DefaultDepth 16
        Subsection "Display"
                Depth       16
                Modes       "1152x864@88"
                ViewPort    0 0
        EndSubsection
EndSection

Now restart X. If you are starting X with startx, simply log out and restart the server. For example, if you are using a display manager such as GDM, you will need to restart it with this:

foo@bar:~$ /etc/init.d/gdm restart

    Team LiB
    Previous Section Next Section