flycast icon indicating copy to clipboard operation
flycast copied to clipboard

[Request]Support for smooth Vsync on 120hz refresh rate

Open Immersion95 opened this issue 3 years ago • 26 comments

I moved on from 60hz to 120hz screen and I have a problems with juddering.

Retroarch fixes this by allowing to change the Vsync swap interval to 2 but I can't find any solution for standalone.

Thanks !

Immersion95 avatar Jul 07 '21 12:07 Immersion95

Why would a 120 Hz refresh rate cause any issue? Vsync will wait until the next screen refresh to display the current frame. This wait time will be lower than with a 60 Hz refresh rate.

Can you post a video of the issue?

flyinghead avatar Jul 20 '21 21:07 flyinghead

Here is a video and the log.

flycast.log Video here

Enabling or disabling Vsync doesn't change anything, I'm using Vulkan.

Immersion95 avatar Jul 30 '21 07:07 Immersion95

Is there anything else I can help with ?

Immersion95 avatar Aug 03 '21 16:08 Immersion95

Thanks for the video. I think I know what the problem could be but I don't have a 120 Hz display to test with.

I'll have a look at retroarch's code to see if I can implement something similar in standalone.

flyinghead avatar Aug 05 '21 08:08 flyinghead

Hi,

There are 2 ways that RA is handling it :

-Vsync swap interval to 2 or -Sync to exact content framerate --->Best solution as it run the original framerate inside the 120hz (can also trigger VRR if supported).

Immersion95 avatar Aug 06 '21 10:08 Immersion95

Question which has nothing to do with this issue : I saw a libretro branch which is built in your bot but with an .exe instead of .dll. Is it a libretro rebase ? How can I use it ?

Immersion95 avatar Aug 06 '21 21:08 Immersion95

You can grab the flycast core dll here: https://github.com/flyinghead/flycast/actions/workflows/c-cpp.yml

Get the flycast-libretro-x86_64-w64-mingw32 artifact from the latest run on the libretro branch.

flyinghead avatar Aug 06 '21 21:08 flyinghead

You can grab the flycast core dll here: https://github.com/flyinghead/flycast/actions/workflows/c-cpp.yml

Get the flycast-libretro-x86_64-w64-mingw32 artifact from the latest run on the libretro branch.

Thx a lot !

Unfortunately your build also crashes like the official core on my AMD 6800 card. Standalone works great though.

Immersion95 avatar Aug 08 '21 11:08 Immersion95

The last build on the libretro branch has a tentative fix for 120 Hz displays. Can you give it a try?

It should detect that your display is refreshing at 120 Hz and set a swap interval of 2.

flyinghead avatar Aug 23 '21 15:08 flyinghead

Tried the libretro .exe build from the buildbot but it doesn't work. There is no option to activate it.

Immersion95 avatar Aug 23 '21 19:08 Immersion95

There's no visible option: If VSync is enabled and the monitor refresh rate is 120 Hz, it should use a swap interval of 2 instead of 1.

flyinghead avatar Aug 23 '21 19:08 flyinghead

I'm sorry but it doesn't work

Immersion95 avatar Aug 23 '21 19:08 Immersion95

I just realized you're using Vulkan and this change won't work with it. Can you try Open GL instead?

flyinghead avatar Aug 23 '21 19:08 flyinghead

Yes it does work ! What about Vulkan then ?

Immersion95 avatar Aug 23 '21 19:08 Immersion95

Is it 60 fps with Vswap 2 or 59.94 with Vswap 2 ?

Immersion95 avatar Aug 23 '21 19:08 Immersion95

One step at a time. At least we know it works for Open GL, then I can figure out a similar solution for Vulkan.

It's only using a swap interval of 2 so the actual frame rate should be half of your monitor refresh rate.

flyinghead avatar Aug 23 '21 19:08 flyinghead

Thx a lot ! I kid you not, Ikaruga isn't running fullspeed at 4k with the 6800 and OpenGL (shitty Windows drivers).

Immersion95 avatar Aug 23 '21 19:08 Immersion95

Hi, sorry to bother you again :p. Can this be implemented in Vulkan ? Playing in 120hz is impossible now.

Immersion95 avatar Oct 17 '21 20:10 Immersion95

So far the only solution I have for Vulkan relies on an extension (VK_GOOGLE_display_timing) that's not widely supported except on mobile.

flyinghead avatar Nov 05 '21 10:11 flyinghead

It works great !

Only problem : Fast forward crashes frequently

Immersion95 avatar Nov 10 '21 22:11 Immersion95

Thanks for testing and reporting.

In case of crash, a .dmp file should be generated in your temp directory (%USERPROFILE%\AppData\Local\Temp by default on Windows.) Can you attach the most recent one to this issue?

Does the crash happen when switching to fast forward, when switching back to normal, or during fast forward? Are you using single-threaded mode or multi-threaded?

flyinghead avatar Nov 11 '21 08:11 flyinghead

flycast.zip Here are the requested dmp files. It crashes when activating fast forward and I'm on multi-threaded. I also attached the config file.

Immersion95 avatar Nov 11 '21 10:11 Immersion95

Good idea to also include your config file. Unfortunately I looked at all the crashes and they all happen at the same location, deep inside the AMD vulkan driver, so it doesn't help much.

When fast forward is enabled, the swap chain is recreated, the swap interval is reduced to 1 (the normal value) and vsync is disabled. I don't know why duplicating frames prior to that would make the driver crash but I'll keep looking.

flyinghead avatar Nov 11 '21 13:11 flyinghead

I have a laptop with a 240hz monitor and an external 165hz monitor

When streaming and activating the OBS on the monitor and playing on the external display, it doesn't look smooth.

I imagine that with the work they are doing, the problem could be solved.

I will be attentive to the progress and if I can help you in something, let me know.

LetramChi avatar Nov 12 '21 16:11 LetramChi

Dreamcast and Naomi output video at 60 Hz. So it won't be smooth on a 165 Hz monitor (165 isn't a multiple of 60). Set your external monitor to 120 Hz or 60 Hz if possible.

flyinghead avatar Nov 12 '21 18:11 flyinghead

When playing everything well, the problem is when I want to capture or stream, it is there when the flycast screen is not fluid/smooth.

For now, deactivate VSync and it's better

LetramChi avatar Nov 12 '21 18:11 LetramChi

Should I close this issue ? It's fixed for me.

Immersion95 avatar Sep 02 '22 13:09 Immersion95