Changing Video modes in Ubuntu

This is a bit of a hack, but it sort of works. (Original script was from freaktab somewhere)

This is not a full solution - and I hope others will take it and run with it, I have no experience with framebuffer.

I have an oddball 800x480 HDMI screen - this almost works, but the screen is still a bit messed up.
I think I need to play around with the scale axis etc…
Anyway, what I did notice is that it does work fine if you boot into 1080p and want to switch down to 720p for whatever reason.

For the oddball resolutions, you have to set your resolution lower than you want - then use this to go upto the resolution that is slightly larger and scale it back.

#!/bin/sh

VMODE=`cat /sys/class/display/mode`;

if [ "$VMODE" = "480p60hz" ]; then
echo 720p60hz > /sys/class/display/mode
echo 0 0 799 479 > /sys/class/graphics/fb0/window_axis
echo 1920 1080 800 480 > /sys/class/graphics/fb1/scale_axis
echo 0 0 1920 1080 0 0 18 18 > /sys/class/display/axis
else
if [ "$VMODE" = "720p60hz" ]; then
echo 1080p60hz > /sys/class/display/mode
echo 0 0 1023 599 > /sys/class/graphics/fb0/window_axis
echo 1920 1080 1024 600 > /sys/class/graphics/fb1/scale_axis
echo 0 0 1920 1080 0 0 18 18 > /sys/class/display/axis
else
echo "Current mode not found."
echo " "
echo "For 800x480 mode"
echo " Set your display to 480p using:"
echo " echo 480p60hz > /sys/class/display/mode"
echo " "
echo "For 1024x600 mode"
echo " Set your display to 720p using:"
echo " echo 720p60hz > /sys/class/display/mode"
fi;
fi;
1 Like

Will it work with VIM3 (Ubuntu Gnome Focal) for 1920 x 480? How can I set it?