PCSX2 / pcsx2

PCSX2 - The Playstation 2 Emulator
https://pcsx2.net
GNU General Public License v3.0
11.49k stars 1.6k forks source link

Stuttering in all games in GIT builds (HW and SW affected) #1437

Closed RAZORXKHARA33 closed 7 years ago

RAZORXKHARA33 commented 8 years ago

I've been following the GIT builds for PCSX2 for roughly a year now (since accurate blending was introduced in GSOGL), and every GIT build after the 1.4.0 stable release that I have used has had problems with stuttering. The emulator reports 100% speed and 60 FPS and the game timers and physics run at full speed, but the video is very choppy. Normally, this would only happen when I'm recording with Nvidia Shadowplay or playing in windowed mode, but now it happens in fullscreen mode and windowed mode. Switching to software rendering does not fix the issue. Because of this, I'm stuck on 1.4.0 stable (which works pretty well but lacks fast accurate blending and some other fixes that are very useful, especially in the Gran Turismo series). Also, in the most recent builds with the large framebuffer option included, Gran Turismo 3 and 4 both cause massive slowdowns during races and replays at anything higher than 2x native resolution. This never happened in stable release 1.4.0 nor any of the GIT builds leading to it. My settings are as follows:

EE Round: Chop/Zero EE Clamping: Full VU Round: Chop/Zero VU Clamp: Extra+Preserve Sign Vsync is disabled in Core GS options, enabling does not fix visual stutter. All speedhacks enabled except for Fast CD/DVD access, EE cyclerate and VU cycle stealing No manual gamefixes enabled --GS Plugin settings: Adapter: Nvidia GeForce GTX 1080 Renderer: OpenGL (Hardware) Interlacing (F5): Auto Allow 8-bit textures: ON Large Framebuffer: ON Internal Resolution: 3x Native Texture Filtering: Bilinear (PS2) CRC Hack Level: Partial (OpenGL Recommended) HW Hacks: None (tried safe accurate blending, only caused slowdowns) Accurate Date: ON Blending Unit Accuracy: High (Recommended high-end PC)

PC Specs: MoBo: Gigabyte GA-Z97X-Gaming 7 CPU: Intel Core i7 4790K RAM: 32GB 1600 MHz GPU: Nvidia GeForce GTX 1080 FE Drive where PCSX2 and OS load from: Samsung 950 PRO 256GB NVMe M.2 SSD Drive where .ISO files load from: WD Caviar Blue 1TB 7200 RPM HDD

As I said before, this has only started happening in GIT builds for 1.5.0. This does not affect stable 1.4.0 or any GIT builds that led to that stable release.

gregory38 commented 8 years ago

Try to find the first build that got the issue http://buildbot.orphis.net/pcsx2/index.php?m=fulllist

RAZORXKHARA33 commented 8 years ago

Last build that didn't exhibit the issue was compiled on 2-28-2016. The build is v1.5.0-dev-385-gdb379ad. The next 2 available builds (v1.5.0-dev-401-ge57a75a AND v1.5.0-dev-403-g4b00ec9) will not even boot, and the next build after 403 (v1.5.0-dev-405-g8839632) is the first available build that exhibits the issue, and it was compiled on 2-29-2016. Hope this helps!

gregory38 commented 8 years ago

MTVU on/off ? The issue seems related to atomic ! Is hyperthreading enabled on your CPU?

Do you have the issue in VS2013 build ? https://ci.appveyor.com/project/gregory38/pcsx2/branch/master/job/owyu3dhusr0hcbgx/artifacts

RAZORXKHARA33 commented 8 years ago

MTVU on/off made no difference, and hyperthreading is enabled on my CPU. I will test the VS 2013 as soon as a replay finishes recording.

gregory38 commented 8 years ago

Ok. Could you do a test with HT disabled too ?

RAZORXKHARA33 commented 8 years ago

Tested the VS 2013 build, still very bad stuttering, and disabling HT made no difference.

gregory38 commented 8 years ago

Hum, do you have the issue if you take an old GSdx with a new PCSX2 binary ?

RAZORXKHARA33 commented 8 years ago

