我有一台装有 Ubuntu 15.04 和 Nvidia 显卡 GT840M 的笔记本电脑。我以如下方式安装了视频驱动程序:
sudo apt-get purge nvidia*
sudo add-apt-repository ppa:ubuntu-x-swat/x-updates
sudo apt-get update
sudo apt-get install nvidia-340
sudo apt-get install nvidia-settings
sudo nvidia-xconfig
之后我安装了 bumblebee 和 primus
sudo apt-get install bumblebee
sudo apt-get install bbswitch-dkms
sudo apt-get install primus
sudo systemctl enable bumblebeed
我/etc/modules-load.d/modules.conf
添加了几行
i915
bbswitch
我/etc/modprobe.d/nouveau.conf
添加了一行
blacklist nouveau
几乎一切都运行正常。在 nvidia-settings ( sudo gksu nvidia-settings
) 中,我选择了要使用的 CPU Intel (power saving mode)
,并且我的独立显卡默认处于关闭状态(正如我所希望的那样,因为我需要在大学使用笔记本电脑,而那里没有很多插座可以给它充电,并且打开显卡会消耗大量电量)。当我启动 PC 并输入时,lspci -v
我收到一条消息
03:00.0 3D controller: NVIDIA Corporation GM108M [GeForce 840M] (rev ff) (prog-if ff)
!!! Unknown header type 7f
这表明我的卡已被关闭——现在一切正常。
The problem is
当我尝试使用我的卡时,例如,primusrun firefox
它会打开,当我停止 Firefox 时,它不会关闭。所以我一直开着,耗电很多。关闭它的唯一方法是
# echo OFF > /proc/acpi/bbswitch
但我不想每次使用它时都这样做。如何才能自动完成?
这个问题只在我开始使用 Ubuntu 15.04 时出现过。在此之前(我使用的是 Ubuntu 14.10),它运行正常。
答案1
我发现编辑 /etc/bumblebee/bumblebee.conf 以匹配您安装的驱动程序。您的文件应该看起来像您当前的配置。配置完成后,它将在使用命令时自动启用并工作primusrun
,退出程序后它将关闭。
# Configuration file for Bumblebee. Values should **not** be put between quotes
## Server options. Any change made in this section will need a server restart
# to take effect.
[bumblebeed]
# The secondary Xorg server DISPLAY number
VirtualDisplay=:8
# Should the unused Xorg server be kept running? Set this to true if waiting
# for X to be ready is too long and don't need power management at all.
KeepUnusedXServer=false
# The name of the Bumbleblee server group name (GID name)
ServerGroup=bumblebee
# Card power state at exit. Set to false if the card shoud be ON when Bumblebee
# server exits.
TurnCardOffAtExit=false
# The default behavior of '-f' option on optirun. If set to "true", '-f' will
# be ignored.
NoEcoModeOverride=false
# The Driver used by Bumblebee server. If this value is not set (or empty),
# auto-detection is performed. The available drivers are nvidia and nouveau
# (See also the driver-specific sections below)
Driver=nvidia
# Directory with a dummy config file to pass as a -configdir to secondary X
XorgConfDir=/etc/bumblebee/xorg.conf.d
## Client options. Will take effect on the next optirun executed.
[optirun]
# Acceleration/ rendering bridge, possible values are auto, virtualgl and
# primus.
Bridge=auto
# The method used for VirtualGL to transport frames between X servers.
# Possible values are proxy, jpeg, rgb, xv and yuv.
VGLTransport=proxy
# List of paths which are searched for the primus libGL.so.1 when using
# the primus bridge
PrimusLibraryPath=/usr/lib/x86_64-linux-gnu/primus:/usr/lib/i386-linux-gnu/primus
# Should the program run under optirun even if Bumblebee server or nvidia card
# is not available?
AllowFallbackToIGC=false
# Driver-specific settings are grouped under [driver-NAME]. The sections are
# parsed if the Driver setting in [bumblebeed] is set to NAME (or if auto-
# detection resolves to NAME).
# PMMethod: method to use for saving power by disabling the nvidia card, valid
# values are: auto - automatically detect which PM method to use
# bbswitch - new in BB 3, recommended if available
# switcheroo - vga_switcheroo method, use at your own risk
# none - disable PM completely
# https://github.com/Bumblebee-Project/Bumblebee/wiki/Comparison-of-PM-methods
## Section with nvidia driver specific options, only parsed if Driver=nvidia
[driver-nvidia]
# Module name to load, defaults to Driver if empty or unset
KernelDriver=nvidia-340
PMMethod=auto
# colon-separated path to the nvidia libraries
LibraryPath=/usr/lib/nvidia-340:/usr/lib32/nvidia-340
# comma-separated path of the directory containing nvidia_drv.so and the
# default Xorg modules path
XorgModulePath=/usr/lib/nvidia-340/xorg,/usr/lib/xorg/modules
XorgConfFile=/etc/bumblebee/xorg.conf.nvidia
## Section with nouveau driver specific options, only parsed if Driver=nouveau
[driver-nouveau]
KernelDriver=nouveau
PMMethod=auto
XorgConfFile=/etc/bumblebee/xorg.conf.nouveau
答案2
我不知道如何“自动”执行此操作,但您可以尝试将 shellscript 放在桌面上,然后在每次关闭正在使用的程序时运行它。这不一定是您想要的,但至少是一种临时的、不太繁琐的解决方案。