Adventures Using a Passive VGA Splitter

Adventures Using a Passive VGA Splitter

Robbert Haarman

2013-01-06

Posted by inglorion
at 2012-12-20 18:25:01

I have a computer monitor and a TV. Both of them have a native resolution of 1920x1080. Both of them have VGA input. I have a KVM switch that has a VGA output. Since I already have a wireless keyboard that allows me to operate my PC from the couch, I thought it would be nice to have the output of the KVM switch displayed on both the computer monitor and the TV. So I bought a VGA splitter cable.

What I had forgotten to think about is that getting the display and the video card to agree on a resolution and associated timings is quite a tricky game. When I started out doing graphics on computers, there were a few graphics modes I could set using the SCREEN command in BASIC. Later, I discovered the deep magic of modelines, and how you could basically set whatever resolution and timings you wanted and create all kinds of wonderful effects, from crystal-clear graphics to noisy images, monitors refusing to display anything, and even, reportedly, sound effects and exploding monitors. With the myriad of available graphics cards and displays, it's a miracle things work at all.

VESA has been trying to create some order in the chaos. One of the ideas they have come up with is EDID, which allows your video card to read some identifying information from your display, including what resolutions and timings it supports. Intersecting this with the capabilities of the video card (e.g. amount of memory, maximum supported pixel clock) then yields a set of modes that are supported by both the video card and the display. This, basically, solves the problem.

Now, I wouldn't be writing about this if there weren't more to the story. The VGA splitter I bought is a passive splitter, meaning it's just a bunch of wires with no magic. Where a normal VGA cable makes a single signal available to one display, this one makes a single signal available to two displays. So, what happens if you connect two displays and you try to read the EDID information from the single connector that plugs into the video card? The answer is that that won't work. In my case, the VGA splitter doesn't allow EDID information to be read at all. Back to the early 1990s.

All is not lost, however. There are a few standard resolutions that any VGA monitor supports. 640x480 is one. At some point, 800x600 and 1024x768 were apparently sufficiently standardized that these will work without EDID information, too. But really, I didn't buy two full HD displays so that I could look at yesterdecade's state of the art graphics. Surely, there must be a common set of timings that both my computer monitor and my TV support, and if I can just get my video card to output those, I will be all set.

As it turns out, Linux and X.org have made a lot of progress since I last looked into this stuff. Modelines are out. In fact, the configuration file that used to contain them is entirely optional nowadays. You can use xrandr to set video modes while X is running, except that you're not actually supposed to use X for setting video modes nowadays, that's what we have kernel mode-setting for. Argh. Now how am I going to specify my modelines?

The good news is that VESA has made a lot of progress, too. They started by standardizing resolutions and providing an API to set them, but this didn't keep up with progress in the industry. After various iterations, they have come up with Coordinated Video Timings, which, effectively, defines a formula that can be used to calculate reasonable timings for a given resolution and refresh rate. Not only that, they have also considered that, while the old CRT monitors needed time after every scanline and frame to reset to the left or top of the display, with current discrete displays, you're actually better off keeping that time short so that you use the time you have to push pixels more efficiently. This means that CVT timings basically come in two flavors: a standard timing intended for CRT monitors, and a reduced blanking timing intended for discrete displays.

Linux will normally only use video modes specified in the EDID. However, because EDID doesn't always work (not just because of cheapskates like me who buy passive VGA splitters, but also because some displays have broken EDID data), it also supports setting a CVT-compliant mode while ignoring the EDID data. My computer monitor and my TV both have LCDs, which work fine with reduced blanking (the TV actually won't work without it). In the end, passing Linux the command-line parameter

video=1920x1080MR

made it all work. The numbers indicate the number of horizontal and vertical pixels, respectively. The M indicates that you want to calculate the timings using CVT, instead of looking them up in a table. The R specifies that you want to use reduced blanking. All this is documented in Documentation/fb/modedb.txt that comes with the Linux kernel.

Next on the list: getting this to work in Windows.