Ubuntu 18.04 after installing NVIDIA graphics drivers still getting lag
OK now i can say this is 95% solved,
∘ 1/ The real problem comes down to Refresh Rate and Sync Rate of the Nvidia card and the screen(s)
‣ With nvidia-prime then there is no possibility of vsync yet - arghhhh
With Nvidia's drivers for linux and"Optimus" cards they left out the simple code to do this to save resources for the masses - STUPID!!!!!
‣ Get PRIME Synchronization on Optimus
Solution (now for none specific Nvidia Drivers - AWESOME!)
To check if it (Synchronization) is set or not set use this command:
sudo cat /sys/module/nvidia_drm/parameters/modeset
∘ It should say "y" for modeset=1, which means it is synchronized at 60 fps (I believe) for your Monitor. ... ex. HDMI-1-1, or eDP-1-1
∘ If Not - Create a new file in /etc/modprobe.d/nvidia-drm-nomodeset.conf
sudo gedit /etc/modprobe.d/nvidia-drm-nomodeset.conf
∘ and make sure the following line is present;
options nvidia-drm modeset=1 ∘ after Update Intramfs and Reboot
sudo update-initramfs -u
• reboot
ALSO reducing Swappiness may help to lower swappiness also (if you have lots of RAM)...
∘ To check the swappiness value (default=60)
$ cat /proc/sys/vm/swappiness
sudo gedit /etc/sysctl.conf
‣ Search for vm.swappiness and change its value as desired. If vm.swappiness does not exist, add it to the end of the file like so:
# sharply reduce Swappiness inclination
vm.swappiness=1