4

I have an Nvidia RTX 3070 and a Samsung C49RG90 monitor. The monitor is connected to the video card via HDMI. Everything works fine, unless I suspend the system and then wake it back up. When that happens, the resolution changes to 1024x768. I can log in and open the Nvidia control panel and set it back to the correct resolution just fine, but if I put it to sleep again, the resolution always returns to 1024x768.

I am using version 470.86 of the Nvidia driver, but older versions behave the same way.

When I manually set the resolution after wake and then run xrandr, I get this:

Screen 0: minimum 8 x 8, current 5120 x 1440, maximum 32767 x 32767
HDMI-0 connected primary 5120x1440+0+0 (normal left inverted right x axis y axis) 1mm x 1mm
   3840x1080     59.97 +
   5120x1440     59.98*   29.98  
   3840x2160     59.94    50.00    29.97    25.00    23.98  
   2560x1440     59.95  
   2560x1080     60.00    59.94  
   1920x1080     60.00    59.94    50.00  
   1680x1050     59.95  
   1600x900      60.00  
   1440x900      59.89  
   1280x1024     75.02    60.02  
   1280x800      59.81  
   1280x720      60.00    59.94    50.00  
   1152x864      75.00  
   1024x768      75.03    70.07    60.00  
   800x600       75.00    72.19    60.32    56.25  
   720x576       50.00  
   720x480       59.94  
   640x480       75.00    72.81    59.94  
DP-0 disconnected (normal left inverted right x axis y axis)
DP-1 disconnected (normal left inverted right x axis y axis)
DP-2 disconnected (normal left inverted right x axis y axis)
DP-3 disconnected (normal left inverted right x axis y axis)
DP-4 disconnected (normal left inverted right x axis y axis)
DP-5 disconnected (normal left inverted right x axis y axis)

When I put the machine to sleep and then wake it again, and then run xrandr, I get this:

Screen 0: minimum 8 x 8, current 5120 x 1440, maximum 32767 x 32767
HDMI-0 connected primary 1024x768+3327+362 (normal left inverted right x axis y axis) 0mm x 0mm panning 5120x1440+0+0
   3840x1080     59.97 +
   5120x1440     59.98    29.98  
   3840x2160     59.94    50.00    29.97    25.00    23.98  
   2560x1440     59.95  
   2560x1080     60.00    59.94  
   1920x1080     60.00    59.94    50.00  
   1680x1050     59.95  
   1600x900      60.00  
   1440x900      59.89  
   1280x1024     75.02    60.02  
   1280x800      59.81  
   1280x720      60.00    59.94    50.00  
   1152x864      75.00  
   1024x768      75.03    70.07    60.00  
   800x600       75.00    72.19    60.32    56.25  
   720x576       50.00  
   720x480       59.94  
   640x480       75.00    72.81    59.94  
DP-0 disconnected (normal left inverted right x axis y axis)
DP-1 disconnected (normal left inverted right x axis y axis)
DP-2 disconnected (normal left inverted right x axis y axis)
DP-3 disconnected (normal left inverted right x axis y axis)
DP-4 disconnected (normal left inverted right x axis y axis)
DP-5 disconnected (normal left inverted right x axis y axis)
  1024x768 (0x208) 94.500MHz +HSync +VSync
        h: width  1024 start 1072 end 1168 total 1376 skew    0 clock  68.68KHz
        v: height  768 start  769 end  772 total  808           clock  85.00Hz

Here's my xorg.conf file:

# nvidia-settings: X configuration file generated by nvidia-settings
# nvidia-settings:  version 470.57.01

Section "ServerLayout" Identifier "Layout0" Screen 0 "Screen0" 0 0 InputDevice "Keyboard0" "CoreKeyboard" InputDevice "Mouse0" "CorePointer" Option "Xinerama" "0" EndSection

Section "Files" EndSection

Section "Module" Load "dbe" Load "extmod" Load "type1" Load "freetype" Load "glx" EndSection

Section "InputDevice" # generated from default Identifier "Mouse0" Driver "mouse" Option "Protocol" "auto" Option "Device" "/dev/psaux" Option "Emulate3Buttons" "no" Option "ZAxisMapping" "4 5" EndSection

Section "InputDevice" # generated from default Identifier "Keyboard0" Driver "kbd" EndSection

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" EndSection

Section "Device" Identifier "Device0" Driver "nvidia" VendorName "NVIDIA Corporation" BoardName "NVIDIA GeForce RTX 3070" EndSection

Section "Screen" Identifier "Screen0" Device "Device0" Monitor "Monitor0" DefaultDepth 24 Option "Stereo" "0" Option "nvidiaXineramaInfoOrder" "DFP-0" Option "metamodes" "5120x1440 +0+0; 800x600 +0+0; 640x480 +0+0" Option "SLI" "Off" Option "MultiGPU" "Off" Option "BaseMosaic" "off" SubSection "Display" Depth 24 EndSubSection EndSection

I understand that more information will likely be required, but I'm not sure where to look.

automatom
  • 171
  • Just a note that I side-stepped this issue by using the C49RG90's "picture by picture" (PBP) mode. I used two DisplayPort cables to connect two ports on my video card to the two DisplayPort inputs on the monitor. This solves this issue, though it makes Ubuntu think I have two monitors. But I can live with that. – automatom Jan 14 '22 at 11:10
  • Check this out. It took me a few months to find this solution. Please see my comments to that answer as well. Multiple problems were solved by this solution all at once! https://askubuntu.com/questions/1391976/ubuntu-20-04-suspend-logs-off-and-wakes-up – victor xyz Mar 18 '24 at 07:03

2 Answers2

3

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.

automatom
  • 171
1

I have the same issue and I have Pop!_OS 22.04 and this started a while ago after some updates. This has to be a driver issue. I noted when the monitors went down to sleep mode when they came back up, and this could be either monitor, it goes down to 800x400. Basically my side step has been to turn the monitor off, then back on again. My monitors are 27" Asus VQR that I just got from Christmas. I know this is not the monitors, because it depends on which one I set to being the first monitor.

I have been playing around with refresh rates and display resolutions and I believe that the monitors (which are plugged in with DP) are not the issue. It happened when I installed 20.04 and updated to 21.10, then again to 22.04. So while I don't actually know what caused your issue, I believe mine to be drivers and since I am not a driver guru, I will have to wait on fixes in the meanwhile.

I do know that you can configure a file using xrandr to get a specific resolution and cardinality of your monitors to be set every time you start your computer and I am going to look for and try that next. It really flaked out when I used 3 monitors.