joshiemoore/snakeware

RPi SnakeWM Performance Issues

joshiemoore opened this issue · 3 comments

We have released a Raspberry Pi 4 image in v0.0.5, and everything runs and works. However, the performance in SnakeWM is noticeably sluggish. I have been testing snakeware on a 2004 ThinkPad that has similar specs to the RPi 4 (and half the RAM) and it runs fine, but the performance on the Pi is significantly worse. On desktop SnakeWM runs at a pretty consistent 60FPS at idle, but on the Pi the FPS drops to ~45 idle.

This is the most significant setback we have yet faced, as I believe snakeware would excel on these SBCs if we could work out the performance issues. The basic apps like snakecalc run fine, but any graphic-intensive apps like dazzler or the dynamic backgrounds really bring the system to a crawl.

I am now running a very aggressive overclock on my Pi locally, here are the relevant performance options I have set in config.txt:

gpu_mem=512

over_voltage=6
arm_freq=2140
gpu_freq=750

This overclock helps quite a bit, and brings the idle FPS up to ~55, but it is still noticeably sluggish when running apps.

snakeware is very snappy and fun on desktop, and I think that it will be really special if we can bring this experience to the Pi as well. Please share any ideas on this issue, or open a PR if you find a good performance tweak. It's clear that "overclock the crap out of it" is not going to solve all of our problems, and that additional underlying changes will be required to achieve performance that comes close to desktop.

Since we are using Pygame in full-screen mode only at all times, there turns out to be a flag we can set called pygame.HWSURFACE which utilizes the device's video hardware to perform graphics acceleration, and this apparently works on the Raspberry Pi. There are a number of other flags we can experiment with as well, but this looks to be exactly what we need. I'm going to look into this later and report results.

Do you have a serious cooling solution for the RPi? I read that it overheats and throttles the CPU speed even without overclocking [1].
I haven't been able to test Snakeware on RPi myself yet since I've been travelling this week, but I'll try to do that soon.

[1] https://www.jeffgeerling.com/blog/2019/best-way-keep-your-cool-running-raspberry-pi-4

I think you should consider switching Snakeware to PyGame 2 (and therefore SDL2) as soon as possible. It is so much better! It certainly solved crashes I had on Linux with 1.9.6 related to PulseAudio; performance is probably also better. And supposedly SDL2 has better support for hardware acceleration, so it might help the RPi.

PyGame 2.0.0.dev10 is still in beta, but is quite usable. No crashes for me so far...