Saturday, May 1, 2010

Setting X resolution the new way

I am spending some time trying to tweak my XBMC setup on Fedora 12 linux on a cute little Dell Studio Hybrid computer. One problem is my HDMI output has to go through a Sony HT-CT500 video receiver, so we can press "DVD" on the remote and switch from the Cable DVR box to the linux computer screen. Purely convenience, but the details in life are important.

This leads to the problem that the Sony video receiver clips the HDMI signal, even in its passthrough mode. Not great, why did the engineers not test it better? 1024x768 resolution is impossible, the LCD TV just goes blank. Could it be the TV or the HDMI cable? No, when I plug in the Linux box directly using the HDMI cable, it displays that resolution fine. Linux dutifully searches for an appropriate resolution on KDE startup and chose 640x480, but I think I can do better. Perhaps a shortsighted goal, but I can be an explorer, and am in such a mood now.

Ok, so how to determine what the exact limits of the Sony video passthrough is? Use the nifty new xrandr tool on Linux's X server. There is no longer an xorg.conf it seems, and good riddance.

Here is a little script that allows me to do a parameter sweep quickly. It is influenced by others, namely http://compbrain.net/archives/tag/xrandr. So far I have got 736x500 to work.

[xbmc@shitzu bin]$ cat try-new-res
#!/bin/bash
#
# Try different screen resolutions
#
# FDS 2010


set -x 

if (( $# != 2 ))
then
        echo "Give me two ints: horizontal vertical resolution"
        exit 1
fi
c=$(cvt -r $1 $2 | tail -1 | sed -e 's/Modeline//')
if ! xrandr --newmode $c
then
        echo "Too bad"
        exit 2
fi
name=$(echo $c | awk '{print $1}')
xrandr --addmode HDMI1 $name
xrandr --output HDMI1 --mode $name

No comments:

Post a Comment