Ubuntu 20.04 從睡眠中喚醒後失去顯示器分辨率

Ubuntu 20.04 從睡眠中喚醒後失去顯示器分辨率

我有一台 Nvidia RTX 3070 和一台三星 C49RG90 顯示器。顯示器透過 HDMI 連接到顯示卡。一切工作正常,除非我暫停系統然後將其喚醒。發生這種情況時,解析度將變更為 1024x768。我可以登入並開啟 Nvidia 控制面板並將其設定回正確的分辨率,但如果我再次將其置於睡眠狀態,分辨率始終會返回到 1024x768。

我使用的是 Nvidia 驅動程式 470.86 版本,但舊版本的行為方式相同。

當我在喚醒後手動設定解析度然後運行時xrandr,我得到以下結果:

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)

當我讓機器進入睡眠狀態然後再次喚醒它,然後運行時xrandr,我得到以下資訊:

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

這是我的xorg.conf文件:

# 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

我知道可能需要更多信息,但我不確定在哪裡查找。

答案1

經過幾年偶爾的研究,我相信我已經解決了這個問題。

第一的,這個問題Nvidia 開發者論壇上的問題與我的問題幾乎相同。與該問題的作者一樣,我認為問題的根源在於我的顯示器從睡眠狀態喚醒時不提供 EDID 信息,這導致 Ubuntu 選擇默認的 1024x768 分辨率。

為了解決這個問題,我按照描述匯出了我的 EDID這裡。我將該檔案儲存為 ASCII 並命名crg-edit.txt,然後將其移至/etc/X11.然而,我做到了不是執行「從檔案載入顯示 EDID」部分中的指令。相反,我手動打開我的/etc/X11/xorg.conf文件並對其進行編輯(請參閱配置中的註釋):

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

完成這些步驟後,顯示器將從掛起狀態恢復,解析度為 3840x1080,但仍不是我的目標解析度 5120x1440。所以我運行xrandr --verbose並注意到由於某種原因該決議是首選:

...
  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
...

環顧四周後,我發現問題。然後我再次編輯xorg.conf如下:

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

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

我不確定是否需要自訂 EDID 和其他設置,而且我也不關心,因為它正在工作,我不想管它。但我想分享我的發現,以防對其他人有幫助。

編輯:我在安裝 Ubuntu 22.04 時經歷了這個過程,並且運作良好。請注意,完成這些步驟後首次登入後,畫面預設為 3840x1080。我使用 Ubuntu 控制面板將解析度變更回 5120x1440,並且在重新啟動和暫停後仍保持該設定。

答案2

我有同樣的問題,我有 Pop!_OS 22.04,這是不久前在一些更新後開始的。這應該是驅動問題。我注意到,當顯示器恢復後進入睡眠模式時(這可能是任一顯示器),它會下降到 800x400。基本上我的側面步驟是關閉顯示器,然後再打開。我的顯示器是聖誕節剛收到的 27 吋華碩 VQR。

我一直在研究刷新率和顯示分辨率,我相信顯示器(透過 DP 插入)不是問題。當我安裝 20.04 並更新到 21.10,然後再次更新到 22.04 時,發生了這種情況。因此,雖然我實際上不知道是什麼導致了您的問題,但我相信我的問題是驅動程序,而且由於我不是驅動程式專家,因此我必須等待修復。

我確實知道您可以使用 xrandr 配置文件,以便在每次啟動計算機時設置顯示器的特定分辨率和基數,接下來我將查找並嘗試該操作。當我使用 3 台顯示器時,它真的很糟糕。

相關內容