Latest build gets rid of the bad slowdowns that I described when Large Framebuffer is enabled, but the stuttering is still there, even with GS plugins from build 385 (which was the last build without the visual stutter). Still stuttering even with GS plugins from stable 1.4.0.

gregory38 commented 8 years ago

Ok. Would you able to compile the plugin on your side with some patches ?

RAZORXKHARA33 commented 8 years ago

I'm not experienced with that kind of thing, unless I'm just overthinking something. Are you saying that you have everything necessary for the plugin (including the patches) and all I have to do is compile it? I'm bad with this kind of thing unless it's something simpler than I think it is.

tabnk commented 8 years ago

Interesting :). Was wondering what cause the stuttering in GT4.

Good finding.

tabnk commented 8 years ago

Btw GTX 1080 FE can easily go 5x native for GT4 :)

RAZORXKHARA33 commented 8 years ago

Wrong. I use GSOGL and can only get to 3x native (1080p) before I get slowdowns. Maybe it can in GSDX11/10, but not OGL. I use high accuracy blending so that takes a lot of GPU time (the accuracy is much greater than GSDX11/10 has ever achieved, so it's more demanding from a graphical emulation standpoint.

tabnk commented 8 years ago

Unexpected. A GTX 1080 still cannot get above 3x native. Even high accuracy blending should not affect much. Somethings wrong here.

gregory38 commented 8 years ago

It isn't a forum ;) Blending is very costly on the CPU and it also bypass the ROP to do the blending in shader so yeah it could be heavy. Anyway, there are various optimization available to reduce GPU load (I spent most of my time on the CPU side).

Back on the issue, I'm currently thinking what is the best solution to fix the bug. I will try to create a branch with partial atomic support. I need to find which atomic impact the perf. And then see if relaxed atomic can improve the perf. I will ping you when the branch is ready.

RAZORXKHARA33 commented 8 years ago

Sounds great! I did let this start to become a forum-esque thread by responding to tabnk the way that I did, so my b.

gregory38 commented 8 years ago

Could you test this version (MTVU on/off) pcsx2-v1.5.0-dev-927-gd525573-windows-x86.7z.zip

RAZORXKHARA33 commented 8 years ago

Just tried, still stuttering. An easy way to tell if there will be stuttering is to set interlacing to bob-tff and look at the PlayStation 2 logo that appears during startup. Normally it will bob up and down at a constant pace. However, if there is stuttering, then it will bob up and down sometimes sticking to the top or bottom of its range of movement. It's a bit hard to explain, but if you do this in stable 1.4.0 and the latest GIT builds, you should be able to deduce what I mean. I will note that the stuttering isn't quite as bad as before, but it's still very noticeable.

gregory38 commented 8 years ago

Could you test this one, it contains half of the atomic stuff (but it ought to be good) https://ci.appveyor.com/project/gregory38/pcsx2/build/1.1296-atomic-regression-test-v2/job/5j4bvj9v70nky6f6/artifacts

RAZORXKHARA33 commented 8 years ago

Stuttering is gone with this build. I think there needs to be a lot of graphical optimization in general, though. I tested with Gran Turismo 3: A-Spec in the Polyphony Digital Cup Round 9 (Grand Valley Speedway II) and the slowdowns were horrendous. It was always a tough track to render (especially with high-accuracy blending), but the slowdowns were especially bad, even with fast accurate blending. Something must be up with the way that GSdx handles the rendering of light sources in the GT series (even worse in GT4 with texture cache issues and such). Anyways, mini-rant over, this build does not have the stuttering. So the issue was related to atomic?

gregory38 commented 8 years ago

Actually it is an old build but with only half of the atomic update. So it remains at least 1 bad commits on the ~5 remaining atomic change. It reduces a bit the scope. I will try to revert 2 commits on the previous branch tomorrow.

RAZORXKHARA33 commented 8 years ago

Ok. Sounds great! I was actually getting worse slowdowns with this build but that was because I had MTVU disabled. Re-enabling it didn't reintroduce stutter and brought speed back up to what it was in stable 1.4.0.

gregory38 commented 8 years ago

Ok, one more please (available in 10-15 minutes) https://ci.appveyor.com/project/gregory38/pcsx2/build/job/f0w0w2cta761u3c9/artifacts

Again could you test the stuttering with both MTVU enabled and disabled. Thanks you.

Edit: by the way, I hope you have some free time available because I will need various test to check the fix implementation ;)

