January 6, 2013

Nvidia Overscan in Ubuntu 12.10

A few weeks ago I upgraded my HTPC to Ubuntu 12.10 and was treated to a nasty surprise: the overscan settings for the nvidia driver were no longer recognized. The HTPC is connected to my television (naturally) which is a 40" LG LCD HDTV. If you have ever tried to connect your PC to an HDTV before, you probably encountered the problem of that the visible portion of the screen is smaller than the drawable portion of the screen. The result is that the edges of the screen are not visible. In my case that meant the dash and the universal menu of Unity could not be seen. That makes for a less than usable experience.

In the past nvidia included an overscan setting slider in the GUI configuration tool (nvidia-settings). When I opened it up however, the setting was nowhere to be found. A short time on google confirmed the worst: nvidia had removed the setting.

The good news is that the setting can be twiddled via the command line. Then, once you find the magic numbers that work with your particular graphics card and monitor, you can put them in your .nvidia-settings-rc file to automatically apply them on login. Also, the command is safe: if you try something that would push the screen too far, the driver simply ignores it.

The first step is to run the command with a bunch of values until you find the values that work best:

nvidia-settings --assign 0/CurrentMetaMode="DFP-0: 1280x720 { ViewPortIn=12
80x720, ViewPortOut=1190x680+44+20 }"

The first set of numbers, the ViewPortIn and the value before that, are determined by the native resolution of your HDTV. Mine is a 720p, so the native resolution is 1280x720. The next set of numbers, the ViewPortOut, are the ones you will want to experiment with. They are telling the driver how to transform the viewport so the screen ends up in the visible area of the HDTV. The first part, the 1190x680, indicates how much to scale the viewport. The second part, +44+20, indicates how much to shift the image.

Once you have the values you want, edit your ~/.nvidia-settings-rc file adding the following at the end:

0/CurrentMetaMode=DFP-0: 1280x720 { ViewPortIn=1280x720, ViewPortOut=1190x680+44+20 }

Obviously you will want to use the correct values for your system.