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

Newegg Daily Deals

Reply
 
Thread Tools
Old 06-13-11, 07:50 AM   #1
darklegion
Registered User
 
Join Date: Oct 2004
Posts: 37
Default Wine + VSync forced in nvidia-settings doesn't work

When playing games such as The Witcher and Mirror's Edge under wine, forcing VSync in the control panel does not work. The issue occurs with wine-1.3.15 and later, but the wine developers claim it is not a regression. Using the Nouveau driver with GLXVblank=1 results in VSync working within these games. I am using a GTX275 and have tested with these nvidia-driver versions:

256.53, 260.19.44, 270.41.06, 275.09, 275.09.04

Here's the wine bug report: http://bugs.winehq.org/show_bug.cgi?id=27467

nvidia-bug-report.log.gz is attached.

BTW I tried with TripleBuffer and/or Page Flipping both on and off, and it made no difference. Neither did forcing the vsync settings with __GL_SYNC_TO_VBLANK=1

EDIT: Also, VSync does work if it's selected in game (e.g with Mirror's Edge) but not when forced by the driver. Driver forcing vsync is required for The Witcher, as it does not have an ingame vsync option.

Thanks
Attached Files
File Type: gz nvidia-bug-report.log.gz (53.9 KB, 146 views)
darklegion is offline   Reply With Quote
Old 06-13-11, 02:21 PM   #2
mocharhw
Registered User
 
Join Date: May 2008
Posts: 113
Default Re: Wine + VSync forced in nvidia-settings doesn't work

I've had some mixed results with OpenGL vsync in Wine. Some games seem to respond to the nvidia-settings and environment variable setting, while some graphics demos actually require the opposite settings in order to sync (I have to set vsync to 0 to get vsync!)

Quote:
Also, VSync does work if it's selected in game (e.g with Mirror's Edge) but not when forced by the driver.
That's basically the issue with the graphics demos, they usually have a check box for vsync, so I check the box in the demo and set the nvidia driver to not vsync.
mocharhw is offline   Reply With Quote
Old 06-13-11, 10:19 PM   #3
darklegion
Registered User
 
Join Date: Oct 2004
Posts: 37
Default Re: Wine + VSync forced in nvidia-settings doesn't work

Quote:
Originally Posted by mocharhw View Post
That's basically the issue with the graphics demos, they usually have a check box for vsync, so I check the box in the demo and set the nvidia driver to not vsync.
Yeah, it's weird. The older versions of wine do work with vsync forced, but those versions won't let you force it in game (most of the time). Some games don't have an inbuilt vsync option, though, so it's not a universal solution.

In addition, I've been having tearing issues with Adobe Flash 10/11 but I don't know if they were always there and I just didn't notice it before.
darklegion is offline   Reply With Quote
Old 06-14-11, 12:11 PM   #4
Thunderbird
 
Join Date: Jul 2002
Location: Netherlands, Europe
Posts: 2,105
Default Re: Wine + VSync forced in nvidia-settings doesn't work

In more recent Wine versions, we use some more modern GLX calls to handle vsync. The override in nvidia-settings doesn't override those calls (glXSwapIntervalEXT / glXSwapIntervalSGI). (This assumes no composition manager is running else nvidia-settings may not do anything)
Thunderbird is offline   Reply With Quote
Old 07-06-11, 05:01 AM   #5
sandipt
NVIDIA Corporation
 
sandipt's Avatar
 
Join Date: Dec 2010
Posts: 260
Default Re: Wine + VSync forced in nvidia-settings doesn't work

Here everybody mentioning VSync is not working, But can somebody explain what you observed on Screen/Game/Video ? Does its results tearing issue , screen artifacts OR any other issue etc. ?
sandipt is offline   Reply With Quote
Old 07-09-11, 01:56 AM   #6
darklegion
Registered User
 
Join Date: Oct 2004
Posts: 37
Default Re: Wine + VSync forced in nvidia-settings doesn't work

Quote:
Originally Posted by sandipt View Post
Here everybody mentioning VSync is not working, But can somebody explain what you observed on Screen/Game/Video ? Does its results tearing issue , screen artifacts OR any other issue etc. ?
Screen tearing, as you would get with VSync disabled on most games.
darklegion is offline   Reply With Quote
Old 07-26-11, 11:57 PM   #7
sandipt
NVIDIA Corporation
 
