Overview
FM4, S6E2DH/S6E2DF/S6E2D5/S6E2D3 Series, 32-Bit Microcontroller, Graphic Driver User Manual, Doc. No. 002-04387 Rev. *A
24
// Switch foreground and background buffer id.
pdbWin->id = (pdbWin->id == 0) ? 1 : 0;
return
MML_OK;
}
// Here is the calling render loop.
main
{
DOUBLE_BUFFERED_WINDOW win_struct;
// Init variables, open window, ...
// Bind new background buffer to render context.
mmlGdcPeBindSurface(&ctx, MML_GDC_PE_STORE |
MML_GDC_PE_DST, &win_struct.sFramebuffer[win_struct.id]);
// Render the first frame.
mmlGdcPe..
mmlGdcPe..
mmlGdcPe..
// Reset the sync.
mmlGdcSyncReset(&win_struct.sync);
// Get a sync object for the first blit operation.
mmlGdcPeSync(&win_struct.sync);
while
()
{
// Proceed with any non-graphics related operations.
do_anything();
// Call the render routine.
// Note that the draw function will only render new content if a frame swap
// was executed. Otherwise the draw function will return immediately so that
// do_anything() is called again.
draw(&win_struct);
}
}
The draw() function starts rendering if the previously rendered buffer becomes visible. The application can push all
render instructions in the queue, adds a sync instruction that the next buffer swap has to wait for blit complete and
assigns the new buffer to the window. Afterwards the CPU can handle other tasks. Please note that the command
sequencer queue (see mmlGdcSysSetInstructionBuffer()) must be big enough to store all blit operations.