Pcsx2: Bug/Feature request: Disable vsync temporarily while frame limiting is disabled

Created on 11 Jun 2017  路  22Comments  路  Source: PCSX2/pcsx2

PCSX2 version:
1.4.0

PCSX2 options:
vsync, HW OpenGL renderer, vsync, frame limiting

Description of the issue:
Frame limiting Turbo/Slow mode has no effect while vsync is enabled. This makes technical sense due to the nature of vsync. However, it is dumb to make turbo unavailable. Instead, vsync should be temporarily disabled while turbo mode is enabled.
This is especially cumbersome due to the fact that:

  1. Vsync setting on linux has no effect until application restart. (Also needs to be fixed. Let me know if I should file another issue).
  2. There is no keyboard shortcut to toggle vsync.

How to reproduce the issue:
Enable vsync. Then frame limiting setting does nothing.

PC specifications:
OS: Ubuntu 16.04 64-bit
Video Card: Nvidia GTX 970
Video Driver: NVIDIA-Linux-x86_64-381.22
CPU: Intel(R) Core(TM) i7-5930K CPU

Maybe?

All 22 comments

Follow-up of #842

It is dumb to make turbo unavailable, but just because you are making dumb assumption over which refresh rates the monitor of your users are gonna support.
Proper behavior, imo, should just be to allow this, end.

And if you want to actually have turbo on your I guess 60hz screen, disable v-sync.

@mirh I am unclear on what point you are trying to make here. I am not a maintainer of this project, and thus I do not have users. I am not making any assumptions on refresh rates of other users; I personally use 60 hz, which I think is the most common refresh rate of users today.
For me, on my 60hz monitor, vsync gets rid of screen tearing, which is very visible and jarring otherwise. I would like to be able to switch between nice-looking vsync and time-saving turbo without:

  1. saving state
  2. leaving full screen
  3. pulling another window to the foreground
  4. opening graphics settings
  5. disabling a checkbox
  6. clicking ok
  7. exiting the application
  8. restarting the application
  9. reloading my savestate
  10. hitting the shortcut to enable turbo

Instead, it would be great if either one of two workflows were available instead:

  1. Press shortcut to toggle turbo mode, and vsync is automatically temporarily disabled.

OR

  1. Presss shortcut key to toggle vsync.
  2. Press shortcut to toggle turbo mode.

Either one would make playing with vsync actually feasible. The former suggestion would bring PCSX2 in line with what I believe most other emulators do. I say this as a user of many other emulators (not for ps2) that has never had to turn off vsync before to enable turbo. So I believe this is not an architectural limitation.

What I was talking about would like lead to your second scheme.

And.. do you really need to save state to toggle turbo and vsync?

Vsync setting has no effect for me (Ubuntu 64-bit) until I restart application.

Turbo settings works right away

Sorry to spam comments..
I would be fine with the second scheme, which would require two changes:

  1. Add a shortcut to toggle vsync
  2. Fix vsync change not taking effect without application restart.

Please let me know if I should refile for either of these.

Instead, vsync should be temporarily disabled while turbo mode is enabled.
Vsync setting on linux has no effect until application restart

The answer seems to be written in the question.

Those drivers are killing me.

@gregory38 I was not making a global observation about vsync and linux, but about your application's linux version. Other emulators do not seem to suffer from this limitation. Are you suggesting this is unfixable?

@gregory38 Furthermore, even if we ignore linux we can still benefit from having a vsync keyboard toggle. If you like I can code it up myself and make a pull request -- however I would appreciate a couple pointers where in the code to look if not's too much trouble.
EDIT
Actually it would help in linux as well, since it would still reduce the overly tedious workflow I posted above.

Linux and Windows is the same (except 3 lines). So toggling the option should work on Linux too.

https://github.com/PCSX2/pcsx2/blob/master/pcsx2/gui/GlobalCommands.cpp#L83

As you can see, Vsync is already updated based on the turbo. However there is maybe a bug, GSsetVsync isn't called in the first if.

Interesting.. I think I may have failed to properly test my use case.

Specifically, I tested:

  • turning on/off frame limiting while vsync was enabled/disabled. This had no effect with vsync enabled, but caused superfast rendering with vsync disabled.
  • Hitting turbo toggle with vsync disabled and frame limiting enabled. This worked as expected.

I did not test:

  • pressing the turbo toggle with vsync enabled

I will try in Linux and Windows and get back to you with results. I think that either way there is a bug; however if the thing I did not test above works properly, then there is at least a feasible workaround that allows faster than normal rendering with vsync enabled.

