[375.26][Xorg 1.19.1] PRIME with synchronization brakes many OpenGL games (optimus laptop)

TL;DR
Setting nvidia-drm.modeset=1 breaks several games on my laptop.
All games work when nvidia-drm.modeset=1 is not set, but the tearing is awful.

Specs:
Asus ROG GW771JW Laptop with 4th generation Intel i7, Nvidia GTX 960M

OS:
Arch Linux with the default 4.9.6 kernel.

I’ve been struggling with this problem since I moved to a PRIME setup when Xorg 1.19.1 hit Arch Linux repositories. Before that I was using bumblebee and running games with optirun/primusrun worked fine.

Today I really wanted to get to the bottom of this, so I tried running xorg and games with just the integrated gpu again. Sure enough, everything worked.

I had to remove nvidia-drm.modeset=1 because Xorg wouldn’t start with it. I guess it messed with modesetting driver used by the integrated gpu.

After testing that everything worked, I put my PRIME-enabled xorg.conf1 back in place again and rebooted. I had forgotten about nvidia-drm.modeset=1 and started Xorg without it: massive tearing, but the games worked again.

Here’s what I’ve found so far:

Games that don’t work when nvidia-drm.modeset=1 is set:
Starbound, Owlboy, Metro 2033 Redux, Metro: Last Light Redux, Stardew Valley, Axiom Verge

Games not affected by nvidia-drm.modeset:
Neon Chrome, BioShock Infinite, Antichamber, BlazeRush

I did an apitrace on a few of the affected games and looked at the GL calls. They all seemed to segfault on the first frame (Frame 0) when trying to swap buffers.

Strange thing is, Owlboy works if I run it with the 32-bit executable.
Same applies to other affected games with 32-bit executables.

I’m running these from steam with native runtime (STEAM_RUNTIME=0)

Known problem, will be fixed in next driver release.
See: [url]https://devtalk.nvidia.com/default/topic/957814/linux/prime-and-prime-synchronization/post/5069811/#5069811[/url]
You can turn off sync easier:
xrandr --output --set “PRIME Synchronization” 0

I know, and I don’t want to turn sync off because the tearing is unbearable.

Thanks for the link, I should’ve read that thread first.
Good to know the bug is known and is going to be fixed.