https://bugs.winehq.org/show_bug.cgi?id=51420
--- Comment #58 from alecov@mail.com --- I can confirm matt's patch still work in Wine 7.7.
Commit d171d1116764260f4ae272c69b54e5dfd13c6835 makes GetDeviceCaps reprobe devices/xrandr and for some reason GetDeviceCaps is called repeatedly in many cases I've tested (eg. every mouse move in a menu bar triggers it).
It seems making such a reprobe frequently is not good in general since it might cause drivers to disconnect/reconnect devices (cf. https://forums.developer.nvidia.com/t/x-server-with-loaded-nvidia-driver-spa...), so it should be done sparingly, perhaps during Wine boot, or perhaps with a configurable behavior through a reg key.
In this case the external HDMI/DVI connect/disconnect event also introduces a major performance hit. Even without a secondary monitor, my Xorg.0.log grows a couple GBs long due to endless "connected / disconnected" messages from the Nvidia driver.
The real bug (if not a straight Nvidia driver's one) seems to be why GetDeviceCaps is being called so much repeatedly.