Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit d3150f5a authored by TreeHugger Robot's avatar TreeHugger Robot Committed by Android (Google) Code Review
Browse files

Merge "SF: Interleave writes to HWC with other work"

parents fa6b41dc 05ed22e7
Loading
Loading
Loading
Loading
+7 −24
Original line number Diff line number Diff line
@@ -1852,24 +1852,13 @@ void SurfaceFlinger::calculateWorkingSet() {
    const bool updatingGeometryThisFrame = mGeometryInvalid;
    mGeometryInvalid = false;

    {
        // Use a map so that we latch the state of each front-end layer once.
        std::unordered_map<compositionengine::LayerFE*, compositionengine::LayerFECompositionState*>
                uniqueVisibleLayers;

        // Figure out which frontend layers are being composed, and build the unique
        // set of them (and the corresponding composition layer)
    // Latch the frontend layer composition state for each layer being
    // composed.
    for (const auto& [token, displayDevice] : mDisplays) {
        auto display = displayDevice->getCompositionDisplay();
        for (auto& layer : display->getOutputLayersOrderedByZ()) {
                uniqueVisibleLayers.insert(std::make_pair(&layer->getLayerFE(),
                                                          &layer->getLayer().editState().frontEnd));
            }
        }

        // Update the composition state from each front-end layer.
        for (auto& [layerFE, state] : uniqueVisibleLayers) {
            layerFE->latchCompositionState(*state, updatingGeometryThisFrame);
            layer->getLayerFE().latchCompositionState(layer->getLayer().editState().frontEnd,
                                                      updatingGeometryThisFrame);
        }
    }

@@ -1909,13 +1898,7 @@ void SurfaceFlinger::calculateWorkingSet() {
            // Update the composition state of the output layer, as needed
            // recomputing it from the state given by the front-end layer.
            layer->updateCompositionState(updatingGeometryThisFrame);
        }
    }

    for (const auto& [token, displayDevice] : mDisplays) {
        auto display = displayDevice->getCompositionDisplay();

        for (auto& layer : display->getOutputLayersOrderedByZ()) {
            // Send the updated state to the HWC, if appropriate.
            layer->writeStateToHWC(updatingGeometryThisFrame);
        }