Thanks to team at NCSU, they updated bumblebee project that can work on Thinkpad P51. After a small tweak, multiple monitors work on it.
First, should switch to text UI because nvidia should be compiled with kernel
sudo init 3
Then, login with your username.
sudo rpm -ivh https://linux.itecs.ncsu.edu/redhat/public/bumblebee/rhel7/noarch/bumblebee-release-1.3-1.noarch.rpm sudo rpm -ivh https://linux.itecs.ncsu.edu/redhat/public/bumblebee-nonfree/rhel7/noarch/bumblebee-nonfree-release-1.3-1.noarch.rpm sudo yum install bumblebee-nvidia bbswitch-dkms primus kernel-devel
Now, check if nvidia module was compiled correctly
sudo bumblebee-nvidia -check
IF it was not compiled correctly, it will be compiled automatically.
Now, you can use the discrete graphic card without much effort.
optirun glxgears # test optirun command # run command with the discrete graphic card
However, many guys want to use more monitors, try this for dual monitors:
yum install intel-gpu-tools
At this time, intel-virtual-output does not detect displays, or if a no VIRTUAL outputs on “:0” message is obtained, edit the following two files as follows (and rebooting):
Section "Device" # This file does not exist by default Identifier "intelgpu0" Driver "intel" EndSection
Section "ServerLayout" Identifier "Layout0" Option "AutoAddDevices" "true" # Bumblebee defaults to false Option "AutoAddGPU" "false" EndSection Section "Device" Identifier "DiscreteNvidia" Driver "nvidia" VendorName "NVIDIA Corporation" Option "ProbeAllGpus" "false" Option "NoLogo" "true" Option "UseEDID" "true" # Bumblebee defaults to false Option "AllowEmptyInitialConfiguration" # Add this line # Option "UseDisplayDevice" "none" # Remove or comment out this line EndSection Section "Screen" # Add this section Identifier "Screen0" Device "DiscreteNvidia" EndSection
Once you reboot to graphic mode, you can try dual monitors, as
intel-virtual-output # extend desktop to a HDMI-port monitor, light it optirun command # run command on the discrete graphic card
If you run kernel 5.5.6-2, try the unmanaged version of bumblebee-nvidia, which is best for you.