我正在尝试为主显示器设置自定义分辨率,但显示器并未宣传可用分辨率。在 Windows 上,我可以在 NVIDIA 控制面板中设置自定义分辨率,然后使用命令行切换到该分辨率qres。
现在我在 Linux 上,我希望为我的显示创建一个自定义模式,并在需要使用 xrandr 时切换到它。但我找到的所有指南都失败了,最终出现“BadMatch”错误。
ellitedev@twrreborn:~$ xrandr
Screen 0: minimum 8 x 8, current 3640 x 2580, maximum 32767 x 32767
DP-0 connected 1080x1920+0+660 left (normal left inverted right x axis y axis) 531mm x 298mm
1920x1080 60.00*+ 144.00 119.98 119.88 100.00 99.93 74.99 59.94 50.00
1440x900 119.85
1280x1024 119.96 75.02 60.02
1280x960 99.78
1280x720 60.00 59.94 50.00
1024x768 119.99 75.03 60.00
800x600 119.97 99.66 75.00 60.32
720x576 50.00
720x480 59.94
640x480 119.52 75.00 59.94 59.93
DP-1 disconnected (normal left inverted right x axis y axis)
DP-2 disconnected (normal left inverted right x axis y axis)
DP-3 connected (normal left inverted right x axis y axis)
1280x768 59.99 +
1920x1080 60.00 59.94 50.00
1360x768 60.02
1360x765 60.00
1280x800 59.81
1280x720 60.00 59.94 50.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 59.93
HDMI-0 connected primary 2560x1080+1080+1080 (normal left inverted right x axis y axis) 798mm x 334mm
2560x1080 59.98*+ 74.99 50.00
3840x2160 29.97 25.00 23.98
2560x1440 59.95
1920x1080 75.00 60.00 59.94 50.00
1680x1050 59.95
1600x900 60.00
1280x1024 75.02 60.02
1280x800 59.81
1280x720 60.00 59.94 50.00
1152x864 60.00
1024x768 75.03 60.00
800x600 75.00 60.32
720x576 50.00
720x480 59.94
640x480 75.00 59.94 59.93
DP-4 disconnected (normal left inverted right x axis y axis)
DP-5 connected 1920x1080+1400+0 (normal left inverted right x axis y axis) 531mm x 299mm
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
DVI-D-1-0 disconnected (normal left inverted right x axis y axis)
HDMI-1-0 disconnected (normal left inverted right x axis y axis)
DP-1-0 disconnected (normal left inverted right x axis y axis)
DP-1-1 disconnected (normal left inverted right x axis y axis)
ellitedev@twrreborn:~$ cvt 2400 1080 60
# 2400x1080 59.97 Hz (CVT) hsync: 67.16 kHz; pclk: 216.00 MHz
Modeline "2400x1080_60.00" 216.00 2400 2552 2808 3216 1080 1083 1093 1120 -hsync +vsync
ellitedev@twrreborn:~$ xrandr --newmode "2400x1080_60.00" 216.00 2400 2552 2808 3216 1080 1083 1093 1120 -hsync +vsync
ellitedev@twrreborn:~$ xrandr --addmode HDMI-0 "2400x1080_60.00"
X Error of failed request: BadMatch (invalid parameter attributes)
Major opcode of failed request: 140 (RANDR)
Minor opcode of failed request: 18 (RRAddOutputMode)
Serial number of failed request: 65
Current serial number in output stream: 66
我想确保当我更换这一台显示器时,所有其他显示器都保持完好。
我知道这可能是其他帖子的副本,但我束手无策。
答案1
我找到了解决方案!我从一个人那里得到了我需要知道的基础论坛帖子,以及 YouTube 视频。
在论坛帖子中,我找到了需要添加到 xorg 配置中的特定选项。由于我使用的是 Pop!_OS,我发现我可以在 中找到我需要的那个/usr/share/X11/xorg.conf.d/
。我实际上必须更改的文件是10-nvidia.conf
.我认为情况确实如此,因为在 YouTube 视频中,我看到 xorg 在启动时按文件名顺序加载配置。由于我有 nvidia 驱动程序,我认为它将是名为 nvidia.h 的文件。
现在我必须添加的行是:
Option "ModeValidation" "AllowNon60hzmodesDFPModes, NoEDIDDFPMaxSizeCheck, NoVertRefreshCheck, NoHorizSyncCheck, NoDFPNativeResolutionCheck, NoMaxSizeCheck, NoMaxPClkCheck, AllowNonEdidModes, NoEdidMaxPClkCheck"
现在我的配置如下所示:
Section "OutputClass"
Identifier "nvidia"
MatchDriver "nvidia-drm"
Driver "nvidia"
Option "AllowEmptyInitialConfiguration"
Option "ModeValidation" "AllowNon60hzmodesDFPModes, NoEDIDDFPMaxSizeCheck, NoVertRefreshCheck, NoHorizSyncCheck, NoDFPNativeResolutionCheck, NoMaxSizeCheck, NoMaxPClkCheck, AllowNonEdidModes, NoEdidMaxPClkCheck"
ModulePath "/usr/lib/x86_64-linux-gnu/nvidia/xorg"
EndSection
保存此配置并重新启动后,我能够成功地将自定义模式添加到我的显示器中:)我希望这可以帮助其他感到困惑的人。