1.1.1 Postframebuffer
In the multiple buffer mechanism, only the display data can be written to the framebuffer to truly display on the physical screen. The output from the previous sections is backbuffers, and we need a final step to--postframebuffer.
void Surfaceflinger::p ostframebuffer ()
{...
Const DISPLAYHARDWARE&HW (graphicplane (0). Displayhardware ());
...
Hw.flip (mswapregion)//switch front and back table buffer
size_t numlayers =mvisiblelayerssortedbyz.size ();
for (size_t i = 0; I <numLayers; i++) {
Mvisiblelayerssortedbyz[i]->onlayerdisplayed ();
}
...
}
Think about this from the perspective of the OpenGL local window:
Queuebuffer
Once the "producer" completes production, it needs to re-enter the current buffer so that the "consumer" can do the next processing
Dequeuebuffer
For the "producer" to continue the next round of work, it will deque again
The basic idea is this, but the Android system encapsulates some of the steps into the displayhardware, which we'll see later.
When the Displayhardware::flip is complete, the respective notices are visible layer their contents have been shown.
void Displayhardware::flip (const region& Dirty) const
{...
Mpageflipcount++;//flip Count
if (mhwc->initcheck () = = No_error) {
Mhwc->commit ();
} else {
Eglswapbuffers (dpy, surface);
}
...
}