Moved to https://interlaced-insanity.com/wiki/custom-resolutions-with-xrandr/

Quick how to on custom resolutions on X11/Linux with xrandr

Use gtf to calculate modelines

1
2
3
4
~ gtf 1024 768 60

  # 1024x768 @ 60.00 Hz (GTF) hsync: 47.70 kHz; pclk: 64.11 MHz
  Modeline "1024x768_60.00"  64.11  1024 1080 1184 1344  768 769 772 795  -HSync +Vsync

Copy the modeline and add it with xrandr. You can change "1024x768_60.00" to whatever you want, if you wish to.
xrandr --newmode "1024x768_60.00" 64.11 1024 1080 1184 1344 768 769 772 795 -HSync +Vsync

Then associate the added modeline with an output
xrandr --addmode DisplayPort-0 "1024x768_60.00"

Then change to the new mode with
xrandr --output DisplayPort-0 --mode "1024x768_60.00"

That's it! If you're on a multimonitor setup, you may also want to define the positions with flags like --left-of, read man xrandr.

Automation

This process can obviously be automated.

1
2
3
4
5
#!/bin/sh
output=DisplayPort-0
xrandr --newmode $@
xrandr --addmode $output $1
xrandr --output  $output --mode $1

You can save this file as crtmode, and run it with the modelines generated with GTF or some other program.
./crtmode "1024x768_60.00" 64.11 1024 1080 1184 1344 768 769 772 795 -HSync +Vsync

If you only need modelines from GTF, script below automates running gtf too.

#!/bin/sh
set -e
output="DisplayPort-0"
gtf $1 $2 $3 | grep kHz
modeline=$(gtf $1 $2 $3 | grep Modeline | tr -d '"' | cut -d" " -f4-)
modename=$(echo $modeline | cut -d" " -f1)
echo $modeline
if xrandr | grep -q $modename; then
    xrandr --delmode $output $modename
    xrandr --rmmode $modename
fi
xrandr --newmode $modeline
echo Added new mode
xrandr --addmode "$output" $modename
xrandr --output  "$output" --mode $modename

You can save it as gtfmode and run ./gtfmode 1024 768 60

Overriding Nvidia mode checks

Nvidia tries to validate your modelines, which may limit your refresh rates and other such "overclocking". You'll notice this as BadMatch errors when running xrandr --addmode.
You can disable these checks at least when using X11, read the documentation:
https://download.nvidia.com/XFree86/Linux-x86_64/396.51/README/xconfigoptions.html

Below a minimum example config which disables every mode check.
Save it to /etc/X11/xorg.conf or /etc/X11/xorg.conf.d/30-novideo.conf (recommended)

1
2
3
4
5
6
Section "Device"
    Identifier "NVIDIA Card"
    Driver "nvidia"
    VendorName "NVIDIA Corporation"
    Option "ModeValidation" "NoMaxPClkCheck, AllowDpInterlaced, NoHorizSyncCheck, NoVertRefreshCheck, NoDisplayPortBandwidthCheck, AllowNonEdidModes, NoExtendedGpuCapabilitiesCheck, NoTotalSizeCheck"
EndSection

Be aware out-of-spec modelines may damage monitors, but that's exceedingly rare with Multisync CRTs. But do this on your own risk.
My GPU also locks up when trying certain resolutions, so be prepared for that when stretching limits.

And before you get excited about AllowDpInterlaced, it does not work on RTX cards. The documentation implies the lacking DP interlace support is an actual hardware limitation.

Extra

If you need to edit the timings, I wrote this handy editor https://kosshi.gitlab.io/vgatimingeditor/
Page also contains lots of extra info on timings.

t. your favorite 2hu fag

Edit
Pub: 04 Mar 2023 13:55 UTC
Edit: 31 Jul 2023 14:58 UTC
Views: 313