该函数中调用了很多 SurfaceFlingerBE 的函数,BE 可能指的是 Backend?我们先看下面的代码段。

void SurfaceFlinger::postComposition() {
    const auto* display = ON_MAIN_THREAD(getDefaultDisplayDeviceLocked()).get();
    ...
    mPreviousPresentFences[1] = mPreviousPresentFences[0];
    mPreviousPresentFences[0].fence =
            display ? getHwComposer().getPresentFence(display->getPhysicalId()) : Fence::NO_FENCE;
    ...
    for (const auto& layer: mLayersWithQueuedFrames) {
        const bool frameLatched =
                layer->onPostComposition(display, glCompositionDoneFenceTime,
                                         mPreviousPresentFences[0].fenceTime, compositorTiming);
        layer->releasePendingBuffer(/*dequeueReadyTime*/ now);
        if (frameLatched) {
            ATRACE_NAME("recordBufferingStats");
            recordBufferingStats(layer->getName(), layer->getOccupancyHistory(false));
        }
    }
    ...
    mTransactionCallbackInvoker.addPresentFence(mPreviousPresentFences[0].fence);
    mTransactionCallbackInvoker.sendCallbacks();