del_diablo wrote:Don't tell you have not reported this bug yet?
So which side causes the bug?
The kernel drivers for the CPU? (Most likely not)
Nvidia's propitary drivers?
Or is it a spring bug?
Well, I'm not 100% on exactly what's going on. From what I've been able to determine, I believe Spring is at fault. Please note this is not an assertion of fact.
I think its something along the lines of spring and the drivers are both attempting to impose their own pipeline locking. This in turn is increasing delays for spring to submit a new pipeline, which is already locking out other Spring, non-synchronized threads. In other words, even when spring is not synchronizing pipeline access, the driver still attempts to do so by means of internal locking, which is enable when multiple cores/cpus are detected.
I believe the contention comes from various Lua UI threads which are also attempting to use OpenGL for various GUIs and special effects. The combination is mutually exclusive to nvidia's multithreading optimizations and creates lots of uncoordinated locking contention, which results in yet more contention on Spring's side.
By explicitly disabling nvidia's threading optimizations I believe this is reducing lots of lock contention within the driver and therefore reducing the window for contention within Spring and Lua (they wait less time within the driver). Thereby, effectively reducing lock contention within Spring; albeit at the cost of possibly unsynchronized opengl access by other Spring threads. But since the window for trouble has been reduced, the chances of misc. crashes from unsynchronized access (race condition) has also been reduced.
Since I've started using this trick, my self and my brother have seen both huge increases in FPS as well as much fewer Spring crashes. Likewise, I'm now able to use the multithreaded binaries without crashes. The fact I don't see crashes with any other OpenGL games further lends support this is not an nvidia issue.
Lastly,
in this fairly old thread, you can see threading improvements have been in the works for a long time now. And based on both that thread and my own observations, things have steadily been improving in that regard. I suspect when they have everything fixed and properly synchronized within Spring itself, use of this fix will no longer be required. Heck, depending on the details, no longer using this fix may actually slightly benefit performance.