使用 Bumblebee 控制 NVIDIA 双显卡(Ubuntu)

Nvidia的双显卡切换技术叫Optimus(擎天柱),可惜只能在win7、vista下实现。Linux下没有对应的技术,当然苹果也没有。这导致独立显卡一直在启用,显卡发热升温,风扇狂转,却没有正常工作输入。平时笔记本电池在 Win7 能使用4小时,到了 Ubuntu 两个小时左右就耗光了。AMD早已经为ATI显卡开发出Linux下的催化剂,支持A卡与intel集显之间切换,N卡的用户只能嘴馋。

Optimus 技术是不依赖于硬件复杂结构的交火显卡实现。独立显卡按需渲染,并传输给集成显卡,集成显卡则负责显示功能。当笔记本通过电源供电时,独立显卡将关闭,以延长电池寿命。

Bumblebee 试图模拟 Optimus 技术的行为;当需要的时候,使用独立显卡进行渲染,不使用的时候则关闭。当前的版本仅支持按需渲染,电源管理功能仍然在开发之中。

测试环境:

Acer Aspire 5750G
NVIDIA GeForce GT630M
ubuntu 12.04 x86_64

一、更新显卡信息,非常重要,否则可能识别出错

➜  ~  sudo update-pciids
[sudo] password for congbo:
Downloaded daily snapshot dated 2012-09-06 03:15:02

二、查看显卡信息

更新前:

➜  ~  lspci | grep -i vga
00:02.0 VGA compatible controller: Intel Corporation 2nd Generation Core Processor Family Integrated Graphics Controller (rev 09)
01:00.0 VGA compatible controller: NVIDIA Corporation Device 0de9 (rev a1)
更新后:

➜  ~  lspci | grep -i vga
00:02.0 VGA compatible controller: Intel Corporation 2nd Generation Core Processor Family Integrated Graphics Controller (rev 09)
01:00.0 VGA compatible controller: NVIDIA Corporation GeForce GT 630M (rev a1)
更新后正确识别出了显卡型号。

Nvidia 卡信息的末尾是 rev a1,表示独显已经关闭。

三、拔下电源适配器,查看功耗

➜  ~  grep rate /proc/acpi/battery/BAT0/state
present rate:            2613 mA
平均2000左右

四、安装bumblebee

sudo add-apt-repository ppa:bumblebee/stable
sudo apt-get update
sudo apt-get install bumblebee bumblebee-nvidia

加入bumblebee组

sudo usermod -a -G bumblebee $USER

不需要手动加入bumblebee组,安装过程中已经将当前用户加入bumblebee组,注销或重启后生效。

➜ ~ grep congbo /etc/group adm:x:4:congbo cdrom:x:24:congbo sudo:x:27:congbo dip:x:30:congbo plugdev:x:46:congbo lpadmin:x:109:congbo congbo:x:1000: sambashare:x:124:congbo bumblebee:x:1001:congbo

注销前:

➜  ~  groups
congbo adm cdrom sudo dip plugdev lpadmin sambashare

注销后:

➜  ~  groups
congbo adm cdrom sudo dip plugdev lpadmin sambashare bumblebee

bumblebee 版本:

➜ ~ bumblebeed --version bumblebeed (Bumblebee) 3.0.1 Copyright (C) 2011 The Bumblebee Project License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>. This is free software: you are free to change and redistribute it. There is NO WARRANTY, to the extent permitted by law.

五、测试效果

➜ ~ lspci| grep -i vga 00:02.0 VGA compatible controller: Intel Corporation 2nd Generation Core Processor Family Integrated Graphics Controller (rev 09) 01:00.0 VGA compatible controller: NVIDIA Corporation GeForce GT 630M (rev ff)

Nvidia 卡信息的末尾是 rev ff,表示独显已经关闭。

再次拔下电源适配器,查看功耗。

➜ ~ grep rate /proc/acpi/battery/BAT0/state present rate: 1523 mA

平均1000左右,2000->1000,风扇以前一直狂转,现在基本没动静。

bumblebee的作用是禁用nvidia独立显卡,需要使用独显时,使用”optirun 程序名“手动开启nvidia来运行需要加速的程序,如optirun vmware。

集显、独显分别运行 glxgears 或 glxspheres 测试,以glxgears为例:

➜ ~ glxgears Running synchronized to the vertical refresh. The framerate should be approximately the same as the monitor refresh rate. 301 frames in 5.0 seconds = 60.107 FPS 300 frames in 5.0 seconds = 59.869 FPS 300 frames in 5.0 seconds = 59.856 FPS

内容版权声明:除非注明,否则皆为本站原创文章。

转载注明出处:https://www.heiqu.com/21004.html