Lenovo Y470,从物理上说,拥有1块集成Intel显卡和1块nVidia GeForce550M独立显卡,平时在Windows7/8下是可以通过nVidia自家的Optimus技术实现无缝热切换技术,使得系统可智能地根据当前环境,或是根据用户需要,来自由选择使用哪一块显卡来运行特定程序。但在Linux环境下,nVidia公司并没有提供这样的技术。于是民间就出现了Bumblebee,来实现与Optimus类似的功能。

----------------------------------------------------------------------------------------------
以下梳理Bumblebee的完整安装与配置过程:
1.首先要检查之前是否装过系统提供的受限驱动,如果已安装需要先卸载
代码:
sudo apt-getpurge nvidia-current
2.需要安装Bumblebee。可通过添加PPA的方式安装Bumblebee Stable。
添加bumblebee的源
代码:
sudoadd-apt-repository ppa:bumblebee/stable
检查加了PPA源后的软件更新:
代码:
sudo apt-getupdate
以nVidia私有驱动安装Bumblebee
代码:
sudo apt-get install bumblebeebumblebee-nvidia
3. 加入Bumblebee组
代码:
sudo usermod -a -G bumblebee$USER
4.可能要用到32位的library所以运行
代码:
sudo apt-get install virtualgl-libs:i386libgl1-mesa-glx:i386 libc6:i386
5. 重启系统。
----------------------------------------------------------------------------------------------
根据Bumblebee的作者解释,Y470/570的用户只做到上述步骤是不够的。
因为内核原因,还需要做一些附加动作。请继续阅读:
Update:there is a hack to fix the real issue that makes the driver andbbswitch module to fail. It has been tested on a Lenovo IdeaPadY570, but it supposed to work for Y470 as well. Please note thatthis hack is by no means a real solution (it's a very ugly one, butit works).
Basically,a wrong ACPI handle is being detected(https://bugzilla.kernel.org/show_bug.cgi?id=42696). The hackoverwrites the detected ACPI handle when the module is loaded. It'srecommended that the module is loaded before bbswitch andbumblebeed loads, otherwise bbswitch won't work.
See theREADME onhttps://github.com/Bumblebee-Project/bbswitch/tree/hack-lenovo fordetails.
以下便是针对Y470和Y570的hackishsolution。原作者要求提醒用户,这是hackishsolution,安装不当可能会损坏机器。请自斟酌。我按部就班做了,机子没事,不过还是要强调一下。
----------------------------------------------------------------------------------------------
6. 安装git
代码:
sudo apt-get installgit
7. 下载原作者(PeterLekensteyn)的hackish版本的bbswitch
代码:
git clonegit://github.com/Bumblebee-Project/bbswitch.git -bhack-lenovo
8.配置bbswitch
代码:
cdbbswitch
mkdir/usr/src/acpi-handle-hack-0.0.1
sudo cp Makefileacpi-handle-hack.c /usr/src/acpi-handle-hack-0.0.1
sudo cpdkms/acpi-handle-hack.conf/usr/src/acpi-handle-hack-0.0.1/dkms.conf
sudo dkms addacpi-handle-hack/0.0.1
sudo dkms buildacpi-handle-hack/0.0.1
sudo dkms installacpi-handle-hack/0.0.1
--------------------------------------------------------------------------------------------------
不过我在执行到最后两句(一个build,一个install)的时候,屏幕的提示和以前在11.10/12.04时的提示不一样了。在旧版本上都是没有报错的。但在13.04上报错。信息如下截图:

看Kernelpreparation unnecessary for thiskernel的字样,我个人认为此处的报错是当前新的内核已不再需要对acpi-handle-hack进行编译了。所以这步的ERROR我选择了忽略。继续向下进行。
--------------------------------------------------------------------------------------------
9.继续执行如下代码:
echo acpi-handle-hack |sudo tee -a /etc/modules
sudo update-initramfs-u
-------------------------------------------------------------------------------------------
原来在11.10/12.04时代,做到此重启系统Bumblebee便已大功告成了。但是在新13.04上,我发现重启后虽然执行了lspci|grep -i vga看到N卡的信息结尾是rev ff,也就是已经成功被屏蔽掉了。但是执行图形化测试(optirunglxspheres)时,总会提示:
[ERROR]Cannot access secondary GPU - error: [XORG] (EE) No devicesdetected.
[ERROR]Aborting because fallback start isdisabled.
即“第2块显卡未找到”。这就奇怪了,为什么会找不到呢?再次到网上查找,看到Ubuntu论坛中“linux小菜菜”的一个帖子(链接地址:http://forum.ubuntu.org.cn/viewtopic.php?p=2955331),也是遇到同样的问题,他的解决方法是将/etc/bumblebee/xorg.conf.nvidia中的BusID配置项取消注释重启后即可。但我如法炮制,发现依然不行。回过头研究了一下他所提到的这个配置文件,里面的注释提醒了我。注释原文如下:
# If the X server does not automatically detectyour VGA device,
# you can manually set ithere.
# To get the BusID prop, run `lspci | grep VGA`and input the data
# as you see in the commentedexample.
# This Setting may be needed in some platformswith more than one
# nvidia card, which may confuse the proprietarydriver (e.g.,
# trying to take ownership of the wrongdevice).
很明显,BusID后面带着的参数并不是固定的,它需要和你的电脑实际情况结合起来,简言之,BusID的参数值是由lspci | grepVGA的查询结果来定的。于是,就需要执行以下后续步骤。
-------------------------------------------------------------------------------------------
10. 执行lspci |grep -ivga,查看当前Y470下所有显卡的参数。
11.
以我的Y470为例,可以看到Intel集显与nVidia独显。这时需要记住nVidia独显对应的最前面的一串数字,即01:00.0。将这个数字修改到刚才上文说的/etc/bumblebee/xorg.conf.nvidia中BusID对应项处。保存退出。
重启系统。我们可以开启两个终端窗口,进行试验。一个窗口首先执行optirunglxspheres,跑3D图形测试,同时再在另一个终端窗口执行第10步中的查询语句,这时可看到N卡的信息结尾从revff变成了rev字母+数字,ff代表的是禁用,字母+数字即为启用。这就证明了当执行了optirun命令时,N卡才会发挥功效。从而达到了控制调用显卡的目的。另外我们也可进行一个对比测试:optirunglxspheres和不加optirun的测试,结果在我的Y470上,性能差立见分晓。开了optirun的效能几乎可达普通的2倍!(下图中左侧靠上的数据是加了optirun参数的,靠下则未加)