MiSTer-devel / Main_MiSTer

Main MiSTer binary and Wiki
GNU General Public License v3.0
3.02k stars 325 forks source link

HD scaler flips to older render buffers when adjusting framerate when display is flipped (Vert) #505

Open AtomicShroom opened 2 years ago

AtomicShroom commented 2 years ago

There is something broken about how the HD scaler adjusts for refresh rate difference between core and TV, causing it to flip to older/outdated frame buffers, essentially displaying a frame buffer that is older than the one previously shown. This is like the game going back in time for a frame.

This is when using vsync_adjust=0.

You can easily notice this in Arkanoid (Arcade), since the ball moves in a consistent manner. Ever so frequently, the ball moves in reverse for a single frame. This should never happen.

I have recorded a video and slowed it down so you can easily see this error in action:

https://youtu.be/VLTznbuuzl0

I have confirmed this glitch on 3 different TVs of 3 different brands and age.

sorgelig commented 2 years ago

do you see this issue if Arcanoid display video horizontally on HDMI?

AtomicShroom commented 2 years ago

Ah!!! You’re right! The glitch doesn’t happen when set to Horizontal! Only when set to Vertical!

AtomicShroom commented 2 years ago

I'm noticing something similar on the PSX core but I'm not sure if it's related. Seems like it might be:

When the core switches from 240p to 480i, you will see a frame that dates back to the last time 480i was used.

For example when booting Silent Hill, you will see the PSX bios startup which is 480i, then the game takes over and switches to 240p to display an image that says "There are violent and disturbing images in this game", then it switches back to 480i to display the Konami logo. And at that time, you will see a single frame of the PSX bios. Seems abnormal that a render from 5 seconds ago is still residing in a frame buffer somewhere.

I've attached a video that shows this, and slowed it down so you can see it well:

https://youtu.be/wng9i_LUTgQ

Please let me know if it's something different and if a separate ticket should be created.

birdybro commented 2 years ago

That issue with the PSX core is something different I think... There are a few games like that which don't clear the PSX's internal framebuffer completely yet, some games even keep the PSX bios in the background persistently through a few intro logos, etc...

https://github.com/MiSTer-devel/PSX_MiSTer/issues/40 - is one similar example

https://github.com/MiSTer-devel/PSX_MiSTer/issues/56 - another example of this

EDIT: On second thought I see your conversation with Robert in the discord server about this back on 6/30/2022. It might actually be in the scaler according to him:

image image image

AtomicShroom commented 2 years ago

Could it be something like: since 240p only fills 240 lines, it overwrites the first 240 lines of the framebuffer, and leaves the remaining 240 lines (of the previous 480i) untouched? Meaning that one field of the PSX bios just never gets flushed until it switches to 480i again, which is why we get to see it for one frame?