Monday, July 6, 2009

Switching display resolution for hdtv watching

While watching tv using the hdtv usb tuner mentioned in my previous posts, I noticed that some programs which have a native resolution of 720p come in a smaller box in the middle of the screen.
On the other hand the programs with 1080i native resolution comes beautifully to fill the screen.

I figured out that if use the nvidia-settings interface of my Nvidia gpu and and set panning to 1552x964 in 'X server Display Configuration'-> 'Advanced', my whole desktop becomes of resolution 1552x964 of which only the 1152x864 (the original resolution) portion is displayed on my screen. The hidden portion can be revealed by moving the mouse. Thus using the mouse I could position the 720p video to fill the screen. Nice.

Now the question is how to make the switch easy using command-line.
We are in luck.
Go to ftp://download.nvidia.com/XFree86/nvidia-settings/ and downloaded
nvidia-settings-185.18.14.tar.gz

sudo apt-get install libxxf86vm-dev ( dependency to make nvidia-settings)
tar zxvf nvidia-settings-185.18.14.tar.gz
make
cd samples
make
sudo cp nv-control-dpy /usr/local/bin

nv-control-dpy --add-metamode "1152x864_75 @1552x964 +0+0"
This adds the necessary meta mode to the Nvidia card.


nv-control-dpy --print-metamodes
This prints out the current metamodes. Note down the id of the added metamode.
In my case it was 107. Nvidia uses the frame-rate to store the id.


xrandr --output default --mode 1552x964 --rate id
will switch to the required screen mode and resolution. Replace the id with the actual id noted in the previouse step (107 for me).
To go back note down the metamode id of the original resolution and call xrandr again

xrandr --output default --mode 1152x864 --rate id

Some scripts with more functionality and more details are available here
http://ubuntuforums.org/showthread.php?t=922956

Happy watching.

Arun

No comments: