使用 Bumblebee 控制 NVIDIA 雙顯卡

簡介

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 / archlinux 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 ff,表示獨顯是開啓的。

 

三、拔下電源適配器,查看功耗

➜  ~  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

 

ubuntu 在安裝過程中會將當前用戶加入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

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

 

➜  ~  optirun glxgears
2284 frames in 5.0 seconds = 456.677 FPS
2358 frames in 5.0 seconds = 471.540 FPS
2275 frames in 5.0 seconds = 454.942 FPS

 

打開N卡設置:

optirun nvidia-settings -c :8

 

tips:

現在i系列的一般都是雙顯卡配置,請勿自行安裝nvidia驅動。雙顯卡的機器,必須停止集成顯卡才能正確安裝nvidia驅動。
不要用root用戶運行,最好是用sudo運行。
如果安裝失敗,可能無法進入任何一個界面,包括文字界面。解決辦法,固定該主機IP,開啓ssh服務,確保可以在局域網的另一臺主機ssh進該主機。之後然後再折騰,如果失敗,ssh進該主機,卸載掉nv的驅動(sudo apt-get autoremove nvidia-current),然後重啓。
雙顯卡臺式機折騰這個的時候注意把顯示器連接到主板的輸出端口上,否則沒用。
安裝好以後 , “系統->系統管理->NVIDIA X Server Settings“ 不要亂動。

有的bios裏可以關掉獨顯,桌面渲染3D等,i卡能夠勝任。(i卡虛擬機裏運行win7無法開啓aero特效)

 

NVIDIA Optimus獨顯集顯切換將支持Linux

http://linux.solidot.org/article.pl?sid=12/09/04/1013238&from=rss

NVIDIA的Optimus技術可讓筆記本根據性能需要在英特爾集成顯卡和NVIDIA獨顯之間自動切換,節省電力。但這項技術不支持Linux。2個多月前,Linux作者Linus Torvalds在芬蘭的一個活動中因此對NVIDIA豎起了中指。現在,NVIDIA工程師透露他們正致力於實現Linux支持。NVIDIA的Aaron Plattner在郵件列表上,他已經在新的Linux版驅動上概念驗證了Optimus,未來Linux筆記本用戶有望獲得Optimus支持。

 

參考:

https://wiki.archlinux.org/index.php/Bumblebee_(%E7%AE%80%E4%BD%93%E4%B8%AD%E6%96%87)

http://blog.csdn.net/linuxzhouying/article/details/7407777

http://forum.ubuntu.org.cn/viewtopic.php?f=126&t=374321&sid=4b44e27e0ae1bd540d11a1375fe246e7

http://forum.ubuntu.org.cn/viewtopic.php?f=42&t=382269

http://forum.ubuntu.org.cn/viewtopic.php?f=42&t=332796

 

原文:http://www.cnblogs.com/congbo/archive/2012/09/12/2682105.html

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章