我有两个显示器设置在我的桌面PC运行Ubuntu 18.04与NVIDIA GTX 960显卡。我在运行专有的NVIDIA驱动程序。
首先,我打开nvidia-settings并调整显示器,以便按如下所示排列它们。

然后使用"Save“按钮创建一个新的/etc/X11/xorg.conf文件。结果的/etc/X11/xorg.conf如下所示。
# nvidia-settings: X configuration file generated by nvidia-settings
# nvidia-settings: version 410.79
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 "DELL U2414H"
HorizSync 30.0 - 83.0
VertRefresh 56.0 - 76.0
Option "DPMS"
EndSection
Section "Device"
Identifier "Device0"
Driver "nvidia"
VendorName "NVIDIA Corporation"
BoardName "GeForce GTX 960"
EndSection
Section "Screen"
Identifier "Screen0"
Device "Device0"
Monitor "Monitor0"
DefaultDepth 24
Option "Stereo" "0"
Option "nvidiaXineramaInfoOrder" "DFP-0"
Option "metamodes" "DP-4: nvidia-auto-select +1920+0 {rotation=left}, DVI-I-1: nvidia-auto-select +0+840"
Option "SLI" "Off"
Option "MultiGPU" "Off"
Option "BaseMosaic" "off"
SubSection "Display"
Depth 24
EndSubSection
EndSection重新启动后,正确的监视器不再旋转,如nvidia-设置中所示。

在非常重要的情况下,左侧监视器通过DVI-I (DVI 1)连接,右边监视器通过DisplayPort (DP-4)连接。
首先,我检查了是否存在/usr/share/X11/xorg.conf文件,我认为它将优先于/etc/X11/xorg.conf。/usr/share/X11/xorg.conf不存在。
接下来,我尝试完全删除/etc/X11/xorg.conf,然后通过nvidia-设置工具重新创建it文件。和以前一样的行为。
如果我删除了/etc/X11/xorg.conf文件,那么监视器位置就会被交换,这意味着当nvidia-设置xorg.conf文件存在时,由于行为是不同的,所以正在加载配置。
(核选择)我还尝试在一个额外的内部硬盘上安装一个Ubuntu18.04的新副本。和以前一样的行为。
有人知道为什么会这样吗?每当我启动系统时,不得不改变我的显示器轮值是非常烦人的。
发布于 2020-05-18 08:48:43
在您的示例中,使用名为DVI-I-1和DP-4的监视器,临时解决方案是将以下命令设置为启动应用程序:
xrandr --output DP-4 --rotate right --pos 1920x0 --output DVI-I-1 --pos 0x840
但是,我不认为这个解决方案令人满意,因为这应该由Ubuntu和/或Nvidia驱动程序来处理,以便在启动时立即进行配置,而不是等待这个命令运行。
对于有相同问题的人,有两个分辨率相同的Hres x Vres的显示器,左边的监视器是水平的,右边的是垂直的:
xrandr | grep " connected"查找监视器名称现在,让我们假设它们被称为Mon1和Mon2 (在后续命令中用您自己的名称替换)。
Vpos,定义为水平监视器顶部到垂直监视器顶部之间的距离。您可以在下面看到这是这样定义的,因为原点位于左上角。如果您只知道底部的垂直移位Vshift,则可以轻松地计算Vpos为:Vpos = Vres - Hres - Vshift。 0 Hres Hres + Vres
0 -------------------
| |
| |
| |
| Mon2 |
Vpos -----------------------| |
| | Vres x Hres |
| | |
| Mon1 | |
| | |
| Hres x Vres | |
| | |
Vpos+Hres -----------------------| |
^ | |
Vshift | | |
Vres v -------------------mon1和mon2,用监视器水平分辨率替换Hres,用从步骤2计算的数字替换Vpos ):xrandr --output mon2 --rotate right --pos Hresx0 --output mon1 --pos 0xVpos您应该能够很容易地概括为具有不同分辨率或不同对齐度的监视器。
https://askubuntu.com/questions/1116441
复制相似问题