Lenovo ThinkPad W541
The W541 is a workstation laptop based on the Intel Haswell architecture which has an Nvidia GK106GLM (Quadro K2100M) discrete card configured via Optimus.
This architecture poses some challenges within Linux. In the Windows world Nvidia handles all complexities of both adapters, in Linux the herculean effort of the Bumblebee project allows you to tackle the complex topology and have a usable system.
When Optimus hit the market it was originally implemented on systems via a a method referred to as hwmux. This was a hardware switching system that allowed users to turn on/off the dGPU within the BIOS. Later implementations removed this control interface and now within Linux the dGPU is toggled on/off with acpi calls (bbswitch).
This topology has both an integrated (iGPU) and a discrete (dGPU). The external connectors on the laptop are wired to either the iGPU or dGPU, so its important that Linux is able to use both adapters.
!!!Possibly all connected to iGPU? and the dGPU writes to the iGPU framebuffer?
In the bios you have the choice of standard and advanced modes.
ThinkPad W540, W541 (Standard Mode) Intel HD Graphics + (Computer's LCD) + Computer's analog VGA connector + Computer's DisplayPort connector + Docking Station's analog VGA connector + Docking Station's DVI connector(s) + Docking Station's DisplayPort connector(s) + Docking Station's HDMI connector NVIDIA Quadro K2100M or NVIDIA Quadro K1100M + No display is connected to this display adapter. ThinkPad W540, W541 (Advanced Mode) Intel HD Graphics Family + (Computer's LCD) + Computer's analog VGA connector + Computer's DisplayPort connector NVIDIA Quadro K2100M or NVIDIA Quadro K1100M + Docking Station's analog VGA connector + Docking Station's DVI connector(s) + Docking Station's DisplayPort connector(s) + Docking Station's HDMI connector In Standard mode, all dock displays uses Integrated Graphics as display output and is limited to a maximum of 3 displays including Computer's LCD. While in Advanced mode, all dock displays uses Discrete Graphics as display output and it increases the maximum number of displays to 6 including Computer's LCD. The procedure below allows user to select "Standard mode" or "Advanced mode" 1. Power off the computer. 2. Power on the computer. 3. While the "To interrupt normal startup, press Enter" message is displayed at the lower-left area or lower-center area of the screen, press the F1 key. The ThinkPad Setup menu will be displayed. 4. Choose "Config" then "Display" to show the menu. 5. Select "Video Mode on Dock" and press Enter. 6. Select "Standard" or "Advanced" for your preference. 7. Press F10 key and select "Yes" to save and exit from Setup menu. Then the computer is restarted.
There are a couple options now days as this technology has been around for a while:
Free drivers for iGPU/dGPU Support isnt great within nouveau for the newer Nvidia dGPU(s). This is primarily due to Nvidia being bastards with their documentation privacy. Free driver for iGPU binary Seems like the only route for modern dGPU(s). The driver for dGPU performance on the binary driver far surpasses the free driver.
Table: Linux approaches with Optimus
There is some general concern over using systems with these topologies due to the upcoming adoption of Wayland. Nvidia has taken a negative posture towards Wayland. It will likely be a long time before X11 is completely removed from the display subsystem, but its safe to say that Intel has taken a posture of supporting Wayland and Nvidia is not.
This laptop is a total power pig, disable everything in the bios that you don't absolutely need. The other required bios change is to turn off secure boot. This will eventually prevent you from loading the nvidia kernel module. If you forget to do this you will see:
modprobe: ERROR: could not insert 'bbswitchc': Required key not available
This documentation will be for Fedora 21, however all of these steps were tested on Fedora 22. The Bumblebee project has been packaging for Fedora 22 to make this testing possible. On Fedora 22 there are issues with the selinux policies that have not been addressed in relation to Bumblebee.
When first booting the media, you need to modify the kernel boot parameters (hit e when you see the list of boot prompts). To get reasonable graphics for installation we will use the Intel Haswell adapter and ask nouveau to turn off the dGPU via vgaswitcheroo. Add this parameter to the end of your kernel boot string:
This will allow nouveau to turn off the graphics adapter, you can check to see if it was effective by:
Documentation for this method can be found here
An alternative parameter that can be used is:
which will allow the Intel Haswell to work during your installation (Graphics will be acceptable), however your dGPU will be running the entire time.
Perform you installation as you would. I'm going to assume you're using btrfs, which will impact a parameter that we implement in TLP later on.
yum install -y libbsd-devel libbsd glibc-devel libX11-devel help2man autoconf git tar glib2 glib2-devel kernel-devel kernel-headers automake gcc gtk2-devel VirtualGL
Install both the bumblebee and bumblebee-nonfree repositories:
yum -y install http://install.linux.ncsu.edu/pub/yum/itecs/public/bumblebee/fedora23/noarch/bumblebee-release-1.2-1.noarch.rpm yum -y install http://install.linux.ncsu.edu/pub/yum/itecs/public/bumblebee-nonfree/fedora23/noarch/bumblebee-nonfree-release-1.2-1.noarch.rpm
Install bumblebee, bbswitch, and bumblebee-nvidia:
yum -y install bbswitch bumblebee bumblebee-nvidia
Now, with the W541 (and ThinkPads in general) we have to add a kernel boot parameter to allow for the acpi calls to turn the dGPU on and off. Edit the /etc/default/grub and add this to the end of your kernel string:
This is for modern kernels (> 3.15), in the case of older systems (not Fedora 21) the string "!Windows 2012" should be used. Documentation for this boot paramter can be found here
To have this parameter take effect you need to regen the grub configuration
grub2-mkconfig -o /boot/efi/EFI/fedora/grub.cfg
Almost all of this installation difficulty can be found to be documented at the Bumblebee issue page.
Pretty basic, use optirun (or install primus and use primus) to run applications that you want to pass over to your dGPU. The thing is, when this occurs there is another X11 subsystem activated (Xorg.8). Any hardware that you need to have access within the dGPU managed interface will need to be enumerated within that separate X11 configuration.
Once the dGPU is able to be disabled there are other possible methods to reclaim running power. TLP is documented well in the Arch wiki. We'll be installing both tlp and tlp-rdw which handles the wireless interfaces when docking/undocking and when ethernet is connected/disconnected.
sudo -y install tlp tlp-rdw
The configuration for tlp is located in /etc/default/tlp and we will make the following changes:
SATA_LINKPWR_ON_BAT=max_performance # for btrfs to avoid corruption DISK_APM_LEVEL_ON_BAT="254 254" # with ssd we don't need spindown BAY_POWEROFF_ON_BAT=1 # rarely use dvdrom on battery DEVICES_TO_DISABLE_ON_LAN_CONNECT="wifi" # turn off wifi when ethernet is plugged in DEVICES_TO_ENABLE_ON_LAN_DISCONNECT="wifi" # tun on wifi when ethernet is unplugged
Remarks on Power
With all of this, the power is still pretty bad on this system. The T540p with a purely Intel Haswell iGPU gets around 6 hours of battery life without TLP even installed. The W541 with all of these tweaks might be able to eek out 3.5-4 hours.