Re: Wine + VSync forced in nvidia-settings doesn't work
And another update on topic: looks like currently Wine uses glXSwapIntervalSGI() with an assumption that in case EXT_swap_control is advertised in GLX extension string this function is being implemented as a forward wrapper calling glXSwapIntervalEXT() to do the real work on current active drawable if any. If that's the case then passing zero to glXSwapIntervalSGI() might disable vsync instead of failing with GLX_BAD_VALUE which had been required by SGI_swap_control extension.
Actually EXT_swap_control specs are not explicitly clear on this topic saying "Calling glXSwapIntervalSGI is equivalent to calling glXSwapIntervalEXT on the current drawable, if one exists". It is unclear from this two sentences whether does this "equivalence" mean that glXSwapIntervalSGI() should accept 0 as swap_interval just like glXSwapIntervalEXT() does.
It looks like that nVIDIA OpenGL implementation acts just like this. It leads to a fact that if an app sets D3DPRESENT_INTERVAL to be IMMEDIATE it results in glXSwapIntervalSGI(0) call which effectively disables vsync with current nVIDIA drivers. While the behavior isn't clearly documented for nvcontrol "SyncToVBlank" attribute it is clearly stated in docs that setting env variable __GL_SYNC_TO_VBLANK to "1" should force swap_interval to be not less than 1. Driver should be fixed in a way that calls to glXSwapIntervalSGI()/glXSwapIntervalEXT() having swap_interval set to "0" should be silently clamped to use "1" instead (or return with an error - there are no specs available for the "force vsync" case to follow).
One wishing to workaround problem for now may try to compile Wine himself after changing one line at dlls/winex11.drv/opengl.c file. It is "else if (!has_swap_control && interval == 0)" condition inside X11DRV_wglSwapIntervalEXT() func that should be changed to "else if (interval == 0)". After this change Wine would not be passing requests to disable vsync to the nVIDIA OpenGL driver.
Last edited by lexa2; 10-20-11 at 02:16 AM.