我已经在 Ubuntu 20.04.5 上安装了 steam,并且我只想在游戏中使用专用 GPU,而不是 UHD Graphics 620。我尝试的游戏(例如 Tropico 6)将 Intel UHD GPU 作为主要 GPU。
我在操作系统的信息上看到了 NVIDIA GPU,但是运行某些命令(例如nvidia-settings
或nvidia-xconfig
)时出现一些问题。
$ lshw -short | grep -i display WARNING: you should run this program as super-user. WARNING: output may be incomplete or inaccurate, you should run this program as super-user. /0/100/2
display UHD Graphics 620 (Whiskey Lake) /0/100/1c.4/0
display GP108M [GeForce MX150]
$ lspci -nn | grep -E 'VGA|Display' 00:02.0 VGA compatible controller [0300]: Intel Corporation UHD Graphics 620 (Whiskey Lake) [8086:3ea0]
此命令不执行任何操作:
$ sudo nvidia-xconfig
WARNING: Unable to locate/open X configuration file.
Package xorg-server was not found in the pkg-config search path. Perhaps you should add the directory containing `xorg-server.pc' to the PKG_CONFIG_PATH environment variable No package 'xorg-server' found New X configuration file written to '/etc/X11/xorg.conf'
使用时sudo nvidia-settings
出现以下错误:
(nvidia-settings:4655): GLib-GObject-CRITICAL **: 11:28:24.506: g_object_unref: assertion 'G_IS_OBJECT (object)' failed
ERROR: nvidia-settings could not find the registry key file or the X server is not accessible. This file should have been installed along with this driver at /usr/share/nvidia/nvidia-application-profiles-key-documentation. The application profiles will continue to work, but values cannot be prepopulated or validated, and will not be listed in the help text. Please see the README for possible values and descriptions.
以下是我使用的操作系统信息和驱动程序的屏幕截图:
我能做些什么?
答案1
具有两个 GPU(例如 Intel 和 Nvidia)的笔记本电脑通常使用混合设置,因此 Nvidia GPU 负责显示设置,而 Intel GPU 负责输出显示。最近,Ubuntu 版本似乎混淆了哪个 GPU 负责什么。“默认”GPU 会根据设置而改变,突然间,游戏无法再在 Intel GPU 上运行。您可以通过以下方式查看 GPU 关联:
xrandr --listproviders
当您将电源选项从“性能”(默认选择 Nvidia GPU)更改为“平衡”(默认选择 Intel)时,默认值(0 GPU?)会发生变化。只需为电源选项选择“性能”即可。
为了在不改变电源选项的情况下运行程序,您可以在程序前面添加:
__NV_PRIME_RENDER_OFFLOAD=1 __GLX_VENDOR_LIBRARY_NAME=nvidia <progtorun>
这将切换 GPU 的分配,以便它们按照应有的方式使用。