Go Back   nV News Forums > Linux Support Forums > NVIDIA Linux

Newegg Daily Deals

Reply
 
Thread Tools
Old 12-12-11, 08:23 PM   #25
lexa2
Registered User
 
Join Date: Jul 2011
Location: Moscow, Russian Federation
Posts: 58
Send a message via ICQ to lexa2 Send a message via Skype™ to lexa2
Default Re: Wine + VSync forced in nvidia-settings doesn't work

Aaron, thanks for keeping us informed on the progress.
lexa2 is offline   Reply With Quote
Old 03-14-12, 07:49 PM   #26
lexa2
Registered User
 
Join Date: Jul 2011
Location: Moscow, Russian Federation
Posts: 58
Send a message via ICQ to lexa2 Send a message via Skype™ to lexa2
Default Re: Wine + VSync forced in nvidia-settings doesn't work

Aaron, hello once again. Any progress on fixing bug #839481?

BTW, after thinking about this bug a bit I can state that the opposite feature is also required. I mean, there should be a way to force-disable VSYNC through the drivers. I came to this conclusion after running onto a buggy app that always created D3D context with D3DPRESENT_INTERVAL_DEFAULT, which essentially translates into always enabled vsync by default, either when running native on windows or under wine on linux. On Windows I can use driver CP and/or registry settings to force-disable VSYNC no matter the apps request D3D to use, while on linux I have to patch Wine sources in order to achieve the same behaviour. Having a setting of such kind implemented in linux GPU driver would be very welcome.
lexa2 is offline   Reply With Quote
Old 03-15-12, 10:04 AM   #27
brebs
Registered User
 
Join Date: Jul 2007
Posts: 38
Default Re: Wine + VSync forced in nvidia-settings doesn't work

Quote:
Originally Posted by lexa2 View Post
patch Wine sources
Could you post your patch, please?

I can't be the only Linux games-in-Wine-player who hates not being able to force vsync on

E.g., wine 1.3.28 was the last version in which vsync could be forced on, in Thief 1.
brebs is offline   Reply With Quote
Old 03-15-12, 11:09 AM   #28
lexa2
Registered User
 
Join Date: Jul 2011
Location: Moscow, Russian Federation
Posts: 58
Send a message via ICQ to lexa2 Send a message via Skype™ to lexa2
Default Re: Wine + VSync forced in nvidia-settings doesn't work

Quote:
Originally Posted by brebs View Post
Could you post your patch, please?
It's a trivial one, really. Here is what I use to disable vsync control in wine-1.4+ (this patch should also apply to 1.3.28+ series, but likelly with a bit of fuzz):

Code:
diff --git a/dlls/wined3d/context.c b/dlls/wined3d/context.c
index fe26549..a7ed93b 100644
--- a/dlls/wined3d/context.c
+++ b/dlls/wined3d/context.c
@@ -1464,7 +1464,7 @@ struct wined3d_context *context_create(struct wined3d_swapchain *swapchain,
             swap_interval = 1;
     }

