For Ubuntu 18.04 users plagued by screen tearing issue while using NVIDIA proprietary drivers, this quick tutorial may help you via enable PRIME Synchronization on Optimus.
Screen tearing usually happens on Ubuntu Linux laptop that uses Prime to switch between NVIDIA and Intel drivers.
1. Open terminal (either via Ctrl+Alt+T or by searching for ‘terminal’ from software launcher) and run command to create a new config file:
sudo gedit /etc/modprobe.d/nvidia-drm-nomodeset.conf
Type your password (no asterisks feedback) when it prompts and hit Enter.
2. When the file opens after running the previous command, add following line and save the file.
options nvidia-drm modeset=1
3. Finally update intramfs and reboot your machine.
sudo update-initramfs -u
To check if previous changes work after reboot, run command:
sudo cat /sys/module/nvidia_drm/parameters/modeset
It should output ‘Y’.
In addition, to get much SMOOTHER Nvidia window dragging experience, you can also do:
1. Set maximum performance in Nvidia X Server Settings -> PowerMizer.
2. If you have MORE than enough RAM, set swap tendency to a MUCH lower value by running command to edit sysctl.conf:
sudo gedit /etc/sysctl.conf
and add following 2 lines when the file opens:
via: ubuntuforums
Life saver – Thank you!!!
Thanks man, that did it for me.
Thank you so much, I tried so many things, nothing worked, this works, praise Jesus and you ma’ man! :D
Thank you for your time making the post it worked great :).
After doing so – PC stopped to boot.
To revert it –
1. Ctrl+Alt+F2
2. Type username, password
3. “sudo nano /etc/modprobe.d/nvidia-drm-nomodeset.conf”
4. remove “options nvidia-drm modeset=1”
5. Ctrl+X to save.
6. “sudo update-initramfs -u”
7. “reboot”
Hey thanks for the support. And I’ve got a question. With this operation, didn’t we lead nvidia card to use much of the CPU resources for basic stuff(Smoothness while scrolling etc.)? By the way I am new to Linux. Thanks.
Doing this removed the screen tearing but I lost the ability to connect to a second monitor (tested via thunderbolt 3 -> DisplayPort.
Is there a way to incorporate your fix and keep multi display functionality?
Yes. replace gdm3 with lightdm. The bug stopping external monitors working with modeset=1 is a gdm3 bug. Not present in lightdm or sddm.
I have no adverse effects from using ligthdm.
sudo apt install lightdm
and make it the default display manager.
You can change defaults, including back to gdm3:
sudo dpkg-reconfigure lightdm
I use ubuntu 19.04 and nvidia 1050Ti – nvidia-driver-418. it’s worked for me. but sometimes screen is freezing.
I have this problem with the same version of ubuntu and same graphic card.