After a couple years of occasionally poking at this, I believe I've solved the issue.
First, this question on the Nvidia developer forums is pretty much identical to my issue. Like the author of that question, I believe that the root of the issue is that my monitor isn't providing EDID information when it wakes from sleep, which is causing Ubuntu to select a default 1024x768 resolution.
To get around this, I exported my EDID as described here. I saved the file as ASCII and named it crg-edit.txt
, then moved it to /etc/X11
. However, I did not run the commands in the "Loading display EDID from file" sections. Instead, I manually opened up my /etc/X11/xorg.conf
file and edited it as such (see comments in the config):
Section "Screen"
Identifier "Screen0"
Device "Device0"
Monitor "Monitor0"
DefaultDepth 24
Option "Stereo" "0"
Option "nvidiaXineramaInfoOrder" "DFP-0"
Option "CustomEDID" "GPU-0.HDMI-0:/etc/X11/crg-edid.txt" # I added this line
Option "metamodes" "5120x1440 +0+0" # I removed the 1024x768 option from here
Option "SLI" "Off"
Option "MultiGPU" "Off"
Option "BaseMosaic" "off"
SubSection "Display"
Depth 24
EndSubSection
EndSection
After these steps, the monitor would come back from suspend with a higher resolution of 3840x1080, but still not my target resolution of 5120x1440. So I ran xrandr --verbose
and noted that that resolution was for some reason preferred:
...
3840x1080 (0x1be) 266.500MHz +HSync -VSync +preferred
h: width 3840 start 3888 end 3920 total 4000 skew 0 clock 66.62KHz
v: height 1080 start 1083 end 1093 total 1111 clock 59.97Hz
5120x1440 (0x1bf) 469.000MHz +HSync -VSync *current
h: width 5120 start 5168 end 5200 total 5280 skew 0 clock 88.83KHz
v: height 1440 start 1443 end 1453 total 1481 clock 59.98Hz
...
After looking around some more, I found this question. I then edited my xorg.conf
again as follows:
Section "Monitor"
# HorizSync source: edid, VertRefresh source: edid
Identifier "Monitor0"
VendorName "Unknown"
ModelName "Samsung C49RG9x"
HorizSync 30.0 - 160.0
VertRefresh 24.0 - 120.0
Option "DPMS"
Option "PreferredMode" "5120x1440" # I added this line
EndSection
and
Section "Screen"
Identifier "Screen0"
Device "Device0"
Monitor "Monitor0"
DefaultDepth 24
Option "Stereo" "0"
Option "nvidiaXineramaInfoOrder" "DFP-0"
Option "CustomEDID" "GPU-0.HDMI-0:/etc/X11/crg-edid.txt"
Option "metamodes" "5120x1440 +0+0"
Option "SLI" "Off"
Option "MultiGPU" "Off"
Option "BaseMosaic" "off"
SubSection "Display"
Virtual 5120 1440 # I added this line
Depth 24
EndSubSection
EndSection
I am not sure whether both the custom EDID and the other settings were needed, and I also don't care, because it's working and I want to leave it alone. But I wanted to share my findings in case it helps anyone else.
EDIT: I went through this process when I installed Ubuntu 22.04, and it worked fine. Just a note that after logging in for the first time after these steps were done, the screen defaulted to 3840x1080. I used the Ubuntu control panel to change the resolution back to 5120x1440, and it remains with that setting through reboots and suspending.