-    if (gl_info->supported[WGL_EXT_SWAP_CONTROL])
+    if (FALSE && gl_info->supported[WGL_EXT_SWAP_CONTROL])
     {
         if (!GL_EXTCALL(wglSwapIntervalEXT(swap_interval)))
             ERR("wglSwapIntervalEXT failed to set swap interval %d for context %p, last error %#x\n",
With this patch in place you would essentially get vsync controlled by nVIDIA driver CP and not by wine and/or app running under it. If you want to force vsync ON for all Wine apps - don't apply the patch above, but rather just open wined3d/context.dll in your favorite text editor, head on to line 1469 and add "swap_interval = 1;" right before the line which calls wglSwapIntervalExt(). To force-disable vsync for Wine apps do just the same, but insert "swap_interval = 0;" instead.

Quote:
Originally Posted by brebs View Post
I can't be the only Linux games-in-Wine-player who hates not being able to force vsync on
IMO the ability to control vsync system-wide by changing settings in driver CP is a must-have feature. It should be possible not only to force-enable vsync, but also to force-disable it. nVIDIA linux drivers leave us wishing for more in this regard. Sure, it can't be totally guaranted: if an app renders to an FBO and then maps its contents, reads em and directly memcpy() them to the framebuffer shadow memory region - there's nothing we can do about. But the chances that one would hit such an app are about zero, because almost every displaying app would end up showing its graphics on screen using "swap buffer" technique, either directly or using desktop compositing manager as a displaying proxy.
lexa2 is offline   Reply With Quote
Old 03-15-12, 02:01 PM   #29
AaronP
NVIDIA Corporation
 
AaronP's Avatar
 
Join Date: Mar 2005
Posts: 2,487
Default Re: Wine + VSync forced in nvidia-settings doesn't work

The bug (to fix the environment variable and control panel settings to override app control instead of the other way around) is still open.
AaronP is offline   Reply With Quote
Old 03-16-12, 05:58 PM   #30
brebs
Registered User
 
Join Date: Jul 2007
Posts: 38
Smile Re: Wine + VSync forced in nvidia-settings doesn't work

This patch seems to work, to force vsync on in wine 1.4
Code:
diff -Naur wine-1.4.orig/dlls/wined3d/context.c wine-1.4/dlls/wined3d/context.c
--- wine-1.4.orig/dlls/wined3d/context.c	2012-03-07 23:11:48.000000000 +0700
+++ wine-1.4/dlls/wined3d/context.c	2012-03-17 04:39:55.203775940 +0700
@@ -1466,7 +1466,7 @@
 
     if (gl_info->supported[WGL_EXT_SWAP_CONTROL])
     {
-        if (!GL_EXTCALL(wglSwapIntervalEXT(swap_interval)))
+        if (!GL_EXTCALL(wglSwapIntervalEXT(1)))
             ERR("wglSwapIntervalEXT failed to set swap interval %d for context %p, last error %#x\n",
                 swap_interval, ret, GetLastError());
     }
diff -Naur wine-1.4.orig/dlls/winex11.drv/opengl.c wine-1.4/dlls/winex11.drv/opengl.c
--- wine-1.4.orig/dlls/winex11.drv/opengl.c	2012-03-07 23:11:48.000000000 +0700
+++ wine-1.4/dlls/winex11.drv/opengl.c	2012-03-17 04:38:41.975660369 +0700
@@ -3478,7 +3478,7 @@
         if (pglXSwapIntervalSGI)
         {
             wine_tsx11_lock();
-            ret = !pglXSwapIntervalSGI(interval);
+            ret = !pglXSwapIntervalSGI(1);
             wine_tsx11_unlock();
         }
         else
brebs is offline   Reply With Quote
Old 03-16-12, 06:18 PM   #31
lexa2
Registered User
 
Join Date: Jul 2011
Location: Moscow, Russian Federation
Posts: 58
Send a message via ICQ to lexa2 Send a message via Skype™ to lexa2
Default Re: Wine + VSync forced in nvidia-settings doesn't work

Quote:
Originally Posted by brebs View Post
This patch seems to work, to force vsync on in wine 1.4
Sure, this one should work, and it would force vsync on both for OpenGL and direct3d apps under wine. As you had hardcoded swap_interval == 1 into the WGL_EXT_swap_control implementation there's no point in hardcoding it inside wined3d.

With the hardcode approach you've got a bug here: WGL offers a way to read back current swap_interval, and Wine implements it internally inside X11DRV_wglGetSwapIntervalEXT(), tracking the value being set inside swap_interval variable. In case an app requests swap_interval != 1 and then reads back it using wglGetSwapIntervalEXT() - it would read back the value it had previously being set, i.e. with your patch Wine essentially lies to the app about real vsync state. That's a bad thing cause some apps have got built-in detection for the driver ability to set swap_interval, and might then base their timing on an assumption that having swap_control == 0 the execution wouldn't be "paused" as every swap buffers call - which is not the case. If you happen to hit such an app - you would get huge input lags problems. So, the solution is either to hardcode 1 as the return value for wglGetSwapIntervalEXT() or to add line "interval = 1;" just prior the line "wine_tsx11_lock();" inside X11DRV_wglSwapIntervalEXT(). Well, enough of this programming stuff, it's a bit offtopic in this thread actually :-).
lexa2 is offline   Reply With Quote
Reply


Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump


All times are GMT -5. The time now is 01:15 AM.


Powered by vBulletin® Version 3.7.1
Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
Copyright 1998 - 2014, nV News.