Closed Dogway closed 2 years ago
Oh yeah, the savestates... IIrc, they expect the recompiler do be in a well defined state when saving and loading. That could be the issue.
Related code is also used for suspending / resuming threads, and that is kind of all the GUI functionality.
With regards to @mirh's report
I had a lengthy conversation with him on discord. He neither verified the result himself or even asked for the videos and when I argued him into giving me the videos he gave me 4 videos but none were a control.
I was able to verify that none of the videos seemed any different in terms of lag (they vary in settings such as FSO enabled or disabled). Perhaps said user will come forward directly and give us some more insight as to why they think this improves the situation for them. Until then I'm calling it inconclusive.
On a more positive note, @RedPanda4552 has a high-speed camera and was willing to do some testing with the flag enabled. We performed these tests with his phone camera using the capslock key mapped to a button, allowing us to see the button press. I've put the two videos side by side and additionally I've slowed the videos down further to 25% so you can see the frame by frame.
https://i.imgur.com/9xwuCUE.mp4
There doesn't appear to be much difference if you ask me. Maybe FSE is a frame faster on some frames but input seems to register about the same time. I'll include the raw recordings so you can count the frames yourself. Here are the raws
If anyone has any other aspect of FSE they'd like us to test or any issues they'd like us to address with the test please let me know.
@ramapcsx2
Yeah, this is highly unusual code, but it is there for a good reason. (I don't claim to understand any of it, mind).
Well I have done gui code so I'll take a stab at it for you. WX is basically a big while(true) loop that processes events every iteration. I/O access is blocking, not only blocking but dependent on I/O speed. Which means the loop stalls to do blocking code. Loop stalling means UI cannot process new events or update, making it hang. Now spam this a bunch of times and you have issues.
But yeah, the GUI hooks do serve an important function, as weird as they seem to be.
No one thinks the hooks themselves are weird. You have to do that obviously to let the gui know about important events from core. What is silly is how it was done. Now blocking I/O code might have been added later, but if the update worked as expected it likely wouldn't be too much an issue. Clearly whoever added it didn't consider this caveat to the recompiler that it will exit a ton under certain circumstances.
Anyway I suspect this function at the end of _SaveLoadStuff
:
void Sstates_updateLoadBackupMenuItem(bool isBeforeSave)
{
wxString file = SaveStateBase::GetFilename(StatesC);
if (!(isBeforeSave && g_Conf->EmuOptions.BackupSavestate))
{
file = file + L".backup";
}
fprintf(stderr, "test");
sMainFrame.EnableMenuItem(MenuId_State_LoadBackup, wxFileExists(file));
sMainFrame.SetMenuItemLabel(MenuId_State_LoadBackup, wxsFormat(L"%s %d", _("Backup"), StatesC));
}
Call to wxFileExists is likely blocking I/O call. Other save state stuff is cached so I don't think I/O happens much. Obviously spamming the event system blocking or otherwise is still a bad idea.
Best way to fix it IMO is to find a way to let the gui know about the change in VM state without spamming the gui thread a ton about it.
he gave me 4 videos but none were a control.
I already said they were there now. And in a very quick game like street fighter, those ~4 additional frames can mean a +50% latency increase from the best case to the worst.
There doesn't appear to be much difference if you ask me.
Indeed. But then there didn't seem to be any particular difference compared to an actual PS2 either. Which would mean this whole issue is kind of a dupe.
So, we are still kind of missing something (including data points from more people as I was asking above). So far we have the following contenders AFAIK (not exclusive with each other):
With regards to @mirh's report
I had a lengthy conversation with him on discord. He neither verified the result himself or even asked for the videos and when I argued him into giving me the videos he gave me 4 videos but none were a control.
I was able to verify that none of the videos seemed any different in terms of lag (they vary in settings such as FSO enabled or disabled). Perhaps said user will come forward directly and give us some more insight as to why they think this improves the situation for them. Until then I'm calling it inconclusive.
On a more positive note, @RedPanda4552 has a high-speed camera and was willing to do some testing with the flag enabled. We performed these tests with his phone camera using the capslock key mapped to a button, allowing us to see the button press. I've put the two videos side by side and additionally I've slowed the videos down further to 25% so you can see the frame by frame.
https://i.imgur.com/9xwuCUE.mp4
There doesn't appear to be much difference if you ask me. Maybe FSE is a frame faster on some frames but input seems to register about the same time. I'll include the raw recordings so you can count the frames yourself. Here are the raws
If anyone has any other aspect of FSE they'd like us to test or any issues they'd like us to address with the test please let me know.
Hi, I was the one doing the tests with the great help of @mirh so i can answer some of the questions.
The problem with the input lag for me was the forced buffering which was because of Borderless Windows (I thought).
@mirh explained to me that there was a way to let DWM promotes PCSX2 to an hybrid fullscreen without any buffering done.
The test is easy, first we need to disable Vsync from PCSX2 and see :
I concluded that only these combinations make the tearing appear :
This allow to reduce the lag a lot as DWM buffering + Vsync was horrendous ! Now I can play PCSX2 with reduced input lag, almost similar to the real PS2. The only problem is that the TV has to change the Ratio to be accurate, is there any way to make it work without "Fit To Window/Screen" ?
Also, would it be possible to include EnableVsyncWindowFlag by default ?
Also, thanks a lot for your hard work PCSX2 Team !
What about Gsync and Freesync? Could be worth looking at too if someone has a monitor like that.
@Immersion95 can you provide any testing and information about your PC.
What information ?
Specs. CPU/GPU, driver versions, anything that can be helpful in diagnosing the issue.
I tested on 3 different computers with Windows 10 1909, the only difference were graphic cards.
Intel GPU -->Needs DX11 to make it work Nvidia -->Needs OpenGL to make it work
Aren't you able to reproduce this ?
Best regards.
No I can't, that's why I'm asking you for specs. What graphics card? What CPU? What driver?
Yes, sorry I didn't understand :
And this was with KOF 2000? Did you do any camera test or was this by feel alone?
I did the tests with a phone which can record at 60fps with a lot of games but the tests with @mirh were done with Capcom Fighting Jam.
I bought an OSSC and waiting for it to arrive, I will then be able to compare it with the same display lag and also same controller (Wireless DS4 & Wireless DS4+Brook for the PS2).
I also suffer from input lag problems. Not so much but enough to be annoying playing Tekken or games that require extreme precision. I have tried on many rigs over the years and this problem has always bothered me. I hope the team can fix it sooner or later because I love pcsx2.
Did anyone tried disabling gamefix it did fix some of the lag not all of it
I thought i was the only one facing this input lag issue... hope it can be fixed! Dragon Ball Z Budokai Tenkaichi 3 is unplayable for me for this issue.
Just chiming in to say with the newest Nvidia drivers and newest pcsx2 this issue is still present after randomly starting months and months ago. even on a new low latency monitor, everything else including other emulators are very responsive. happens with keyboard and mouse or gamepad, software or hardware, gamefixes or no, gamehacks or no, fullscreen or windowed, independent of performance, across all games, in menus and in-game etc. I’ve tested it from every angle I can imagine and it seems there’s an extremely consistent input delay that only affects pcsx2. it’s a shame because for all its problems it was my favorite emulator, but randomly it became unusable, even older versions. from what I’ve seen online this affects many people and no solution has been found.
Just chiming in to say with the newest Nvidia drivers and newest pcsx2 this issue is still present after randomly starting months and months ago. even on a new low latency monitor, everything else including other emulators are very responsive. happens with keyboard and mouse or gamepad, software or hardware, gamefixes or no, gamehacks or no, fullscreen or windowed, independent of performance, across all games, in menus and in-game etc. I’ve tested it from every angle I can imagine and it seems there’s an extremely consistent input delay that only affects pcsx2. it’s a shame because for all its problems it was my favorite emulator, but randomly it became unusable, even older versions. from what I’ve seen online this affects many people and no solution has been found.
You have to have these conditions to enable the hybrid fullscreen which disable the frame buffering :
If you want to use Vsync, please disable frame limiter from PCSX2 and use Vsync from the Nvidia driver config or with RTSS/Scanline Sync. You can use PCSX2 Vsync but it's not that great regarding input lags.
You will normally see tearings when Vsync is off, this will confirm that you do not have buffering and the lowest possible input lag
I personally use Scanline Sync with RTSS (-1 in the settings) and the results are almost perfect !
Edit : Forgot the flag
I cannot manage to make tearing appear. Using opengl and the settings @Immersion95 used it only gives me stuttering, but never tearing.
Do i have to use a particular build?
Just chiming in to say with the newest Nvidia drivers and newest pcsx2 this issue is still present after randomly starting months and months ago. even on a new low latency monitor, everything else including other emulators are very responsive. happens with keyboard and mouse or gamepad, software or hardware, gamefixes or no, gamehacks or no, fullscreen or windowed, independent of performance, across all games, in menus and in-game etc. I’ve tested it from every angle I can imagine and it seems there’s an extremely consistent input delay that only affects pcsx2. it’s a shame because for all its problems it was my favorite emulator, but randomly it became unusable, even older versions. from what I’ve seen online this affects many people and no solution has been found.
With Nvidia, you have to have these conditions to enable the hybrid fullscreen which disable the frame buffering :
- OpenGL SW or HW (and nothing else)
- Fit to screen (yes you will think it's useless but it's not until #3588 is merged)
- DO NOT disable Full Screen Optimizations in the pcsx2.exe properties (right click on Windows 10)
If you want to use Vsync, please disable frame limiter from PCSX2 and use Vsync from the Nvidia driver config or with RTSS/Scanline Sync. You can use PCSX2 Vsync but it's not that great regarding input lags.
You will normally see tearings when Vsync is off, this will confirm that you do not have buffering and the lowest possible input lag
I personally use Scanline Sync with RTSS (-1 in the settings) and the results are almost perfect !
Thanks for the response. I was sure I had tried these, but seeing your reply I got excited and decided to double check everything again. -I only use OpenGL, but I double checked that, tried HW and SW for good measure. -Double checked that I was using the "fit to window/screen" option. -Recently I did disable the framelimiter under GS window and switched to using RTSS instead, but went ahead and double checked that just in case. Also tried the scanline sync -1 because I was curious but noticed no change. -The "disable fullscreen optimizations" in the .exe properties I wasn't sure of so I double-checked that and it hadn't been turned on, so no problem there.
I've had my 1050ti for a couple of years now, long before this issue started happening. what's odd is I didn't even upgrade my pcsx2 to make it happen, one day it just became unusable with a very noticeable change in responsiveness. I don't know the exact numbers, but to give you an idea, I can notice the difference between a wireless usb controller and a wired one in action games like sekiro, but that amount is negligible compared to the latency of the issue I've been having with pcsx2. I know I've said it before but pcsx2 didn't always behave this way (at least on my computer), so I know it's not just a problem with ps2 emulation or pcsx2 itself. The whole thing is completely bewildering to me.
Thanks for the response. I was sure I had tried these, but seeing your reply I got excited and decided to double check everything again. -I only use OpenGL, but I double checked that, tried HW and SW for good measure. -Double checked that I was using the "fit to window/screen" option. -Recently I did disable the framelimiter under GS window and switched to using RTSS instead, but went ahead and double checked that just in case. Also tried the scanline sync -1 because I was curious but noticed no change. -The "disable fullscreen optimizations" in the .exe properties I wasn't sure of so I double-checked that and it hadn't been turned on, so no problem there.
I've had my 1050ti for a couple of years now, long before this issue started happening. what's odd is I didn't even upgrade my pcsx2 to make it happen, one day it just became unusable with a very noticeable change in responsiveness. I don't know the exact numbers, but to give you an idea, I can notice the difference between a wireless usb controller and a wired one in action games like sekiro, but that amount is negligible compared to the latency of the issue I've been having with pcsx2. I know I've said it before but pcsx2 didn't always behave this way (at least on my computer), so I know it's not just a problem with ps2 emulation or pcsx2 itself. The whole thing is completely bewildering to me.
Please see my updated comment with the flag
I cannot manage to make tearing appear. Using opengl and the settings @Immersion95 used it only gives me stuttering, but never tearing.
Do i have to use a particular build?
Please check my updated comment, do you have a Nvidia GPU ?
I cannot manage to make tearing appear. Using opengl and the settings @Immersion95 used it only gives me stuttering, but never tearing. Do i have to use a particular build?
Please check my updated comment, do you have a Nvidia GPU ?
Yes i have an nvidia gpu, after i changed the flag it works. Thanks.
Just chiming in to say with the newest Nvidia drivers and newest pcsx2 this issue is still present after randomly starting months and months ago. even on a new low latency monitor, everything else including other emulators are very responsive. happens with keyboard and mouse or gamepad, software or hardware, gamefixes or no, gamehacks or no, fullscreen or windowed, independent of performance, across all games, in menus and in-game etc. I’ve tested it from every angle I can imagine and it seems there’s an extremely consistent input delay that only affects pcsx2. it’s a shame because for all its problems it was my favorite emulator, but randomly it became unusable, even older versions. from what I’ve seen online this affects many people and no solution has been found.
With Nvidia, you have to have these conditions to enable the hybrid fullscreen which disable the frame buffering :
- OpenGL SW or HW (and nothing else)
- Fit to screen (yes you will think it's useless but it's not until #3588 is merged)
- DO NOT disable Full Screen Optimizations in the pcsx2.exe properties (right click on Windows 10)
If you want to use Vsync, please disable frame limiter from PCSX2 and use Vsync from the Nvidia driver config or with RTSS/Scanline Sync. You can use PCSX2 Vsync but it's not that great regarding input lags. You will normally see tearings when Vsync is off, this will confirm that you do not have buffering and the lowest possible input lag I personally use Scanline Sync with RTSS (-1 in the settings) and the results are almost perfect !
Thanks for the response. I was sure I had tried these, but seeing your reply I got excited and decided to double check everything again. -I only use OpenGL, but I double checked that, tried HW and SW for good measure. -Double checked that I was using the "fit to window/screen" option. -Recently I did disable the framelimiter under GS window and switched to using RTSS instead, but went ahead and double checked that just in case. Also tried the scanline sync -1 because I was curious but noticed no change. -The "disable fullscreen optimizations" in the .exe properties I wasn't sure of so I double-checked that and it hadn't been turned on, so no problem there. I've had my 1050ti for a couple of years now, long before this issue started happening. what's odd is I didn't even upgrade my pcsx2 to make it happen, one day it just became unusable with a very noticeable change in responsiveness. I don't know the exact numbers, but to give you an idea, I can notice the difference between a wireless usb controller and a wired one in action games like sekiro, but that amount is negligible compared to the latency of the issue I've been having with pcsx2. I know I've said it before but pcsx2 didn't always behave this way (at least on my computer), so I know it's not just a problem with ps2 emulation or pcsx2 itself. The whole thing is completely bewildering to me.
Please see my updated comment with the flag
Thanks for the quick reply, hadn't tried enabling vsync window flag in the ini. I did so but when I checked it after I ran a game and there was no change, I saw that it was changed back to disabled, and when I set it to "read only" after enabling it again, pcsx2 seems to be creating new .tmp files with the flag back to disabled. Still no change, any idea why pcsx2 would be refusing to use that ini setting?
Thanks for the quick reply, hadn't tried enabling vsync window flag in the ini. I did so but when I checked it after I ran a game and there was no change, I saw that it was changed back to disabled, and when I set it to "read only" after enabling it again, pcsx2 seems to be creating new .tmp files with the flag back to disabled. Still no change, any idea why pcsx2 would be refusing to use that ini setting?
Start fresh and change EnableVsyncWindowFlag="disabled" to "enabled"
Please don't use that many quotes, it's becoming hard to follow. Thank you.
Start fresh and change EnableVsyncWindowFlag="disabled" to "enabled"
Using the quotes seems to have gotten it to stick in the ini, and the difference between the two is noticeable. Thank you very much! I don't remember pcsx2 ever having any extra delay at all (when compared with any other emulator) until a little less than a year ago, but with these fixes it's at a level that's tolerable/playable in less response time orientated games. I hope some progress can be made with it, or at least someone could figure out why the jump backwards in progress with this issue, but all the same I'm thankful for your help, it's a big difference.
Edit: It's also introduced major screen tearing, which wasn't a necessary compromise before whatever bug/issue has caused this, so I'll still be waiting until things get patched up. Oh well, I'm sure the team is working hard enough as is, and I'm grateful for the times I've had with the emu.
Please don't use that many quotes, it's becoming hard to follow. Thank you.
My bad, I'll try to be mindful of that in the future.
Edit: It's also introduced major screen tearing, which wasn't a necessary compromise before whatever bug/issue has caused this, so I'll still be waiting until things get patched up. Oh well, I'm sure the team is working hard enough as is, and I'm grateful for the times I've had with the emu.
It's normal to have tearings without Vsync.
Now that you observe tearings, you can re-enable Vsync as you now know that buffering is definately disabled.
You can use PCSX2 Vsync but I suggest to use RTSS/Scanline Sync with -1 with framelimiter disabled.
I didn't have great results then so I enabled the framelimiter and manually changed the fps to match my refresh rate of 60.0 instead of 59.94 :
With that configuration, the input lag is realy reduced and the fps is smooth. I sometimes see really small tearings but it doesn't hinder the experience.
It's normal to have tearings without Vsync.
Now that you observe tearings, you can re-enable Vsync as you now know that buffering is definately disabled.
You can use PCSX2 Vsync but I suggest to use RTSS/Scanline Sync with -1 with framelimiter disabled.
I didn't have great results then so I enabled the framelimiter and manually changed the fps to match my refresh rate of 60.0 instead of 59.94 :
- Open PCSX2_vm.ini
- Change to "FramerateNTSC=60.00"
With that configuration, the input lag is realy reduced and the fps is smooth. I sometimes see really small tearings but it doesn't hinder the experience.
I am using RTSS with the settings you recommended, Scanline Sync -1, Framelimiter disabled, 60fps limit etc. The screen tearing is major (some people aren't as sensitive to it, but its constant on my end) making the small boost in responsiveness not worth the trade off, as well as not addressing the root issue, leaving me still to wait until this issue is patched.
I feel like something is being lost in translation across our posts. I appreciate your help in figuring out how to disable vsync, but the problem that I'm experiencing is there with or without vsync, whether the vsync is from pcsx2, RTSS, or disabled entirely.
It seems you either aren't experiencing the issue that has popped up for me and many others, or you just don't mind it, but pcsx2 at one point had about the same level of input lag as other emulators I've tried. It was only about a year ago that this major input lag problem occurred and has remained consistent since then. I have used pcsx2 for years on both AMD and nvidia with great success, multiple different monitors, OS's, input devices, build versions etc. and never encountered this bug until a year ago, and it has not gone away since.
I'm sorry but it's impossible that you see tearings if PCSX2 Vsync is enabled.
Please disable the preset in the emulation tab and activate Standard Vsync.
For RTSS/Scanline Sync = You need to reduce the value to -30, -50 or even -100 to make the tearing line disappear. This hugely depends on your computer performance.
I'm sorry but it's impossible that you see tearings if PCSX2 Vsync is enabled.
Please disable the preset in the emulation tab and activate Vsync.
I'm sorry but things are definitely getting lost in translation here. Please re-read my post, my issue is not with screen tearing, it is with input delay. I only mentioned screen tearing because you recommended I turn off vsync, but this has never been the issue I was chiming in about.
You were talking about trade off because the boost of input lag weren't worth the tearings. That's why I was suggesting ways to use Vsync to eliminate tearings while still having minimal input lag.
Regarding the "root" problem that you are dealing with, you are only talking about "feeling" I suppose.
Have you done measurement with a 60fps camera to compare between the different emulators you are talking about ?
Then, have you compared with the previous pcsx2 build that you used ?
I'm not denying your situation but please understand that the devs would need more precise information to investigate the matter.
Can you guys try the PR #3785 ?
We changed some stuff which drastically improves frame times and the PR author felt that the input lag when playing GT4 was much better so could be worth trying it out.
Feels good to not have to hit notes so damn early in Gitaroo Man. Crazy. Isn't perfect yet, but definitely better - at least in my case.
Definitely better than before, I've tested a bunch of games and felt an improvement on all of them. Will test the latest change to see if there's any further improvement.
Thanks @Helium-4 good to hear!
Can you guys try the PR #3785 ?
We changed some stuff which drastically improves frame times and the PR author felt that the input lag when playing GT4 was much better so could be worth trying it out. I don't know what you mean do i need to change some settings or do I only update ?
I don't know what you mean do i need to change some settings or do I only update ?
You just need to download the build at the bottom, where it says all checks passed click "show all checks" on the right then click "details" next to the windows build (second one down), then in the top right, click "Artifacts" and select the top download in that list. You can just extract the pcsx2.exe if you wish
I don't know what you mean do i need to change some settings or do I only update ?
You just need to download the build at the bottom, where it says all checks passed click "show all checks" on the right then click "details" next to the windows build (second one down), then in the top right, click "Artifacts" and select the top download in that list. You can just extract the pcsx2.exe if you wish
Thanks
I tested 4 different games, honestly didn't really feel any difference in any of them.
I tested 4 different games, honestly didn't really feel any difference in any of them.
That sucks :( A Few people now have noticed an improvement in the feel.
I tested shinobidu no improvement
as a benchmark, I used:
both games running at the same time with inputs shared. I recorded the screen doing basic actions in both games (neutral jumping, crouching medium kick..), then I frame stepped through the recording. it seemed in sync for most of the time, 1f of delay between instances at worst.
maybe this scenario could be used by someone more clever than me.
That's some nice testing @pokeshark and good to know the lag for us isn't too dissimilar to the PC version :)
As for our recent changes, the input lag may not be any different but the perceived lag may be improved due to the improved frame time consistency
@ABU3BGE @pokeshark @sandman332 @Helium-4 @Dogway
Can you guys test with this build (make sure you run this one) and see if input lag is improved, just trying something out to see if it's better, one guy on discord seems to think the input lag has gone, but I wanna be sure before I make any commits.
Can't feel any difference, tried measuring it and come up with either no difference or 1 frame difference either worse or better compared to v1.7.0-dev-520-gf60148979
That's a shame, I've had 2 others say the input lag certainly seems lower, unless it depends on the game, I know some games have terrible input lag anyway and there's nothing we can do about that.
Would still like others to check.
That's a shame, I've had 2 others say the input lag certainly seems lower, unless it depends on the game, I know some games have terrible input lag anyway and there's nothing we can do about that.
Would still like others to check.
Yeah I tried it with Jak 1 as well, can't feel any difference. The input lag is still really bad. Same with controller and keyboard. Seems like there's less input lag in the menus though. Moving around doesn't seem to result in input lag, it's just when you try to double jump or punch. Though I only played it for a a few minutes.
And you're positive it doesn't feel like that on the console? I just don't wanna be chasing unicorns here.
PCSX2 version: pcsx2-v1.5.0-dev-3138-gfbafd4420-windows-x86
PCSX2 options:
Software or Hardware mode indistinctly. Using Safe Preset
Plugins used: Default: GSdx32-AVX2 Spu2-X LilyPad 0.12.1 FWNull Driver 0.7.0
Description of the issue: There's a high game input lag in 3D based games, rarely below 6 frames of lag. Here are some tests done with frame advance using the minimum recorded frames for fastest event paths.
MGS3 Subsistance (6 frames) GTA Vice City (6 frames) GTA San Andreas (10 frames, 166ms!) Sengoku Basara X (6 frames) Tokyo Xtreme Racer 3 (7 frames) Taiko Drum Master (6 frames) Silent Scope (6 frames) Time Crisis 3 (5 frames) Capcom Fighting Evolution (4 frames)
Generally it's 6 frames of game input lag which is one of the highest recorded on current emulation software compared to Dolphin (5), Citra (4), Retroarch (4-5) and possibly Cemu and RPCS3 (they feel snappy)
How to reproduce the issue:
-Enable "Recording Tools" -Load a game -Press the frame advance hotkey -Press a fast event triggering button on your pad -Press again the frame advance hotkey as many times (counting them) until the event starts the animation
PC specifications: Operating System: Windows 7 x64 SP1 CPU: Intel i5-4670K @ 4.1Ghz GPU: Nvidia GeForce GTX 1070