sandipt's Avatar
 
Join Date: Dec 2010
Posts: 260
Default Re: Wine + VSync forced in nvidia-settings doesn't work

Tried with game actofwar_multi_demo_us . Disable the "Composite" X extension in xorg.conf , Disable desktop effects and start X resolves this issue. Please check.

nvidia-xconfig --no-composite
sandipt is offline   Reply With Quote
Old 09-21-11, 01:31 AM   #8
kokoko3k
Registered User
 
Join Date: Jan 2007
Posts: 120
Default Re: Wine + VSync forced in nvidia-settings doesn't work

I just tried with the sims 3 and and wine 1.3.27; vsync option is just ignored with no composite extension loaded and with just a blank x screen with xterm.
with wine 1.11.x it worked fine; can't say if it is an nvidia issue; but it just doesn't work anymore.

And wine devs still points to an 'nvidia' driver bug, as under nouveau (with GLXVblank = 1) it works fine:
http://bugs.winehq.org/show_bug.cgi?id=27467
Attached Files
File Type: gz nvidia-bug-report.log.gz (60.1 KB, 79 views)
kokoko3k is offline   Reply With Quote

Old 10-17-11, 01:50 AM   #9
sandipt
NVIDIA Corporation
 
sandipt's Avatar
 
Join Date: Dec 2010
Posts: 260
Default Re: Wine + VSync forced in nvidia-settings doesn't work

We are unable to reproduce this issue. Can you try latest nvidia drivers and wine, let us know the results ?
sandipt is offline   Reply With Quote
Old 10-19-11, 11:12 AM   #10
kokoko3k
Registered User
 
Join Date: Jan 2007
Posts: 120
Default Re: Wine + VSync forced in nvidia-settings doesn't work

Nope, unfortunately it is still not fixed.

If you can't replicate the issue,
* just download and unpack this little d3d demo: http://dl.dropbox.com/u/5116567/rthdribl_1_2.zip
* Force vsync in nvidia-settings
* disable compositing
* run it with wine (tested under 1.3.30 + nvidia drivers 285.05.09)

Observe that:
* fps are not multiple of the current refresh rate (but this can be caused by wrong calculations)
* occasional tearing appears (use the mouse to drag the image and pan faster to make it more evident)

BEWARE that if you run it in fullscreenmode it switch vsync on.

-EDIT-
In the window from file/config display menu, there are choices about vsync, they are:
d3d_PresentInterval_immediate, d3d_PresentInterval_one, d3d_PresentInterval_default.
As stated here:
http://msdn.microsoft.com/en-us/libr...tinterval.aspx

Setting *_one or *_default lead to the rendering synced to the display resolution, but choosing d3d_PresentInterval_immediate lead to display being unsynced, and there is nothing which can be done; nvidia-settings is unable to force vsync in that case.
Using an older wine version (i used 1.1.44) works (nvidia-settings is able to force vsync in all of the three cases),
This is exactly the issue we're discussing.


(PS: as expected, thesims3, which won't let you configure any vsync and leave it off, still tears with latest wine, while is ok with olders).
kokoko3k is offline   Reply With Quote
Old 10-19-11, 03:25 PM   #11
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
Exclamation Re: Wine + VSync forced in nvidia-settings doesn't work

I can confirm that for this demo there's no offect in ticking "Sync to VBlank" checkbox in nVIDIA X Server settings in case the demo runs in windowed mode. You can control VSync behavior through app configuration menu (accessed using F2 key) by changing D3D presentation interval setting. Switching app into using fullscreen mode makes vsync behave as expected (i.e. there's no tearing and FPS almost matched screen refresh rate).

Tested on GeForce 550 Ti + 280.13 drivers + Wine 1.3.30.

Inspecting Wine sources shows that currently Wine uses GLX_SGI_swap_control OpenGL extension from 1995. wined3d sets swap interval using this code:
Code:
    switch (swapchain->presentParms.PresentationInterval)
    {
        case WINED3DPRESENT_INTERVAL_IMMEDIATE:
            swap_interval = 0;
            break;
        case WINED3DPRESENT_INTERVAL_DEFAULT:
        case WINED3DPRESENT_INTERVAL_ONE:
            swap_interval = 1;
            break;
        case WINED3DPRESENT_INTERVAL_TWO:
            swap_interval = 2;
            break;
        case WINED3DPRESENT_INTERVAL_THREE:
            swap_interval = 3;
            break;
        case WINED3DPRESENT_INTERVAL_FOUR:
            swap_interval = 4;
            break;
        default:
            FIXME("Unknown presentation interval %08x\n", swapchain->presentParms.PresentationInterval);
            swap_interval = 1;
    }

    if (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",
                swap_interval, ret, GetLastError());
    }
