Stop Screen Tearing with Optimus Laptops using Nvidia Drivers in Linux (Including Ubuntu 18.04)
Is screen tearing while using Nvidia drivers in Linux driving you nuts? Do you have an Optimus laptop? I believe we may have a solution for you!
I experienced this issue for quite some time before finally finding a fix. This would happen in Ubuntu Mate, Ubuntu and similar distributions where Prime was used as a method to switch between Nvidia and Intel drivers.
Typically on the Intel side of things, everything was fine but as soon as I switched to using my Nvidia driver, all hell would break loose. That was, until I found this solution buried in the Ubuntu forums.
In terminal –
sudo nano /etc/modprobe.d/zz-nvidia-modeset.conf
options nvidia_375_drm modeset=1
Updated for Ubuntu 18.04: I took me a while to find this but if you are using Ubuntu 18.04 or any of it's derivatives and finding the above does not work, it's because prime synchronization does not require the driver number. The proper command should be:
options nvidia_drm modeset=1
Save and exit nano
sudo update-initramfs -u
Reboot and keep your fingers crossed. If all goes well, things should be fixed.
Let me know if this works for you or if you have another workaround that has been successul.