有一个类似问题我一直在 askubuntu 上关注这个答案:https://askubuntu.com/a/1158183/254943。这个解决方案完全符合我的要求。遗憾的是,在最近的更新后,该解决方案停止工作,Xorg 现在又开始使用 nvidia。
- | NVIDIA-SMI 450.66 驱动程序版本:450.66 CUDA 版本:11.0 |
- Linux XXX 5.4.0-48-通用 #52-Ubuntu SMP 2020 年 9 月 10 日星期四 10:58:49 UTC x86_64 x86_64 x86_64 GNU/Linux
- plasmashell 5.18.5 | Qt:5.12.8 | KDE 框架:5.68.0 | kf5-config:1.0
$ cat /usr/share/X11/xorg.conf.d/11-nvidia-prime.conf
# DO NOT EDIT. AUTOMATICALLY GENERATED BY gpu-manager
Section "OutputClass"
Identifier "Nvidia Prime"
MatchDriver "nvidia-drm"
Driver "nvidia"
Option "AllowEmptyInitialConfiguration"
Option "IgnoreDisplayDevices" "CRT"
# Option "PrimaryGPU" "Yes" <<< commented out
ModulePath "/x86_64-linux-gnu/nvidia/xorg"
EndSection
# added
Section "OutputClass"
Identifier "intel"
MatchDriver "i915"
Driver "modesetting"
Option "PrimaryGPU" "yes"
EndSection
我曾尝试自己调试它,但无法修复它。
$ nvidia-smi # shows running process /usr/lib/xorg/Xorg
+-----------------------------------------------------------------------------+
| NVIDIA-SMI 450.66 Driver Version: 450.66 CUDA Version: 11.0 |
|-------------------------------+----------------------+----------------------+
| GPU Name Persistence-M| Bus-Id Disp.A | Volatile Uncorr. ECC |
| Fan Temp Perf Pwr:Usage/Cap| Memory-Usage | GPU-Util Compute M. |
| | | MIG M. |
|===============================+======================+======================|
| 0 GeForce GTX 105... Off | 00000000:01:00.0 Off | N/A |
| N/A 50C P8 N/A / N/A | 6MiB / 4040MiB | 0% Default |
| | | N/A |
+-------------------------------+----------------------+----------------------+
+-----------------------------------------------------------------------------+
| Processes: |
| GPU GI CI PID Type Process name GPU Memory |
| ID ID Usage |
|=============================================================================|
| 0 N/A N/A 1257 G /usr/lib/xorg/Xorg 4MiB |
+-----------------------------------------------------------------------------+
答案1
我想已经搞清楚了。首先,我删除了 10-nvidia.conf 文件。相反,我添加了 10-intel.conf。然后,我注释掉了 11-nvidia-prime.conf 的每一行,它基本上是一个空文件。由于此文件在每次启动/停止 xserver 时都会创建/覆盖,因此需要使用chattr +i
$ pwd
/usr/share/X11
$ ls -l xorg.conf.d/
total 36K
drwxr-xr-x 2 root root 4.0K Okt 20 20:15 .
drwxr-xr-x 6 root root 4.0K Okt 20 18:12 ..
-rw-r--r-- 1 root root 92 Okt 22 2019 10-amdgpu.conf
-rw-r--r-- 1 root root 327 Okt 20 18:10 10-intel-only.conf
-rw-r--r-- 1 root root 1.4K Sep 4 15:34 10-quirks.conf
-rw-r--r-- 1 root root 92 Okt 22 2019 10-radeon.conf
-rw-r--r-- 1 root root 341 Okt 20 20:15 11-nvidia-prime.conf
-rw-r--r-- 1 root root 1.5K Mai 30 15:34 40-libinput.conf
-rw-r--r-- 1 root root 3.4K Mär 11 2020 70-wacom.conf
ls -l bak.xorg/
drwxr-xr-x 2 root root 4.0K Okt 20 20:08 .
drwxr-xr-x 6 root root 4.0K Okt 20 18:12 ..
-rw-r--r-- 1 root root 206 Okt 5 11:19 10-nvidia.conf
-rw-r--r-- 1 root root 333 Okt 20 20:08 11-nvidia-prime.conf
$ cat xorg.conf.d/10-intel-only.conf
Section "ServerLayout"
Identifier "Layout0"
Option "AutoAddGPU" "false"
Screen 0 "IntelScreen"
EndSection
Section "Device"
Identifier "IntelDevice"
BusID "PCI:0:2:0"
Driver "intel" # or maybe "modesetting"?
EndSection
Section "Screen"
Identifier "IntelScreen"
Device "IntelDevice"
EndSection