boydm / scenic_driver_nerves_rpi

Scenic render-only driver for the Raspberry Pi under Nerves
Apache License 2.0
22 stars 12 forks source link

Add frame buffer copying #8

Open cdegroot opened 5 years ago

cdegroot commented 5 years ago

This patch copies every frame to the secondary frame buffer. Needs to run with my Nerves system that includes TFT support. https://github.com/cdegroot/nerves_system_rpi3_tftfb

fhunleth commented 5 years ago

Could you modify this to be disabled by default and require a parameter to enable with the path to the framebuffer?

Also, fprintf's don't get logged. I haven't read the code to see if there's a convenient way of doing this, but funneling them up to Elixir so they can be logged will be needed to help debug issues.

Since you're building your own system, what do you think about adding https://github.com/juj/fbcp-ili9341 and running it in the background? That wouldn't require any code changes here.

cdegroot commented 5 years ago

The problem with running that code in the background is that it won't be synchronized with the rendering loop in Scenic. You run it at some random frame rate that might or might not be the one you want (e.g. for a low power situation you maybe want to update a frame per second, and this thing would still spin away at 30fps in the background). It's a great hack for when you want to run MAME on your mini display, but I think that the extra precision this gives is nice for not too much and non-intrusive code.

Yeah, the fprintf's are definitely more for when debugging on an RPi3 (I developed it that way - have a development Linux system on the RPi3) so I can park them behind DEBUG, remove them, or if you have an idea of how to get them into Elixir, that'd be grand.

About the parameter - I thought about it and it'd be a tiny little bit cleaner but what's the use case for manually setting it? If it cannot find the second framebuffer, nothing happens (well, one empty call to the copy routine but that's never going to bubble up in terms of performance). More than happy to add it though, pointer to how to do it cleanly is appreciated though :)