RAZORXKHARA33 commented 8 years ago

I should be free for a while today. I can't get a hold of the build you just posted, though.

gregory38 commented 8 years ago

Ok could you test the previous build. And tell me the current status.

And much later this branch https://ci.appveyor.com/project/gregory38/pcsx2/build/1.1301-atomic-relax

Normally the branch must be better that master but maybe not perfect.

RAZORXKHARA33 commented 8 years ago

I still don't have access to either of those builds. Which one am I testing?

gregory38 commented 8 years ago

Strange, do you have acces to those one ? https://ci.appveyor.com/api/buildjobs/f0w0w2cta761u3c9/artifacts/pcsx2-v1.5.0-dev-929-g486dda2-atomic-regression-test-1297-vs2015-Win32-AppVeyor.7z

https://ci.appveyor.com/api/buildjobs/xnm48abeihmqdtah/artifacts/pcsx2-v1.5.0-dev-930-g6bfe5b5-master-1302-vs2015-Win32-AppVeyor.7z

RAZORXKHARA33 commented 8 years ago

Yes, just downloaded both, will report back with results.

EDIT: Stuttering on both builds.

gregory38 commented 8 years ago

Ok. Previous link was a link to the bot, then you need to select VS version and then artifact submenu.

Anyway, I'm waiting your feedback on those 2 builds.

gregory38 commented 8 years ago

And then could you test this one too

https://ci.appveyor.com/api/buildjobs/2j8xobcyjt16hhw9/artifacts/pcsx2-v1.5.0-dev-932-g3f34030-atomic-relax-1307-vs2015-Win32-AppVeyor.7z

Thanks you :)

RAZORXKHARA33 commented 8 years ago

All three of the latest builds linked are stuttering. Thankfully, I believe that the major slowdowns brought on by a previous GIT build (not just stuttering) are fixed.

ramapcsx2 commented 8 years ago

Just to be sure: What exactly are you looking for in your testing? I can tell you that PCSX2 at this moment can't produce a frame limiter to 60hz that is good enough for stutter free interlace bobbing. So if you look at the ps2logo for example, checking if it bobs evenly, then this will not work. If it worked once, then it probably has more to do with driver vsync.

RAZORXKHARA33 commented 8 years ago

So it appears to be a framelimiter issue? It only started in GIT builds released around the beginning of March. Maybe a change is causing the driver to handle something differently, causing the stutters. Before the GIT builds that I referenced, the stutters would only occur when Shadowplay was recording or when the emulator was in windowed mode. Now it happens no matter what.

gregory38 commented 8 years ago

