Nvidia's Sync to Vblanks causing 100% cpu usage with some compositors (Xfwm, Compton and Budgie)

I don’t know how far back this stretches, but I am using 370.28. My video card is a GTX 970

Problem: When dragging windows around or resizing them, CPU usage spikes to 100%. With certain combinations of compositor vsync and Nvidia sync to vblanks, it can be fixed… but doing this forces you to deal with tearing on the desktop.

This is happening with Xfwm, Compton and Budgie’s custom compositor. Which is why I think it is more related to an issue with the Nvidia driver, rather than a bug that happens to be present in 3 different compositors. I have tested this both on Mint Xfce and with Solus Linux… same issue.

Here is what I discovered in my testing, at least with Compton on Mint Xfce. When I refer to lag, I’m talking about the CPU spike.

There are two scenarios that will fix this problem, but tearing occurs. The order in which you do these things does matter.

Disable Nvidia "Sync to VBlank", then `compton --backend glx` = <b>NO LAG + tearing</b>
Disable Nvidia "Sync to VBlank", then `compton --backend glx --vsync opengl-swc` = LAG
Disable Nvidia "Sync to VBlank", then `compton --backend glx --vsync opengl` = <b>NO LAG + tearing</b>
Enable Nvidia  "Sync to VBlank", then `compton --backend glx` = LAG
Enable Nvidia  "Sync to VBlank", then `compton --backend glx --vsync opengl-swc` = LAG
Enable Nvidia  "Sync to VBlank", then `compton --backend glx --vsync opengl` = LAG

Here is a screenshot taken while actively dragging a window around, you can see the spike.

Let me know if any more info is needed.

I found this unresolved post from way back in 2007 that I think may be related in some way. Though I don’t believe it was ever Ubuntu’s problem specifically.
https://bugs.launchpad.net/ubuntu/+bug/139107