How to manage multiple rgb lcd frame buffers?
Posted: Sat Mar 23, 2024 8:15 pm
The RGB lcd panel API maintains it's own buffers, allowing you to double buffer easily. However, to increase performance I need to manually draw to the frame buffer, since I will be executing multiple draw commands on a buffer before it should be displayed on the RGB lcd display (e.g. draw a circle, draw a square, draw a bitmap, all as independent commands that need to be put on the frame buffer in separate calls before being displayed).
I already have the logic coded to manually draw each operation to an RGB565 byte buffer. Today I maintain my own buffer and upon frame completion I call to push that frame to the RGB LCD. This causes a PSRAM to PSRAM copy, making things slow.
It would be better to directly draw to the byte buffer maintained by the rgb lcd API. While you can tell the API to create multiple buffers and use to get all the frame buffers, there's no way to know which frame buffer is safe to draw to. We don't want to draw to fb0 if that's feeding the display, as we will get tearing and artifacts when performing draw operations on the next frame.
Likewise, even if we know which frame buffer to draw, it's not clear how we tell the API how to switch which one is active.
So is there a way to know which frame buffer is actively being drawn to the lcd, and if so how do I tell the API to switch?
I already have the logic coded to manually draw each operation to an RGB565 byte buffer. Today I maintain my own buffer and upon frame completion I call
Code: Select all
esp_lcd_panel_draw_bitmap()
It would be better to directly draw to the byte buffer maintained by the rgb lcd API. While you can tell the API to create multiple buffers and use
Code: Select all
esp_lcd_rgb_panel_get_frame_buffer
Likewise, even if we know which frame buffer to draw, it's not clear how we tell the API how to switch which one is active.
So is there a way to know which frame buffer is actively being drawn to the lcd, and if so how do I tell the API to switch?