:( Did you test with MTVU on or off ? I need to find the bad commit. Here a build based on old code.

https://ci.appveyor.com/api/buildjobs/6eae8viofjfdownc/artifacts/pcsx2-v1.5.0-dev-384-gca8955d-atomic-regression-test-v3-1324-vs2015-Win32-AppVeyor.7z

RAZORXKHARA33 commented 8 years ago

The build that you just linked does not stutter, neither with MTVU on nor off. That build is working very well (barring the usual slowdowns that have been there as far as I can remember). The three builds that you linked roughly 2 days ago all stutter both with MTVU on and off.

I think when I was going through past GIT builds, the first build that I ran into problems with was this one: http://buildbot.orphis.net/pcsx2/index.php?m=get&rev=v1.5.0-dev-401-ge57a75a&platform=windows-x86

That build and this one: http://buildbot.orphis.net/pcsx2/index.php?m=get&rev=v1.5.0-dev-403-g4b00ec9&platform=windows-x86 would not even boot.

The next one (which would boot): http://buildbot.orphis.net/pcsx2/index.php?m=get&rev=v1.5.0-dev-405-g8839632&platform=windows-x86 was the first build where I encountered the stuttering issue.

gregory38 commented 8 years ago

OoO, this build contains most of the atomic code (I need to double check). There are potentially 2 regressions on master :(

gregory38 commented 8 years ago

Another old build https://ci.appveyor.com/api/buildjobs/m9fv8y03v8odhi88/artifacts/pcsx2-v1.5.0-dev-385-g0dffed7-atomic-regression-test-v3-1331-vs2015-Win32-AppVeyor.7z

It is very close of the build 405 except 2 minor changes.

RAZORXKHARA33 commented 8 years ago

No stuttering in this build both MTVU on and off.

gregory38 commented 8 years ago

Just to be sure, could you test the build with GSdx from git ?

RAZORXKHARA33 commented 8 years ago

Just ran a quick lap of Grand Valley Speedway II (sunset) in GT3, which is one of the most graphically demanding tracks to render in GT3 and 4, and no stutters. All I got were the usual slowdowns that happen because the GPU side of things is in need of optimization. I used the GSdx plugin from the latest GIT build available from Orphis's build bot: http://buildbot.orphis.net/pcsx2/index.php?m=get&rev=v1.5.0-dev-937-g31a74ab&platform=windows-x86 Worked just fine, no stutters with MTVU on and off.

gregory38 commented 8 years ago

Ok

gregory38 commented 8 years ago

What about this one? https://ci.appveyor.com/api/buildjobs/1pnxraep7duhvs7x/artifacts/pcsx2-v1.5.0-dev-386-gff84540-atomic-regression-test-v4-1338-vs2015-Win32-AppVeyor.7z

Good or bad ?

RAZORXKHARA33 commented 8 years ago

No stuttering with MTVU on and off. I also tested with the GSdx plugin from later GIT builds and no stuttering there either. GOOD.

gregory38 commented 8 years ago

Not so good. The previous build is the version 405 without the spanish translation (except if I screw up). Above build is vs2015, old 405 build is vs2013.

v1.5.0-dev-405-g8839632     Gregory Hainaut     2016-02-29 22:29:54     Download    Merge: 4b00ec9 3d5c1b4 Merge pull request #1211 from PCSX2/atomix-fetch-correction Core|Common: restore old interlocked add/sub behavior

I'm puzzled

gregory38 commented 8 years ago

So I did a diff and there are some difference. So it is potentially the interaction of severals parameter. I wil post a new build soon. However it could be a vsync story.

https://ci.appveyor.com/api/buildjobs/tylmpbwy0fvq9iko/artifacts/pcsx2-v1.5.0-dev-400-g646212b-atomic-regression-test-v5-1354-vs2015-Win32-AppVeyor.7z

If previous build is bad, could you also test again the build 383 http://buildbot.orphis.net/pcsx2/index.php?m=get&rev=v1.5.0-dev-383-g2d4e2fb&platform=windows-x86 A flag was removed on wx, that impact vsync/tearing and stuff.

        // PCSX2: WS_POPUP causes fullscreen tearing when using OpenGL and the
        // GSPanel rendering area exactly covers the full screen. (always
        // affects stretch mode, but most people have 16:9 monitors, so in
        // general the widescreen 16:9 mode is also affected). Let's remove the
        // window style.
        // newStyle |= WS_POPUP;
RAZORXKHARA33 commented 8 years ago

I tried both builds and they were stuttering with MTVU on/off.

gregory38 commented 8 years ago

ok so issue was before atomic. @turtleli does the above change could be the source of stuttering ?

turtleli commented 8 years ago

It could be. I think WS_POPUP causes the driver (or whatever) to bypass the Desktop Window Manager when OpenGL is used in fullscreen mode, but some users were having issues with screen tearing (#1075). I've never noticed stuttering on my end.

@RAZORXKHARA33 What version of Windows are you using?

RAZORXKHARA33 commented 8 years ago

@turtleli I'm using Windows 10 Pro.

turtleli commented 8 years ago

Is there a chance that it's an issue with your system? If the stuttering issue was more widespread I'm sure more people would have reported it already. It should not be stuttering regardless of whether you're using windowed or fullscreen mode.