There are some steps you have to do before installing the driver of nvidia for your card.
1. Check if your Ubuntu is running with the dedicated graphic card or internal graphic card.
– System setting -> Details
– Run this command lspci | grep VGA in Terminal to see if your laptop support dual
$ lspci | grep VGA
00:02.0 VGA compatible controller: Intel Corporation 3rd Gen Core processor Graphics Controller (rev 09)
01:00.0 VGA compatible controller: NVIDIA Corporation GK107M [GeForce GT 640M LE] (rev a1)
2. To avoid the loop login after install the nvidia driver. Run these:
$ sudo apt install mokutil
$ sudo mokutil --disable-validation
This problem was caused due to secure boot and EFI_SECURE_BOOT_SIG_ENFORCE in linux kernel 4.4.0-20 and later.
3. Check the latest nvidia driver with this command, pick the one that recommended:
$ sudo ubuntu-drivers devices
[sudo] password for cuongtd:
== /sys/devices/pci0000:00/0000:00:01.0/0000:01:00.0 ==
model : GK107M [GeForce GT 640M LE]
modalias : pci:v000010DEd00000FD3sv0000104Dsd0000909Cbc03sc00i00
vendor : NVIDIA Corporation
driver : nvidia-304 - distro non-free
driver : xserver-xorg-video-nouveau - distro free builtin
driver : nvidia-375 - distro non-free recommended
driver : nvidia-340 - distro non-free
4. See that nvidia-375 is recommended , we install it
$ sudo apt-get install nvidia-375
5. After finish, type this to go to Nvidia setting:
At the tab PRIME Profiles, choose Nvidia and restart the computer, or just login to register the changes.
6. Check the usage of your GPU with this command (or go to nvidia setting to see it)
$ nvidia-settings -q GPUUtilization -q useddedicatedgpumemory
7. To quickly change between Intel and Nvidia profiles, install prime-indicator to have an icon in the task bar
$ sudo add-apt-repository ppa:nilarimogard/webupd8
$ sudo apt-get update
$ sudo apt-get install prime-indicator
This allows changing profile on-fly, however it requires a log-out to make the change.
At the moment, these is what I did, I’ve tried it and the rendering was faster than before, you may try out with the command glxgears to check the FPS:
The results were 60 FPS for Intel card, and 8000 FPS for Nvidia card.