Roger-random / ESP_8_BIT_composite

Color composite video code from ESP_8_BIT as an Arduino library
MIT License
125 stars 15 forks source link

Update frame buffer pointer upon completion of rendering a frame #5

Closed Roger-random closed 3 years ago

Roger-random commented 3 years ago

When video_isr() renders beyond _active_lines it should be safe for us to swap out the _lines frame buffer pointer for another. This mechanism will allow functionality like double-buffering, which completely eliminates video tearing, compared to waitForFrame() which could only reduce it.

Software design questions for this advanced scenario:

Related:

Roger-random commented 3 years ago

Design change in the spirit of Arduino of keeping API simple

Original plan was a very powerful and flexible system for frame buffer management.

New plan is a double-buffer implementation where the user doesn't have to worry about managing frame buffers. They can keep drawing just as they have before and everything just works. Some performance is left on the table with this model, but ease of use was deemed more important than raw power.

Now with double-buffering there is more time available to draw each frame, and there will never be visible flickers. If a frame takes too long to draw, the previous frame will continue to be shown. There may be a stutter in animation, but that is far better than visible flickers.

Additional behavior change:

Initial implementation in d1453a394467b73a9dcd39e8f2d31d09240fa410 with further refinements to follow.