Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve frame pacing when using Original graphics mode. #451

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

onda88
Copy link

@onda88 onda88 commented Jun 19, 2020

discussion here: "https://forum.devchroma.nl/index.php/topic,112.45.html"

credits to CruelTott

@andrebrait
Copy link
Contributor

Not fully related to this, but since I see mentions of Vsync here, is there any way not to get tearing and flashing subtitles in games with Adrenaline? I tried multiple filter combinations, with and without wifi on, but it always happens.

It's not just tearing, the animations actually go backwards a but sometimes. In games like Daxter and the God of War games the cutscenes are bizarrely awkward. I have a PSP and none of that happens in it, which means the games themselves are fine.

I tried this version (I got the module from the forum you linked) and it didn't help either.

Vita slim running Enso 3.65 and a SD2VITA.

@andrebrait
Copy link
Contributor

andrebrait commented Aug 7, 2020

@onda88 @CruelTott Since the goal might be performance, you guys might like what I found out here: frangarcj/vita2dlib#7

libvita2d on the fbo branch was being built (at least by default) with debug options (-Og -g -DDEBUG_BUILD) instead of the -O3 from master.

I don't know how important this would be @TheOfficialFloW, but might be something you want to know (or something I completely missed the mark at).

@TheOfficialFloW
Copy link
Owner

Thanks for the investigation, I'll look into it this weekend!

