在 Xorg 中设置两个屏幕

在 Xorg 中设置两个屏幕

我有两张 Nvidia 卡,但 Xorg 只激活其中一张。以下配置基于 nvidia 配置器输出:

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

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

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

Section "InputDevice"
    Identifier     "Keyboard0"
    Driver         "keyboard"
EndSection

Section "Monitor"
    Identifier     "Monitor0"
    VendorName     "Unknown"
    ModelName      "HP LE2201w"
    HorizSync       24.0 - 83.0
    VertRefresh     50.0 - 76.0
    Option         "DPMS"
EndSection

Section "Monitor"
    Identifier     "Monitor1"
    VendorName     "Unknown"
    ModelName      "Acer AL2017"
    HorizSync       30.0 - 82.0
    VertRefresh     56.0 - 76.0
    Option         "DPMS"
EndSection

Section "Device"
    Identifier  "Card0"
    Driver      "nvidia"
    VendorName  "nVidia Corporation"
    BoardName   "GeForce 6100 nForce 405"
    BusID       "PCI:0:13:0"
EndSection
Section "Device"
    Identifier  "Card1"
    Driver      "nvidia"
    VendorName  "nVidia Corporation"
    BoardName   "GeForce 8400 GS"
    BusID       "PCI:2:0:0"
EndSection

Section "Screen"
    Identifier     "Screen0"
    Device         "Device0"
    Monitor        "Monitor0"
    DefaultDepth    24
    Option         "TwinView" "0"
    Option         "metamodes" "nvidia-auto-select +0+0"
    SubSection     "Display"
        Depth       24
    EndSubSection
EndSection
Section "Screen"
    Identifier     "Screen1"
    Device         "Device1"
    Monitor        "Monitor1"
    DefaultDepth    24
    Option         "TwinView" "0"
    Option         "metamodes" "nvidia-auto-select +0+0"
    SubSection     "Display"
        Depth       24
    EndSubSection
EndSection

我在日志文件中看到的内容是:

(==) Log file: "/var/log/Xorg.0.log", Time: Fri Mar 19 11:08:08 2010
(==) Using config file: "/etc/X11/xorg.conf"
(==) ServerLayout "Layout0"
(**) |-->Screen "Screen0" (0)
(**) |   |-->Monitor "Monitor0"
(==) No device specified for screen "Screen0".
        Using the first device section listed.
(**) |   |-->Device "Card0"
(**) |-->Screen "Screen1" (1)
(**) |   |-->Monitor "Monitor1"
(==) No device specified for screen "Screen1".
        Using the first device section listed.
(**) |   |-->Device "Card0"
(**) |-->Input Device "Keyboard0"
(**) |-->Input Device "Mouse0"
(**) Option "Xinerama" "0"
(==) Automatically adding devices
(==) Automatically enabling devices

即使后来检测到了两张卡:

(--) PCI:*(0:0:13:0) 10de:03d1:1019:2601 nVidia Corporation C61 [GeForce 6100 nForce 405] rev 162, Mem @ 0xfb000000/16777216, 0xd0000000/268435456, 0xfc000000/16777216, BIOS @ 0x????????/131072
(--) PCI: (0:2:0:0) 10de:0422:0000:0000 nVidia Corporation G86 [GeForce 8400 GS] rev 161, Mem @ 0xf8000000/16777216, 0xe0000000/268435456, 0xf6000000/33554432, I/O @ 0x0000bc00/128, BIOS @ 0x????????/131072
[ --- some more logs --- ]
(II) Mar 19 11:08:10 NVIDIA(0): NVIDIA GPU GeForce 6100 nForce 405 (C61) at PCI:0:13:0
(II) Mar 19 11:08:10 NVIDIA(0):     (GPU-0)
[ --- some more logs --- ]
(II) Mar 19 11:08:12 NVIDIA(GPU-1): NVIDIA GPU GeForce 8400 GS (G86) at PCI:2:0:0 (GPU-1)

不幸的是,后来只有一张卡被初始化,并且只有一个屏幕处于活动状态。Xrandr 也只显示一个屏幕。

关于如何修复它有什么想法吗?

答案1

您的 Screen 部分与您定义的 Device 部分不匹配。在第一个 Screen 部分 (Screen0) 中,Device 选项指向“Device0”——而在第一个 Device 部分中,您将 Identifier 选项设置为“Card0”。Screen 部分需要使用正确的标识符。

您想要的是:

Section "Device"
    Identifier  "Card0"
    ^^^^^^^^^^^^^^^^^^^  this line names this device "Card0"
    [...]
EndSection

Section "Screen"
    Identifier     "Screen0"
    Device         "Card0"
    ^^^^^^^^^^^^^^^^^^^^^^  this line needs to match a device's Identifier
    [...]
EndSection

相关内容