Screen tearing on optimus laptop with all ubuntu 20.04 flavors (nvidia driver 390.132)

I have a optimus laptop with fermi card (nvidia GT 540M)
On Ubuntu 20.04 with nvidia driver 390.132
Prime synchronization doesn’t work if i put
options nvidia-drm modeset=1
in created conf file:
/etc/modprobe.d/zz-nvidia-fix-tearing.conf

sudo cat /sys/module/nvidia_drm/parameters/modeset show Y
image

Still have an screen tearing problem. PRIME Synchronization doesn’t work.
Here a bug report
nvidia-bug-report.log (569.2 KB)

PRIME sync has not yet been fixed with the 390 driver for kernels >=5.4. You can try the patch for the initial 440 driver that had the same issue. It applies to the 390 driver as well with some fuzz:

If that works, you could open a bug report at Ubuntu’s to include that patch until nvidia releases a fixed 390 driver.

no info about release date?

Nope. Nvidia doesn’t have a fixed release cycle and also doesn’t ever announce anything. Updates for legacy drivers to support new kernels are handled rather lazy, leaving it to distributions to create/include the patches. Only support for new Xservers is a bit more reliable since that obviously can’t be patched by anyone else.

Thanks then. Will try to apply patch if can))

The Ubuntu driver installs the sources in
/usr/src/nvidia-390.132/
so you can patch the dkms sources directly, first get a root shell

sudo -s
cd /usr/src/nvidia-390.132/
patch --dry-run -p2 < /path/to/patch.patch

if no errors show up, you can apply it

patch -p2 < /path/to/patch.patch
dkms install nvidia/390.132 --all

patch applyed, but nothing happen after reboot still tearing((

Did dkms install recompile the modules without error or did it just say “already installed”?
Please try removing and re-adding it:
sudo dkms remove nvidia/390.132 --all
sudo dkms install nvidia/390.132 --all
Furthermore, I suspect the old modules are still in the initrd, so run
sudo update-initramfs -u
afterwards.

Did dkms install recompile the modules without error or did it just say “already installed”?

Well when i use dkms install nvidia/390.132 --all
no prompts/outputs/errors…just nothing

now when i trying to remove :
Error! There are no instances of module: nvidia
390.132 located in the DKMS tree.

Odd. Does

sudo dkms build nvidia/390.132

output any errors?
Does the file

/var/lib/dkms/nvidia/390.132/build/make.log

exist afterwards? If so, please attach.

sudo dkms build nvidia/390.132
Error! Could not locate dkms.conf file.
File: /usr/src/nvidia-390.132/dkms.conf does not exist.

/var/lib/dkms/nvidia/390.132/build/make.log
file doesn’t exist too…

Please post the output of
dkms status

well no prompts too…
image

Then I really wonder how that driver ended up on your harddisk in the first place. Please reinstall the driver
sudo apt install --reinstall nvidia-driver-390
and post the output of
ls -l /usr/src/nvidia-390.132
and
dkms status
afterwards.

image

dkms status doesn’t show anything

Weird. Please install the dkms part manually
sudo apt install nvidia-dkms-390
and post the output of
ls -l /usr/src/nvidia-390.132
and
dkms status
afterwards.

image
dkms status

nvidia, 390.132, 5.4.0-29-generic, x86_64: installed (WARNING! Diff between built and installed module!) (WARNING! Diff between built and installed module!) (WARNING! Diff between built and installed module!)

ok, looks better. Now please check if the patch is still applied:

cd /usr/src/nvidia-390.132/
patch --dry-run -p2 < /path/to/patch.patch

If it then complains about “looks like a reverse patch”, the patch is still applied, then run
sudo dkms --force install nvidia/390.132
dkms status
sudo update-initramfs -u


…reboot and tearing is still here))

does
sudo dkms remove nvidia/390.132
sudo dkms install nvidia/390.132
sudo update-initramfs -u
change anything?