Announce: SmartMatrix::GFX


#1

(TL;DR: swapBuffers on ESP32 is pretty slow, I only get 76fps for 4096 pixels)

I finished my initial hackish port of FastLED::NeoMatrix to SmartMatrix.
It should allow any Adafruit::GFX code to work on SmartMatrix backend with minimal changes. Similarly FastLED::NeoMatrix code should mostly work out of the box too.

Code: https://github.com/marcmerlin/SmartMatrix_GFX
Demo: https://github.com/marcmerlin/SmartMatrix_GFX/blob/master/examples/MatrixGFXDemo/MatrixGFXDemo.ino

I’m doing something terrible which is to render inside a FastLED array buffer to be compatible with existing code, and then copying the entire framebuffer into SmartMatrix, pixel by pixel.
I know it’s terrible but honestly I’m not sure how to do better.

I can’t push and display pixels faster than 74 frames per second for 4096 pixels, which isn’t that good, but it’s usable.

EDIT: I tried to backgroundLayer.swapBuffers(); only (without copying to my FastLED buffer to the SmartMatrix buffer, and it was only 1s faster (75fps). So it is swapbuffer that is slow on ESP32.
I tried swapbuffer zero copy swapBuffers(true), and it’s not measurably faster.

Suggestions welcome :slight_smile:


#2

I just had time to port a bunch of demos to SmartMatrix thanks to the new API layer, see

Demos:


Those demos should work with both SmartMatrix::GFX and FastLED::NeoMatrix thanks to the compat layer.

@Jason might notice the irony that I ported Aurora demos back from SmartMatrix to GFX and then back to SmartMatrix
https://github.com/marcmerlin/SmartMatrix_GFX/tree/master/examples/Aurora
but this version is “better” in that the demos have been split in independent demos that can run on their own, and can be moved from SmartMatrix and to NeoMatrix with a single #define in the top level config.h


#3

Oh, also, @Jason, in case you have a 32x32 or even 64x64 matrix laying around, I’d love for you to have a look at my port of Aurora to check that I haven’t butchered it too much.
Some of the effects I selected look ok-ish in 64x64 but probably not quite like they were meant to originally (scaling up is not always perfect).
For one, I can’t get PatternSwirl.h to have a wider blur around its drawings, and it doesn’t look that great without one (IMO)
Thanks