"Maintain aspect ratio" with open source video drivers
I recently dusted off my old netbook to install the latest Ubuntu Trusty beta.
After I finally got most everything working (note to future self and anyone
with a Broadcom BCM4313 wifi card: apt-get purge bcmwl-kernel-source
and
reboot if your wifi won’t authenticate—according to Additional Drivers your
wifi card will be disabled, but it works flawlessly), I installed some old
games in Wine to get one more data point on how Ubuntu is keeping up with my
desire to play GTA2.
Turns out it’s keeping up just fine these days, but there was one issue: on my netbook’s 16:9 display, the 4:3 resolutions GTA2 runs in were stretched out to the full 16:9 width, distorting the game. Maybe some people can stomach warped aspect ratios, but it bugs the everloving crap out of me. I always want a resolution expanded to fill the maximum space in the display without stretching one dimension more than another, with bars of unused space on either side (the vertical equivalent of letterboxing).
I’ve seen this feature called “maintain aspect ratio” in proprietary drivers’
“control panel” apps, so I tried installing the fglrx-updates
driver for my
Radeon card and found the option in “Catalyst Control Center” where I expected.
This had the desired effect, but using the proprietary driver caused GTA2 to
crash on startup. I guess AMD isn’t keeping up as well as Ubuntu.
So, I set out on my quest to find the “maintain aspect ratio” option for the open source Radeon driver. (I prefer open source drivers in principle, so old games weren’t the only catalyst [!] here.) Unfortunately, the driver’s man page offers no guidance.
Solution
After much duckduckgo-ing, I finally landed on this Fedora forum
post with the answer.
My old nemesis xrandr
, we meet again! I assume this fix might also work
with other types of video cards, but who knows when it comes to xrandr
.
The specific arcane incantation that solved the problem for me ended up sounding like:
xrandr --output LVDS --set "scaling mode" "Full aspect"
It would be too easy if typing that one command would fix the problem for good.
No, you have to run that every time your computer boots. Thankfully, we can
simply stick it in ~/.xprofile
and let lightdm (or who knows/cares what piece
of software ends up running it) take care of it for us.
Wayland and/or Mir can’t dethrone X quickly enough.