wglSwapIntervalEXT() it uses actually translates to this:
Code:
...
...
static BOOL has_swap_control;
static int swap_interval = 1;
...
...
static int WINAPI X11DRV_wglGetSwapIntervalEXT(VOID) {
    /* GLX_SGI_swap_control doesn't have any provisions for getting the swap
     * interval, so the swap interval has to be tracked. */
    TRACE("()\n");
    return swap_interval;
}
...
...
static BOOL WINAPI X11DRV_wglSwapIntervalEXT(int interval) {
    BOOL ret = TRUE;

    TRACE("(%d)\n", interval);

    if (interval < 0)
    {
        SetLastError(ERROR_INVALID_DATA);
        return FALSE;
    }
    else if (!has_swap_control && interval == 0)
    {
        /* wglSwapIntervalEXT considers an interval value of zero to mean that
         * vsync should be disabled, but glXSwapIntervalSGI considers such a
         * value to be an error. Just silently ignore the request for now. */
        WARN("Request to disable vertical sync is not handled\n");
        swap_interval = 0;
    }
    else
    {
        if (pglXSwapIntervalSGI)
        {
            wine_tsx11_lock();
            ret = !pglXSwapIntervalSGI(interval);
            wine_tsx11_unlock();
        }
        else
            WARN("GLX_SGI_swap_control extension is not available\n");

        if (ret)
            swap_interval = interval;
        else
            SetLastError(ERROR_DC_NOT_FOUND);
    }

    return ret;
}
The code is pretty simple. It is clear that Wine's d3d9 implementation defines it's own "default swap interval" to be D3DPRESENT_INTERVAL_ONE in case app specify is as D3DPRESENT_INTERVAL_DEFAULT. The default value for swap_interval when using wine OpenGL is assumed to be 1 as this is what GLX_SGI_swap_control specs explicitly define.

Now, back to the problem with controling vsync using nVIDIA driver CP. "Sync to VBlank" setting at "OpenGL Settings" page doesn't explicitly mention that it would force vsync to be always on. I suspect that the only real effect it has it setting the default internal value the driver uses as swap_interval. As a result we get that Wine app that uses d3d to do rendering would always set swap_interval value basing on the app supplied D3DPRESENT_INTERVAL and/or on built-in wined3d defaults.

What should be done here by nVIDIA devteam:

a) nVIDIA should document if setting "SyncToVBlank" nvcontrol attribute to be 1 really forces swap_interval to be at least 1.

b) nVIDIA should fix __GL_SYNC_TO_VBLANK so it sets default OpenGL swap_interval to be 1 and any attempts to reset it back to 0 using GLX_EXT_swap_control extension should fail with an error (or maybe should be silently ignored). GLX_SGI_swap_control should be OK in its current form as the specs state that it is impossible to disable vsync once it had been enabled usign this extension (glXSwapIntervalSGI should do nothing and fail with an error if receives 0 as input). This behavior should be consistent no matter is the target drawable attached to the fullscreen X11 window or to an ordinary X11 window.

As a side note, Wine should be extended to use GLX_EXT_swap_control if it's available instead of much older and less capable GLX_SGI_swap_control extension. I would implement a patch and send it to Wine devteam as soon as would have a spare time for it.
Upd. Actually Wine currently relies on an assumption that calls to glXSwapIntervalSGI() are mapped to the glXSwapIntervalEXT() internally in the driver if latter advertises support for "GLX_EXT_swap_control". Thus there's no urgent need in patching Wine to directly use GLX_EXT_swap_control - it would be of a much benefit.
lexa2 is offline   Reply With Quote
Old 10-19-11, 03:27 PM   #12
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 kokoko3k View Post
...
Using an older wine version (i used 1.1.44) works (nvidia-settings is able to force vsync in all of the three cases), This is exactly the issue we're discussing.
...
Wow, that's interesting. I would take a look into 1.1.44 Wine source and check what are the differences comparing to the current codebase.
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 05:30 AM.


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