Menu

#156 vsync support to reduce tearing

open
nobody
6
2008-01-14
2008-01-14
No

It would be nice to have vsync support in openMSX, to reduce the tearing effect. Emulators like blueMSX have it as well.

See also diedel's request: http://vampier.net/forum/viewtopic.php?f=4&p=1009#p1009

AFAIK SDL supports waiting for vblank. Please comment.

Discussion

  • SD Snatcher

    SD Snatcher - 2009-03-07

    That would be a nice feature, because when you're developing an MSX game/demo on a emulator, its hard to tell if its your routine that's out of sync (thus causing tearing) or the emulator is causing it.

    This vsync feature can be implemented in both static and dynamic ways.

    - Static-vsync is mainly targeted for developers (like the situation I mentioned on the beginning) and for no-tearing zealots.
    - Dynamic-vsync is targeted for gamers. If the fps drops for less than 60fps (50fps for euro machines), the vsync is automatically disabled. When it gets back to 60fps, the vsync is enabled again. Dynamic probably would be the default.

     
  • Manuel Bilderbeek

    According to this post, it should work (at least on OS X): http://www.msx.org/forumtopicl11418.html

    Many people request this, maybe it's worth investigating again?

     
  • Maarten ter Huurne

    In the non-GL renderer we can request a hardware surface and double buffering, SDL will then sync the flip to vsync if possible. In the past when I tested this it didn't work on any output driver except the framebuffer, but many things have changed both in SDL and in the platforms it runs on so it's worth checking again.

    In the GL renderer we can set the attribute SDL_GL_SWAP_CONTROL to 1. However, according to the documentation this is the default value. It's worth double checking, because SDL docs and implementation are not always in agreement.

    Note that blueMSX also has a mode in which it requests how far along the host frame is and uses that to interpolate between two MSX frames. SDL does not offer a call to request that information, but we might be able to approximate it by storing the time at which SDL_Flip() returns for several frames in a row.