Emu68-tools
Emu68-tools copied to clipboard
VideoCore.card: intuition ChangeScreenBuffer() is very slow
Hello, first thank you for your efforts . I'm currently porting a MAME emulator using bebbo gcc, mostly for piStorm. It begins to be fast enough to have some games at 60Hz, and I'm trying to implement a "Triple Buffer" the nicest way possible. So I have a code using the "Official intuition way to have nice screen buffering" which is Intuition AllocScreenBuffer() / ChangeScreenBuffer() / FreeScreenBuffer() Documentation is available here: AllocScreenBuffer() is used to create "clones" of the screen bitmap, with same size and pixel format. Then ,ChangeScreenBuffer() is meant to swap the buffer later and optionally send message when done. The thing is, with my P96 drivers and the lastest VideCore.card , ChangeScreenBuffer() does huge slowdown, about 0.05 seconds, which is enough to have my 60Hz framerate slowing down to 20hz... Of course, ChangeScreenBuffer() is meant to just exchange bitmaps (of the same size and pixel format) pointer at some point, and be fast.
The thing is, I have the same P96 version on UAE and on piStorm, and I don't have such slowdown on UAE. I understand there is only the card sources here and no access to anything in the P96 driver, If I get it right. I've looked a bit at the videocore source, and I was wondering if there was some kind of "unnecessary re-initialisation" when ChangeScreenBuffer() occurs, that would explain the slow down, and could maybe be corrected.
hat would be so great to have a fast ChangeScreenBuffer(). I guess if someone does a video player, or any multimedia app, the problem of screen buffers will resurface.
Also: ... before ChangeScreenBuffer() was introduced in OS3, demomaker and game coders sometimes used graphics .library "ScrollVPort()" with a double height intuition screen. I also tried that, and also have a slowdown with it. (a bit faster than ChangeScreenBuffer() it seems)
My triple buffer implementation with ChangeScreenBuffer() is here: https://github.com/krabobmkd/amigamame/blob/beta106/amigamame106/amiga106_video_intuition_tbufcsb.cpp
The latest downloadable version of Mame MiniMix. https://github.com/krabobmkd/amigamame/releases/tag/beta3 There is a free rom with it, so you can just press scan, select "triple buffer CSB" in the Display panel then start. Then in the game press "Help" to display frame per seconds. Thank you again.