sceDisplayWaitVblankStart();
if (config.graphics_filtering == 0) {
sceKernelDelayThread(4 * 1000);
sceCompatLCDCSync();
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this needed if no rendering is being done here?

@CruelTott
Copy link

Using a delay is probably not the right thing to do.

I just stumbled upon it helping when I was trying to figure out why scrolling in PSX games was so juddery when not using a filter.

I initially just added the LCDCSync() to match the one further down in the code that is skipped over if filtering is disabled, since that was the only difference in synchronization I could find between filtered and unfiltered.
But that didn't help, so I just added a delay.

Almost any value for delay helps, but some are slightly better, but none are perfect. So there is probably some better way to do it.

@andrebrait
Copy link
Contributor

The sync at the end of the loop probably was never executed anyway because adrenaline->pops_mode would be 1.

It might be worth checking what happens with the AdrenalineDraw thread removed from the code.

@rsn8887
Copy link
Contributor

rsn8887 commented Sep 12, 2020

I am still getting the occasional screentear or micro stutter with PSP and PS1 games, on VitaTV. On handheld Vita, I don’t get screentears, but I still get microstutters with smooth PS1 games like Rayman, which is perfectly smooth on real PSP.

Changing graphics modes like filtering shader or filtering original changes the amount of stutters/tear, but it never goes away completely, not even with filter set to Original.

For example, in Rayman first level, if you walk left or right for a few seconds, there will always be a microstutter in the scrolling. On PSP it remains perfectly smooth always.

EDIT: I am not sure anymore that the Rayman scrolling micro stutters are an Adrenaline problem. I just read on a forum that it also happens with the official Rayman Vita purchased from PSN.

@kristianity77
Copy link

The Rayman stutter is not there on the official psn release as I bought it a couple of months ago to test out this stutter issue. It's also not there in the alundra PSN release either.

I've mentioned before on other forums, this issue of stutter is 100 percent tied to sound somehow. The stutter in alundra for example goes hand in hand with certain drum beats in the soundtrack. In Rayman, it's the same, certain sound effects trigger the stutter.

@jeknight1
Copy link

Any plans to fix the crash when utilizing the camera?

@TheShadowRunner
Copy link

Is it known if this patch been implemented ?
The frame skipping / pacing is so pronounced with Adrenaline I thought my setup had an issue XD

To make sure I bought a couple Ps1 games from PSN: Einhander, Zanac X Zanac, and the difference between native PS1 emulation and Adrenalin, for the same games @ original PS1 driver settings, is absolute night and day.

Native emulation is flawless and Adrenaline a mess when it comes to smoothness.

Oh how I wished TheFlow had developed a very much needed NoPspEmuDrm instead. As much as seeing the PSP XMB running on Vita is crazy neat, the same can't be said for actually running games (at least all those I tried).

I certainly hope TheFlow would reconsider an hypothetical NoPspEmuDrm if possible technically.

@kristianity77
Copy link

Sadly I dont think the PS1 issues on the Vita are ever going to be fixed. Its just a case now I think of PS1 doesnt work properly for whatever reason and it just has to stay that way. There are a load of games that drop frames and its not performance issues, its tied to sound effects somehow as I've created lots of videos proving this, but no one seems to know the solution.

@Zarke669
Copy link

Zarke669 commented May 8, 2021

Too bad, since several games are not present in the PS Store :(

@TheShadowRunner
Copy link

TheShadowRunner commented Jun 12, 2021

So I'm not sure where to report this but hopefully TheOfficialFloW will get to see it.

There seems to be a limitation or oversight regarding the MC Utility in Adrenaline.
It doesn't act exactly the same as in the official emu.

In the official emu, the MC Utility allows to import saves from the current game (MC1 to MC2 / MC2 to MC1) AND from MCs from other games.
But in Adrenaline, the MC Manager only sees the MC1 & MC2 for the current game, the import feature seem crippled and won't allow to import a save from a MC from another game.

Open Adrenalin menu > Open Official Settings > Memory Card Utility > Import.
The left and right arrows only switch between MC1 and MC2 for the current game, it will not switch to other MCs installed on the system.
Doing the same on an official game, the left and right arrows cycle between all the MCs installed on the system.

@Zarke669
Copy link

compared to my psp adrenaline has horrible frame pacing. This is observed on rayman psx.

@Zarke669
Copy link

Rayman SLPS-00026 has no problems.

@kristianity77
Copy link

Rayman does have frame pacing problems when run through adrenaline. Tested on a vita 1000 and 2000. Running the purchased game through PSN and booting from vita homescreen the game runs fine.

This is the same for games like Alundra, symphony of the night etc. This issues has been going on for years and has never been solved despite me going in depth as to what is going on in terms of when frame pacing issues occur and what causes them.

It'll never be fixed

@andrebrait
Copy link
Contributor

Rayman does have frame pacing problems when run through adrenaline. Tested on a vita 1000 and 2000. Running the purchased game through PSN and booting from vita homescreen the game runs fine.

This is the same for games like Alundra, symphony of the night etc. This issues has been going on for years and has never been solved despite me going in depth as to what is going on in terms of when frame pacing issues occur and what causes them.

It'll never be fixed

Did you test the changes on this PR and saw whether they fixed the issues you had?

@LeonardoMeireles55
Copy link

Rayman does have frame pacing problems when run through adrenaline. Tested on a vita 1000 and 2000. Running the purchased game through PSN and booting from vita homescreen the game runs fine.
This is the same for games like Alundra, symphony of the night etc. This issues has been going on for years and has never been solved despite me going in depth as to what is going on in terms of when frame pacing issues occur and what causes them.
It'll never be fixed

Did you test the changes on this PR and saw whether they fixed the issues you had?

how can i test?

@andrebrait
Copy link
Contributor

@LeonardoMeireles55 you'd need to build it yourself from the source code. I can do that later and post the vpk file here, when I get the chance, later today.

@Zarke669
Copy link

Rayman does have frame pacing problems when run through adrenaline. Tested on a vita 1000 and 2000. Running the purchased game through PSN and booting from vita homescreen the game runs fine.

This is the same for games like Alundra, symphony of the night etc. This issues has been going on for years and has never been solved despite me going in depth as to what is going on in terms of when frame pacing issues occur and what causes them.

It'll never be fixed

try changing these cpu and gpu clocks.
apparently fixed it for me.
a862f25e-46bc-43a9-895d-9d07fc238b94

@andrebrait
Copy link
Contributor

@Zarke669 I've also seen people "fix it" with 444MHz and 222MHz for CPU and GPU.
Are you 100% this is reproducible?

@Zarke669
Copy link

it is fixed only with 222mhz 111mhz 111mhz. in the official psn emulator runs at 333mhz 111mhz 111mhz.

@andrebrait
Copy link
Contributor

@Zarke669 and do PSP games run ok at those frequencies?

@Zarke669
Copy link

@andrebrait yes, now it's perfect. I think the ps vita cpu is used to emulate the audio. apparently high clocks cause frame pacing and frame-skip issues.

@Zarke669
Copy link

can anyone else test?

@shadowknight1620
Copy link

shadowknight1620 commented Jan 27, 2023

can anyone else test?

What are you using to change the clock speed?
PSVshellPlus?

@Zarke669
Copy link

@shadowknight1620
Copy link

shadowknight1620 commented Jan 27, 2023

@shadowknight1620 PSVshellPlus

and testing ps1 games in adrenaline v7.0?
I think I have leecherman's moded version of adrenaline installed.

@andrebrait
Copy link
Contributor

@shadowknight1620 @Zarke669 I'm very interested in that this PR was keant to fix issues only when using the original graphics mode.

Could you test to see if the clock makes any difference when using one of the filtered modes as well?

@Zarke669
Copy link

Zarke669 commented Jan 27, 2023

@andrebrait filter lcd3x, advancedAA require higher gpu clocks causing the same issues.

  • advanceAA gets tearing and slowness on gpu clock 111mhz when setting 222mhz fixes tearing and slowness but causes bad framepacing.
  • I tested it again on rayman and what only causes framepacing problems is exclusively the cpu clock. cpu clock 222mhz = smooth
    444 or 555mhz = framepacing issues.
  • I came to the conclusion that the problem is totally related to cpu clock.

@Zarke669
Copy link

@shadowknight1620 whatever the installed version.

@kristianity77
Copy link

kristianity77 commented Jan 28, 2023

Do you have to use a sepcific version of adrenaline for these clocks to work? I'm on standard 7/0 and have tried the clocks on the vita at 222/111/111. And then in adrenaline im running the emulator at 333/166 and it isnt making any difference. I still get the same stutters. What am i missing here? This is the same no matter what filter I use

@EnekoT2001
Copy link

would love to get a vpk with this pr build tbh, i cant compile it myself and i rlly wanna test many many titles

@andrebrait
Copy link
Contributor

would love to get a vpk with this pr build tbh, i cant compile it myself and i rlly wanna test many many titles

I'll try to build it today and post it here.

I'll also post a build that forces CPU clocks to 222MHz and some other things, so you can test all variations.

@Zarke669
Copy link

Zarke669 commented Jan 29, 2023

@kristianity77 which plugin are you using?

  • I'm using bubbles.

@kristianity77
Copy link

I've tried psvshell 1.1. I have CPU set to 222. Es4 set to 111. Bus set to 111. Xbr set to 111.

@Zarke669
Copy link

I've tried psvshell 1.1. I have CPU set to 222. Es4 set to 111. Bus set to 111. Xbr set to 111.

@kristianity77 just change the cpu so that 222mhz inside the adrenaline or bubble. I performed several tests and it really fixed it. high cpu clocks cause some audio emulation problem causing stuttering.

@andrebrait
Copy link
Contributor

andrebrait commented Jan 29, 2023

Just one note: some of those apps have separate clocks for PSPEmu and Vita modes. Be sure you're changing the correct section.

@Zarke669
Copy link

something interesting frameskip works best with cpu clock 222mhz.

@Zarke669
Copy link

Zarke669 commented Jan 29, 2023

@kristianity77 PSVshellPlus to force 222mhz cpu(vita).

@andrebrait
Copy link
Contributor

@Zarke669 @kristianity77 @EnekoT2001 @shadowknight1620 here are 4 builds of Adrenaline.

  • default file is just Adrenaline 7 built against the latest Vita SDK.
  • github_pr451 is the fix proposed in this PR, with no clock changes.
  • underclocked is just a fixed underclock to 222/111/111/111 at the start. Changing filters won't affect clocks, unless you manually change them. It applies the underclocking for both PS1 and PSP modes and won't adjust anything automatically.
  • underclocked_dynamic is the same as the previous one, but it will change clocks when you enable filters, back to whatever they were before. It only applies the underclocking to PS1 mode and while using the Original screen mode.

@EnekoT2001
Copy link

@Zarke669 @kristianity77 @EnekoT2001 @shadowknight1620 here are 4 builds of Adrenaline.

  • default file is just Adrenaline 7 built against the latest Vita SDK.
  • github_pr451 is the fix proposed in this PR, with no clock changes.
  • underclocked is just a fixed underclock to 222/111/111/111 at the start. Changing filters won't affect clocks, unless you manually change them. It applies the underclocking for both PS1 and PSP modes and won't adjust anything automatically.
  • underclocked_dynamic is the same as the previous one, but it will change clocks when you enable filters, back to whatever they were before. It only applies the underclocking to PS1 mode and while using the Original screen mode.

Thank you so much!! Im gonna test it now, also, i can just use the one without clock changes and change them manually with psvshellplus right?

@andrebrait
Copy link
Contributor

@Zarke669 @kristianity77 @EnekoT2001 @shadowknight1620 here are 4 builds of Adrenaline.

  • default file is just Adrenaline 7 built against the latest Vita SDK.
  • github_pr451 is the fix proposed in this PR, with no clock changes.
  • underclocked is just a fixed underclock to 222/111/111/111 at the start. Changing filters won't affect clocks, unless you manually change them. It applies the underclocking for both PS1 and PSP modes and won't adjust anything automatically.
  • underclocked_dynamic is the same as the previous one, but it will change clocks when you enable filters, back to whatever they were before. It only applies the underclocking to PS1 mode and while using the Original screen mode.

Thank you so much!! Im gonna test it now, also, i can just use the one without clock changes and change them manually with psvshellplus right?

Technically yes, but it would be useful if you could also test the ones with underclocking afterwards so we could check if it's a workaround that can be implemented in the code, and maybe an extra menu option.

@EnekoT2001
Copy link

I have a problem now tho, i cant get it to work, im using the Adrenaline_7_github_pr451.vpk one

I tried replacing the files manually just how the readme says in the how to update section and it gives me an error when opening it, i tried removing the adrenaline_kernel.skprx from loading in my tai config and it opens and closes like usual and then when i open it again same error.

Now I uninstalled adrenaline completely and installed it using the vpk directly and if i open it once the menu to download the firmware appears but if i close it and open it again same error, i rebooted and opened it again to at least get the firmware downloaded but after that i cant do anything same error. C1-2758-2, i removed the native resolution patch too in case that had anything to do so idk what to do now, ill try one of the vpks with underclocked clocks too maybe its just this one thats wrong unless im missing something?

@andrebrait
Copy link
Contributor

I have a problem now tho, i cant get it to work, im using the Adrenaline_7_github_pr451.vpk one

I tried replacing the files manually just how the readme says in the how to update section and it gives me an error when opening it, i tried removing the adrenaline_kernel.skprx from loading in my tai config and it opens and closes like usual and then when i open it again same error.

Now I uninstalled adrenaline completely and installed it using the vpk directly and if i open it once the menu to download the firmware appears but if i close it and open it again same error, i rebooted and opened it again to at least get the firmware downloaded but after that i cant do anything same error. C1-2758-2, i removed the native resolution patch too in case that had anything to do so idk what to do now, ill try one of the vpks with underclocked clocks too maybe its just this one thats wrong unless im missing something?

Maybe the new version of the SDK broke it, or something like that. I need to test it myself too. I didn't have time to test them, only to build.

I guess the fix for the newlib didn't work so well.

@EnekoT2001
Copy link

No worries, i tested all of them except for the dynamic one and they all show the same problem for me, i even tried to install the normal adrenaline and just replace the sce_modules folder and same problem so its not the eboot or whatnot in case it helps, thank you for compiling them tho, i hope you can figure out whats wrong easily, if it helps i can test stuff for u tbh just send me links and i can try it on my vita

@andrebrait
Copy link
Contributor

@Zarke669 @kristianity77 @EnekoT2001 @shadowknight1620 here are the fixed VPKs.

There's a new variant which is experimental_661 which is just me adjusting what I think are bad compiler flags. Probably doesn't make any difference, but hey, why not test, right?

Let me know the results.

Please use the module replacement method instead of installing the VPKs directly, since that will wipe your firmware and downloading 661.PBP from Sony's servers doesn't seem to be working right now.

@andrebrait
Copy link
Contributor

@LeonardoMeireles55 @CruelTott @onda88 see the comment above and let me know if you can also give these different workarounds for this issue a try.

For everybody testing, could you provide the game you're testing and, if a save file is needed, the virtual memory card files for the games that display issues?

@EnekoT2001
Copy link

hey sorry just saw this, ive been very busy, i tried the experimental one bc it was the most intriguing to me and on normal psp resolution ti does seem to offer better frame pacing on the sims 2 (is the game im kinda playing regularly now so it was a good way to test), i do play it with the native vita resolution patch and after enabling that it doesnt seem to improve but thats probably bc the gpu itself cant render as many frames, when i have some more time ill test some more games and compare the different versions you provided, tysm !

@andrebrait
Copy link
Contributor

@EnekoT2001 experimental is actually the most boring one 😅 it's literally just one compiler flag changed and it shouldn't matter, but since I built it, it's there

@EnekoT2001
Copy link

Oh for real? So there’s no code change relating to frametimes and such? I’m gonna check another one real quick rn

@EnekoT2001
Copy link

Ok I tried the one without the underclock bc I was gonna try changing the clock speeds manually and see if there was any difference, again on sims 2 there doesn’t seem to, on normal resolution it might be a bit better but pretty sure the inconsistencies are just frame drops, on native it’s the exact same I think, tested both in 222 and 500mhz cpu just to test. I’ll try to check some god of war later when I have some time and maybe another game, I’ll keep you posted

@LeonardoMeireles55
Copy link

LeonardoMeireles55 commented Feb 7, 2023

@andrebrait just leaving the vita's cpu set to 222mhz solved all the problems. I always compare it with my psp and it works exactly the same in terms of framepacing.

  • It's important to remember that it's normal to have slowdowns in some psp and psx games, they happen on psp too. this fixes the stutters.

@andrebrait
Copy link
Contributor

@andrebrait just leaving the vita's cpu set to 222mhz solved all the problems. I always compare it with my psp and it works exactly the same in terms of framepacing.

  • It's important to remember that it's normal to have slowdowns in some psp and psx games, they happen on psp too. this fixes the stutters.

@LeonardoMeireles55 I get it, but I'd like for you to test the builds I made (specifically the one for this PR and the ones with underclocking) so I can test whether it's safe to have Adrenaline itself set the CPU clock instead of having the user to it externally.

@LeonardoMeireles55
Copy link

@andrebrait
ok.

@andrebrait
Copy link
Contributor

@LeonardoMeireles55 at the very least I need to know the game you're running, specially which version and region and, if possible, a save game (you can zip and send a VMC here)

@LeonardoMeireles55
Copy link

LeonardoMeireles55 commented Feb 7, 2023

@andrebrait
rayman ntsc: tested on Adrenaline_7_github_pr451 still has stutter (I don't know if less than the original adrenaline) but it is corrected by setting 222mhz on the cpu. In this game stuttering is visible in the first stage.

  • "Adrenaline_7_underclock" underclocked only the GPU.
  • "Adrenaline_7_underclock_dynamic" underclocked only the GPU and changes to 222mhz(gpu) when applying filter.

@andrebrait
Copy link
Contributor

@andrebrait
rayman ntsc: tested on Adrenaline_7_github_pr451 still has stutter (I don't know if less than the original adrenaline) but it is corrected by setting 222mhz on the cpu. In this game stuttering is visible in the first stage.

  • "Adrenaline_7_underclock" underclocked only the GPU.
  • "Adrenaline_7_underclock_dynamic" underclocked only the GPU and changes to 222mhz(gpu) when applying filter.

@LeonardoMeireles55 huh, weird. I actually did set the clocks for the CPU too in the code.

Have you disabled whatever you're using for setting clocks?

@LeonardoMeireles55
Copy link

yes, I left everything in stock.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.