-
Notifications
You must be signed in to change notification settings - Fork 1.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add RGBMatrix::DeleteFrameCanvas(FrameCanvas*) #1456
base: master
Are you sure you want to change the base?
Conversation
And associated python bindings Enables the user to direct the RGBMatrix to free FrameCanvas objects to avoid wasting memory
Is there a particular use-case you encountered where you need that ? Having a DeleteFrameCanvas method encourages programming patterns to use canvases in a way that goes beyond double or triple buffering off-screen canvases are meant for, so I would need some convincing. |
The simplified description of my use case is that I am buffering multiple gifs offscreen in an async manner. The "producer" adds some informational overlays (time, weather, etc) and creates a FrameCanvas for each frame in the gif and throws the set of canvases on a queue. |
Did you consider the content streamer ? This format can be stored in memory (what the image viewer does) or even on disk: the video-viewer The reason why creating and deleting frame-canvases is problematic is that they are exceeding the cache size of the Pi, so if you have many of them, cycling through them means they come in 'cold' from the (rather slow) DRAM, resulting in inconsistent frame-rates up to visible flicker. If we only have a few FrameCanvas'es, they can stay in Cache, so the main loop that has to read in a high rate can do so without interruptions. It is cheaper to copy data into an existing FrameCanvas using content streamer than having a FrameCanvas coming in cold from DRAM. |
Thanks for the pointers, I hadn't considered the content-stream. Took at look at the content streamer, and led-image-viewer. I think I could implement something like that on the python side that would work for my use case. The complication being that I also need to be able to interrupt the current stream of gif frames to display frames from other producers (ex: right now I have it showing album art when music start playing) but I can think of a few ways to do that.
This makes some sense, since we are just copying the frame data, and none of the FrameCanvas objects overhead from DRAM -> cache, but its surprising to me that the objects overhead is so large that it causes framerate issues. I'll expose |
this enables usage like in cpp content-streamer
I opened #1457 with the Serialize/Deserialize bindings I would guess that because of all of the overhead from python, and the additional async tasks I have running, the canvas objects we really care about don't hang around in the rpis cache long enough anyway :/ |
And associated python bindings
Enables the user to direct the RGBMatrix to free FrameCanvas
objects to avoid wasting memory