使用Bumblebee控制NVIDIA雙顯卡(ubuntu) 簡介 Nvidia的雙顯卡切換技術叫Optimus(擎天柱),可惜只能在win7、vista下實現。Linux下沒有對應的技術,當然蘋果也沒有。這導致獨立顯卡一直在啟用,顯卡發熱升溫,風扇狂轉,卻沒有正常工作輸入。平時筆記本電池在 Win7 能使用4小時,到了 Ubuntu 兩個小時左右就耗光了。AMD早已經為ATI顯卡開發出Linux下的催化劑,支援A卡與intel集顯之間切換,N卡的使用者只能嘴饞。 Optimus 技術是不依賴於硬體複雜結構的交火顯卡實現。獨立顯卡按需渲染,並傳輸給整合顯卡,整合顯卡則負責顯示功能。當筆記本通過電源供電時,獨立顯卡將關閉,以延長電池壽命。 Bumblebee 試圖類比 Optimus 技術的行為;當需要的時候,使用獨立顯卡進行渲染,不使用的時候則關閉。當前的版本僅支援按需渲染,電源管理功能仍然在開發之中。 測試環境: Acer Aspire 5750GNVIDIA GeForce GT630Mubuntu 12.04 x86_64 一、更新顯卡資訊,否則可能識別出錯 ➜ ~ sudo update-pciids[sudo] password for congbo:Downloaded daily snapshot dated 2012-09-06 03:15:02 二、查看顯卡資訊 更新前: ➜ ~ lspci | grep -i vga00: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 vga00: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/statepresent rate: 2613 mA平均2000左右 四、安裝bumblebee sudo add-apt-repository ppa:bumblebee/stablesudo apt-get updatesudo apt-get install bumblebee bumblebee-nvidia 加入bumblebee組 sudo usermod -a -G bumblebee $USER 不需要手動加入bumblebee組,安裝過程中已經將目前使用者加入bumblebee組,登出或重啟後生效。 ➜ ~ grep congbo /etc/groupadm:x:4:congbocdrom:x:24:congbosudo:x:27:congbodip:x:30:congboplugdev:x:46:congbolpadmin:x:109:congbocongbo:x:1000:sambashare:x:124:congbobumblebee:x:1001:congbo 登出前: ➜ ~ groupscongbo adm cdrom sudo dip plugdev lpadmin sambashare 登出後: ➜ ~ groupscongbo adm cdrom sudo dip plugdev lpadmin sambashare bumblebee bumblebee 版本: ➜ ~ bumblebeed --versionbumblebeed (Bumblebee) 3.0.1Copyright (C) 2011 The Bumblebee ProjectLicense 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 vga00: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/statepresent rate: 1523 mA平均1000左右,2000->1000,風扇以前一直狂轉,現在基本沒動靜。 bumblebee的作用是禁用nvidia獨立顯卡,需要使用獨顯時,使用”optirun 程式名“手動開啟nvidia來運行需要加速的程式,如optirun vmware。 集顯、獨顯分別運行 glxgears 或 glxspheres 測試,以glxgears為例: ➜ ~ glxgearsRunning synchronized to the vertical refresh. The framerate should beapproximately the same as the monitor refresh rate.301 frames in 5.0 seconds = 60.107 FPS300 frames in 5.0 seconds = 59.869 FPS300 frames in 5.0 seconds = 59.856 FPS ➜ ~ optirun glxgears2284 frames in 5.0 seconds = 456.677 FPS2358 frames in 5.0 seconds = 471.540 FPS2275 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特效)