Tuning X video with modeline

After setting my monitor up, I found it didn’t exactly match the other devices on my kvm switch. I could get around this by pressing the “Auto Adjust” button on the monitor, but that meant I’d have to adjust again when I switched to a different machine.

Usually, what I do in these cases is to use xvidtune to fine-tune things. Unfortunately, that didn’t work – it would always fail with “Unable to query monitor info” even when I disconnected the kvm switch and went directly into the monitor.

What that meant is that I’d have to hack the modeline manually. I found a good discussion of modelines here.

A modeline has the following format:

name dotclock hsize hsyncstart hsyncend htotal vsize vsyncstart vsyncend vtotal hsyncpol vsyncpol

I needed to move the image on my monitor to the right (I had a black bar on the right hand side, and the left hand side was clipped off). To move the monitor right, I needed to DECREASE hsyncstart and hsyncend by the same amount. (Then I logged out and logged back in to restart X so the new settings were being used.)

Once the screen was more or less centred, I DECREASED htotal to make the display wider. (And then logged out and logged in again….)

After that, the image was still a little further right than I wanted, so I DECREASED hsyncstart and hsyncend again to get the wider display centered again. One more restart of X and things were groovy.

My current modeline is:
Section "Monitor"
Identifier "Configured Monitor"
# 1280x1024 59.89 Hz (CVT 1.31M4) hsync: 63.67 kHz; pclk: 109.00 MHz
# Modeline "1280x1024_60.00" MHz HSize HTotal HSyncEnd HSyncDelay VSize VSyncStart VSyncEnd VTotal HSyncPol VSyncPol
Modeline "1280x1024_60.00" 109.00 1280 1322 1450 1700 1024 1027 1034 1066 -hsync +vsync

Now things are automatically adjusted when I switch from one box to another.

Note: This won’t work if you aren’t currently displaying something in the mode you want to use. Also, keep a copy of your original values in your xorg.conf file just in case things go awry – it’s possible to put all your controls offscreen, which can make things challenging.


One Response to Tuning X video with modeline

  1. […] I found I needed to tune the values a little bit. See the post here for more […]

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: