我使用的是 Debian 10 系统,安装了 X.org,LightDM 作为显示管理器,GNOME 作为桌面环境。当我启动 LightDM 时,仅启动一台物理显示器。我有两台显示器,一台内置,由集成英特尔显卡驱动,一台外置 HDMI,由独立 nvidia 显卡驱动。我已经使用 bumblebee/primus 设置了 NVIDIA optimus,因此我可以使用集成英特尔显卡来驱动显示器,同时在独立卡上运行应用程序。当我启动 LightDM 时,X 服务器仅使用内部屏幕,而我的显示器保持待机状态。我需要使用 Xorg 配置文件,尽管不推荐这样做,因为否则 Xorg 将无法检测到我的外部显示器。
/etc/X11/xorg.conf:
Section "ServerLayout"
Identifier "X.org Configured"
Screen 0 "Screen0" 0 0
Screen 1 "Screen1" RightOf "Screen0"
InputDevice "Mouse0" "CorePointer"
InputDevice "Keyboard0" "CoreKeyboard"
EndSection
Section "Files"
ModulePath "/usr/lib/xorg/modules"
FontPath "/usr/share/fonts/X11/misc"
FontPath "/usr/share/fonts/X11/cyrillic"
FontPath "/usr/share/fonts/X11/100dpi/:unscaled"
FontPath "/usr/share/fonts/X11/75dpi/:unscaled"
FontPath "/usr/share/fonts/X11/Type1"
FontPath "/usr/share/fonts/X11/100dpi"
FontPath "/usr/share/fonts/X11/75dpi"
FontPath "built-ins"
EndSection
Section "Module"
Load "glx"
EndSection
Section "InputDevice"
Identifier "Keyboard0"
Driver "kbd"
EndSection
Section "InputDevice"
Identifier "Mouse0"
Driver "mouse"
Option "Protocol" "auto"
Option "Device" "/dev/input/mice"
Option "ZAxisMapping" "4 5 6 7"
EndSection
Section "Monitor"
Identifier "Monitor0"
VendorName "Monitor Vendor"
ModelName "Monitor Model"
EndSection
Section "Monitor"
Identifier "Monitor1"
VendorName "Monitor Vendor"
ModelName "Monitor Model"
EndSection
Section "Device"
### Available Driver options are:-
### Values: <i>: integer, <f>: float, <bool>: "True"/"False",
### <string>: "String", <freq>: "<f> Hz/kHz/MHz",
### <percent>: "<f>%"
### [arg]: arg optional
#Option "Accel" # [<bool>]
#Option "AccelMethod" # <str>
#Option "Backlight" # <str>
#Option "CustomEDID" # <str>
#Option "DRI" # <str>
#Option "Present" # [<bool>]
#Option "ColorKey" # <i>
#Option "VideoKey" # <i>
#Option "Tiling" # [<bool>]
#Option "LinearFramebuffer" # [<bool>]
#Option "HWRotation" # [<bool>]
#Option "VSync" # [<bool>]
#Option "PageFlip" # [<bool>]
#Option "SwapbuffersWait" # [<bool>]
#Option "TripleBuffer" # [<bool>]
#Option "XvPreferOverlay" # [<bool>]
#Option "HotPlug" # [<bool>]
#Option "ReprobeOutputs" # [<bool>]
#Option "XvMC" # [<bool>]
#Option "ZaphodHeads" # <str>
#Option "VirtualHeads" # <i>
#Option "TearFree" # [<bool>]
#Option "PerCrtcPixmaps" # [<bool>]
#Option "FallbackDebug" # [<bool>]
#Option "DebugFlushBatches" # [<bool>]
#Option "DebugFlushCaches" # [<bool>]
#Option "DebugWait" # [<bool>]
#Option "BufferCache" # [<bool>]
Identifier "Card0"
Driver "intel"
BusID "PCI:0:2:0"
EndSection
Section "Device"
### Available Driver options are:-
### Values: <i>: integer, <f>: float, <bool>: "True"/"False"ss,
### <string>: "String", <freq>: "<f> Hz/kHz/MHz",
### <percent>: "<f>%"
### [arg]: arg optional
#Option "SWcursor" # [<bool>]
#Option "HWcursor" # [<bool>]
#Option "NoAccel" # [<bool>]
#Option "ShadowFB" # [<bool>]
#Option "VideoKey" # <i>
#Option "WrappedFB" # [<bool>]
#Option "GLXVBlank" # [<bool>]
#Option "ZaphodHeads" # <str>
#Option "PageFlip" # [<bool>]
#Option "SwapLimit" # <i>
#Option "AsyncUTSDFS" # [<bool>]
#Option "AccelMethod" # <str>
#Option "DRI" # <i>
Identifier "Card1"
Driver "nvidia"
BusID "PCI:1:0:0"
EndSection
Section "Screen"
Identifier "Screen0"
Device "Card0"
Monitor "Monitor0"
SubSection "Display"
Viewport 0 0
Depth 1
EndSubSection
SubSection "Display"
Viewport 0 0
Depth 4
EndSubSection
SubSection "Display"
Viewport 0 0
Depth 8
EndSubSection
SubSection "Display"
Viewport 0 0
Depth 15
EndSubSection
SubSection "Display"
Viewport 0 0
Depth 16
EndSubSection
SubSection "Display"
Viewport 0 0
Depth 24
EndSubSection
EndSection
Section "Screen"
Identifier "Screen1"
Device "Card1"
Monitor "Monitor1"
SubSection "Display"
Viewport 0 0
Depth 1
EndSubSection
SubSection "Display"
Viewport 0 0
Depth 4
EndSubSection
SubSection "Display"
Viewport 0 0
Depth 8
EndSubSection
SubSection "Display"
Viewport 0 0
Depth 15
EndSubSection
SubSection "Display"
Viewport 0 0
Depth 16
EndSubSection
SubSection "Display"
Viewport 0 0
Depth 24
EndSubSection
EndSection
LSPCI | grep NVIDIA 以显示检测到我的显卡:
01:00.0 VGA compatible controller: NVIDIA Corporation Device 1f99 (rev a1)
lsmod | grep nvidia 以显示 nvidia 驱动程序已加载:
nvidia_modeset 1232896 1
nvidia 34164736 18 nvidia_modeset
我的 LightDM 配置文件没有设置 xserver-config 字段,因此它将使用 /etc/X11/xorg.conf
我无法发布整个 X.org 日志,因为它的字符太多。最值得注意的三行是:
[ 9581.561] (II) LoadModule: "nvidia"
[ 9581.562] (WW) Warning, couldn't open module nvidia
[ 9581.562] (EE) Failed to load module "nvidia" (module does not exist, 0)
我有两个问题:
- 为什么 lspci 检测到我的显卡,lsmod 检测到驱动程序,但 Xorg 说驱动程序不存在?
- 我怎样才能让 X.org 检测到驱动程序?
PS:nouveau 驱动程序未加载,并且在 Xorg 配置中未提及,因此它们不应该成为问题。
答案1
我升级到 Debian Rolling Release(不稳定/sid),现在可以使用了。我真的不知道问题是什么,我认为是关于大黄蜂/普里姆斯的问题。升级后,我现在拥有 Xorg 1.20.11,因此我可以原生使用 NVIDIA Optimus。重新安装一个驱动程序+稍后清除,效果很好。