Double Buffering - mchpgfx/legato.docs GitHub Wiki
Legato vs Aria
Double Buffering:Aria: Single Buffer
The draw algorithms can paint pixels directly into the display frame buffer in Aria Graphics Library. This the most simplistic method and requires the least amount of memory. The drawback is visually observable screen tearing, since the display controller has to refresh the display at a much higher rate than the pixels are updated by the draw algorithms.
Aria: Double Buffer
Screen tearing can be eliminated by using two frame buffers. This scheme doubles the memory requirement.
In the DRAW phase, the draw algorithms update the back/write buffer. The display controller reads from front/read buffer.
In the SWAP phase, the buffers roles are swapped at V-BLANK. The front/read buffer is now the back/write buffer for the draw algorithms and the display controller reads from the former back/write buffer, now the front/read buffer.
In the SYNC phase, the draw algorithm applies the same updates to the former front/read buffer such that the content from both buffers are in-sync.
Legato: Virtual Double Buffer
To help minimize screen tearing, Legato's draw algorithms paint to a tiny scratch/back buffer. The scratch/back buffer is then copied into the frame buffer using fast bulk transfer techniques. The size of the scratch/back buffer is configurable in the MGS Harmony Composer. Depending on the performance of the graphics hardware technology and the GUI design requirement, this adjustment may be enough to eliminate screen tearing. This 'virtual double buffering' scheme can use less memory than double buffering.
Legato: Double Buffer
For absolute elimination of screen tearing, Legato can be configured to full double buffering.
In the DRAW phase, the scratch/back buffer(s) are copied to the back/write frame buffer. The display controller reads from the front/read buffer. The display controller driver keeps track of the rectangular sections of the frame buffer that were updated.
In the SWAP phase, similar to Aria, the buffers roles are swapped at V-BLANK. The front/read buffer is now the back/write buffer for the draw algorithms and the display controller reads from the former back/write buffer, now the front/read buffer.
In the SYNC phase, the display controller driver re-applies the updated sections of the frame from the Front/Read Buffer to the Back/Write Buffer to keep both buffers in-sync.
If you are new to MPLAB® Harmony, you should probably start with these tutorials:
- MPLAB® Harmony v3 Graphics Example Applications at MPLAB® Discover
- MPLAB® Harmony v3 software framework
- MPLAB® Harmony v3 Configurator Overview
- Create a New MPLAB® Harmony v3 Project
Is this page helpful? Send feedback.