Also, either way I would like there to be a keyboard toggle for vsync, and am willing to implement it myself. @gregory38 So GSsetVsync is the function to call. Where is the code that registers/handles keyboard shortcuts?

turning on/off frame limiting while vsync was enabled/disabled. This had no effect with vsync enabled, but caused superfast rendering with vsync disabled.

Actually I think you hit the "the maybe a bug" part. I updated the code a bit in PR #1950

Where is the code that registers/handles keyboard shortcuts?

I don't know the part very well. But look in the same file (hint turbo is triggered by tab). And why do you need to toggle vsync ? There is already a shorcut for turbo and maybe one for the frame limiter. Normally vsync is/must be disabled when turbo is enabled or frame limited disabled.

I'd love/hope these _silly prejudices_ not to hold any kind of weight during programming.

@gregory38 Were it up to me I'd have a shortcut for nearly every graphical option (Perhaps not bound initially), independently of this issue :)

But vsync in particular is a very common graphical option to play with, and I'd still prefer a toggle if you are not opposed - if only to be able to quickly show others in the same room what vsync does, in terms of frame rate and graphical effect. So if you are not opposed, I'd like to add it when I have time.

....And then I read the history of PR #1950
Looks like rather than an on/off toggle, I would suggest next/previous vsync mode shortcuts. I'll wait for you guys to finish that PR.

So @gregory38 are you saying that I should maybe probably possibly have the behavior I want if I build and run PR #1950?

@mirh To what prejudices do you refer? Assumptions about people's refresh rates? Or something else?

Well PCSX2 have already way too much keyboard shortcut option (you need to find an available key). My feeling is that users set Vsync once. It depends on if they prefer tearing or stuttering. Anyway I'm not against it. You should ask @mirh and @ssakash opinions too :)

So @gregory38 are you saying that I should maybe probably possibly have the behavior I want if I build and run PR

Basically yes. But I didn't test it. Goal of the PR is Nvidia insanity not the GUI behavior.

If any, I'd ask why you need all this stuff in the first place.
I can see remotely legit need for a quick toggle for turbo mode, because.. I guess testing or stuff.
But from a normal user prospective.. either you are in the ballpark that your brain-eyes-monitor combination are in harmony with tearing (and you always keep v-sync off like I do on my monitor) or tearing is the most disturbing stuff to ever have crossed your sight (and you always keep it on - me with the TV) and

Hey, wouldn't double triple buffering solve this problem in the first place?

@mirh I looked into that. Couldn't figure out how to get it working on Ubuntu 64-bit. Either it is always on and makes no difference, or it doesn't work or help, or I'm stupid.
And by the way, tearing is awful for me personally and makes the game unplayable. To address one of your comments in PR #1950, I definitely prefer stuttering to tearing.

The two things aren't intertwined, don't worry.
And the stuff in #1950 is all about windows.

Though, now that you mention, shouldn't unity also have its own compositor?

Well, I personally use gnome3 with compiz. Unity might use something else in 16.04. But Unity is dead for future releases, so the focus should be I believe on compiz.
Compiz has vsync settings in two places:

  1. the 'opengl' section (Sync to VBlank).
  2. The 'workarounds' section (Don't wait for video sync)
    I tried playing around with these, but don't remember what happened. I can test again so we can be sure of the results. Should I do any testing with PR #1950 or with current master or something else?

I'd be curious about the first enabled and the second disabled.
And I think master should already be good on linux.

Anyway, assuming "making turbo unavailable" wasn't actually about pcsx2 actively barring you from enabling the thing as I was originally thinking, putting aside that also adaptive v-sync should be a solution for the fps lock, I believe the morals of this issue are ultimately just:

  • toggling v-sync shouldn't require restarting application
  • triple-buffering should be supported

Gregory already tinkering with the latter is quite difficult, but I was reading that modern drivers should already have a kind-of universal 'enabler'

I'd just like to leave the following final note for any who come upon this thread:

With the latest daily build:

Package: pcsx2-unstable
Maintainer: Gregory Hainaut <[email protected]>
Architecture: i386
Source: pcsx2.snapshot
Version: 3:1.5.0~git201712280541~ubuntu16.04.1

When I select adaptive vsync, I confirm that I get no tearing and am still able to use turbo (TAB).
So my problem is definitely solved.
Hopefully someday soon 1.5.0 gets a proper release. Thanks to all the developers for your hard work!

Was this page helpful?
0 / 5 - 0 ratings

Related issues

alucryd picture alucryd  路  6Comments

AraHaan picture AraHaan  路  5Comments

Javed-Iqbal-1 picture Javed-Iqbal-1  路  5Comments

BroKill picture BroKill  路  4Comments

XXXBold picture XXXBold  路  4Comments