djyt/cannonball

Performance in new renderer on Pi4 isn't stable

pjft opened this issue · 12 comments

pjft commented

The older build we were running on the Pi worked flawlessly and smooth, but for some reason in the latest build it isn't.

Previous build was on commit 2b3839d .

There's a somewhat noticeable slowdown on race start for a few seconds before it becomes smooth, but if you turn on scanlines - even if at 10% - you'll see a much more uneven and noticeable framerate drop throughout the first stage.

Happy to provide a video or logs if it suits, as well as try to troubleshoot. I moved the roms to the local storage, just in case it was a file-system access scenario.

djyt commented

Which renderer are you using? OpenGL or OpenGLes?

I'll have a look next time I try a Pi build, but I haven't changed anything with the rendering code directly.

pjft commented

I suspect it might be OpenGLes?

This is how I built it:

git clone https://github.com/djyt/cannonball.git cannonball
mkdir build
cd build/
cmake -G "Unix Makefiles" -DTARGET=pi4-opengles.cmake ../cmake/
make
./cannonball 

If you'd advise my to build it differently I'll gladly test it out, but there seems to be a single pi4 makefile, and it uses OpenGLes (from the name).

djyt commented

I'll have a look again at the weekend when I have my Pi setup near my PC. In theory, nothing should have changed... but will investigate.

@pjft Are you by a chance using the hi-res graphics mode? That's too much for the Pi4.

pjft commented

@vanfanel I am not - indeed High Res mode performs poorly. I am running in Low res, 2x scaling. And, as mentioned, I'm just comparing the performance of the previous build vs this one, using the same settings.

@djyt I have built the enginewith the latest code, and @pjft is right: framerate is VERY bad on the Pi4, inconsistent.
Disabling VSYNC "hides" the problem (but ocassioal hiccups because of the lack of VSYNC happen instead).

My guess: the engine should NOT have internal waits when VSYNC is ON: with VSYNC ON, vsync acts as frame limiter.

EDIT: Looking at src/main/main.cpp it seems that internal waits are disabled when VSYNC is ON... strange.

if (!vsync)

Something is at play, that's for sure.

@djyt the fix has been pushed, please merge this PR:

#117

@pjft Sorry I ignored the issue for so long after answering you. It's now fixed as you can see.

pjft commented

@vanfanel thank you for the reply and for looking into this. Not a bother at all with the timeframe - I know things take time :)

Happy to help.

@pjft Can you please test and confirm on your side so the issue can be closed?
Changes are now merged, just git pull and rebuild.

pjft commented

Hi @vanfanel , thanks for the heads up. I compiled the latest version and from the brief time I played with it it did seem to run smoother, so I am comfortable with closing the issue.

Thanks for addressing this!

@pjft Thaks for the confirmation.
It should be perfectly smooth now, at least it is here.
Even Hi-Res mode runs great!

pjft commented

Oh, I didn't try the hi-res mode, but I will then :)

Thanks! Have a great week.