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

Commit 556a9065 authored by Android Build Coastguard Worker's avatar Android Build Coastguard Worker
Browse files

Snap for 11860797 from 4444737a to 24Q3-release

Change-Id: I7f45d84c663f9bd08dc29485a59af33ffd694ee8
parents 41fb681a 4444737a
Loading
Loading
Loading
Loading
+3 −0
Original line number Diff line number Diff line
@@ -279,6 +279,9 @@ struct layer_state_t {
            layer_state_t::eDropInputModeChanged | layer_state_t::eTrustedOverlayChanged |
            layer_state_t::eLayerStackChanged;

    // Changes requiring a composition pass.
    static constexpr uint64_t REQUIRES_COMPOSITION = layer_state_t::CONTENT_DIRTY;

    // Changes that affect the visible region on a display.
    static constexpr uint64_t VISIBLE_REGION_CHANGES = layer_state_t::GEOMETRY_CHANGES |
            layer_state_t::HIERARCHY_CHANGES | layer_state_t::eAlphaChanged;
+12 −6
Original line number Diff line number Diff line
@@ -41,7 +41,8 @@ void LayerLifecycleManager::addLayers(std::vector<std::unique_ptr<RequestedLayer
        return;
    }

    mGlobalChanges |= RequestedLayerState::Changes::Hierarchy;
    mGlobalChanges |= RequestedLayerState::Changes::Hierarchy |
            RequestedLayerState::Changes::RequiresComposition;
    for (auto& newLayer : newLayers) {
        RequestedLayerState& layer = *newLayer.get();
        auto [it, inserted] = mIdToLayer.try_emplace(layer.id, References{.owner = layer});
@@ -104,7 +105,8 @@ void LayerLifecycleManager::onHandlesDestroyed(
        if (!layer.canBeDestroyed()) {
            continue;
        }
        layer.changes |= RequestedLayerState::Changes::Destroyed;
        layer.changes |= RequestedLayerState::Changes::Destroyed |
                RequestedLayerState::Changes::RequiresComposition;
        layersToBeDestroyed.emplace_back(layerId);
    }

@@ -112,7 +114,8 @@ void LayerLifecycleManager::onHandlesDestroyed(
        return;
    }

    mGlobalChanges |= RequestedLayerState::Changes::Hierarchy;
    mGlobalChanges |= RequestedLayerState::Changes::Hierarchy |
            RequestedLayerState::Changes::RequiresComposition;
    for (size_t i = 0; i < layersToBeDestroyed.size(); i++) {
        uint32_t layerId = layersToBeDestroyed[i];
        auto it = mIdToLayer.find(layerId);
@@ -142,7 +145,8 @@ void LayerLifecycleManager::onHandlesDestroyed(
            if (linkedLayer->parentId == layer.id) {
                linkedLayer->parentId = UNASSIGNED_LAYER_ID;
                if (linkedLayer->canBeDestroyed()) {
                    linkedLayer->changes |= RequestedLayerState::Changes::Destroyed;
                    linkedLayer->changes |= RequestedLayerState::Changes::Destroyed |
                            RequestedLayerState::Changes::RequiresComposition;
                    layersToBeDestroyed.emplace_back(linkedLayer->id);
                }
            }
@@ -249,7 +253,8 @@ void LayerLifecycleManager::applyTransactions(const std::vector<TransactionState
                            layer_state_t::eDataspaceChanged | layer_state_t::eAlphaChanged;
                    bgColorLayer->changes |= RequestedLayerState::Changes::Content;
                    mChangedLayers.push_back(bgColorLayer);
                    mGlobalChanges |= RequestedLayerState::Changes::Content;
                    mGlobalChanges |= RequestedLayerState::Changes::Content |
                            RequestedLayerState::Changes::RequiresComposition;
                }
            }

@@ -407,7 +412,8 @@ void LayerLifecycleManager::fixRelativeZLoop(uint32_t relativeRootId) {
    layer.relativeParentId = unlinkLayer(layer.relativeParentId, layer.id);
    layer.changes |=
            RequestedLayerState::Changes::Hierarchy | RequestedLayerState::Changes::RelativeParent;
    mGlobalChanges |= RequestedLayerState::Changes::Hierarchy;
    mGlobalChanges |= RequestedLayerState::Changes::Hierarchy |
            RequestedLayerState::Changes::RequiresComposition;
}

// Some layers mirror the entire display stack. Since we don't have a single root layer per display
+30 −10
Original line number Diff line number Diff line
@@ -313,6 +313,21 @@ void updateMetadata(LayerSnapshot& snapshot, const RequestedLayerState& requeste
    }
}

void updateMetadataAndGameMode(LayerSnapshot& snapshot, const RequestedLayerState& requested,
                               const LayerSnapshotBuilder::Args& args,
                               const LayerSnapshot& parentSnapshot) {
    if (snapshot.changes.test(RequestedLayerState::Changes::GameMode)) {
        snapshot.gameMode = requested.metadata.has(gui::METADATA_GAME_MODE)
                ? requested.gameMode
                : parentSnapshot.gameMode;
    }
    updateMetadata(snapshot, requested, args);
    if (args.includeMetadata) {
        snapshot.layerMetadata = parentSnapshot.layerMetadata;
        snapshot.layerMetadata.merge(requested.metadata);
    }
}

void clearChanges(LayerSnapshot& snapshot) {
    snapshot.changes.clear();
    snapshot.clientChanges = 0;
@@ -746,6 +761,11 @@ void LayerSnapshotBuilder::updateSnapshot(LayerSnapshot& snapshot, const Args& a
                                 RequestedLayerState::Changes::Input)) {
            updateInput(snapshot, requested, parentSnapshot, path, args);
        }
        if (forceUpdate ||
            (args.includeMetadata &&
             snapshot.changes.test(RequestedLayerState::Changes::Metadata))) {
            updateMetadataAndGameMode(snapshot, requested, args, parentSnapshot);
        }
        return;
    }

@@ -786,16 +806,7 @@ void LayerSnapshotBuilder::updateSnapshot(LayerSnapshot& snapshot, const Args& a
    }

    if (forceUpdate || snapshot.changes.test(RequestedLayerState::Changes::Metadata)) {
        if (snapshot.changes.test(RequestedLayerState::Changes::GameMode)) {
            snapshot.gameMode = requested.metadata.has(gui::METADATA_GAME_MODE)
                    ? requested.gameMode
                    : parentSnapshot.gameMode;
        }
        updateMetadata(snapshot, requested, args);
        if (args.includeMetadata) {
            snapshot.layerMetadata = parentSnapshot.layerMetadata;
            snapshot.layerMetadata.merge(requested.metadata);
        }
        updateMetadataAndGameMode(snapshot, requested, args, parentSnapshot);
    }

    if (forceUpdate || snapshot.clientChanges & layer_state_t::eFixedTransformHintChanged ||
@@ -1164,6 +1175,15 @@ void LayerSnapshotBuilder::forEachVisibleSnapshot(const Visitor& visitor) {
    }
}

void LayerSnapshotBuilder::forEachSnapshot(const Visitor& visitor,
                                           const ConstPredicate& predicate) {
    for (int i = 0; i < mNumInterestingSnapshots; i++) {
        std::unique_ptr<LayerSnapshot>& snapshot = mSnapshots.at((size_t)i);
        if (!predicate(*snapshot)) continue;
        visitor(snapshot);
    }
}

void LayerSnapshotBuilder::forEachInputSnapshot(const ConstVisitor& visitor) const {
    for (int i = mNumInterestingSnapshots - 1; i >= 0; i--) {
        LayerSnapshot& snapshot = *mSnapshots[(size_t)i];
+5 −0
Original line number Diff line number Diff line
@@ -86,6 +86,11 @@ public:
    // Visit each visible snapshot in z-order and move the snapshot if needed
    void forEachVisibleSnapshot(const Visitor& visitor);

    typedef std::function<bool(const LayerSnapshot& snapshot)> ConstPredicate;
    // Visit each snapshot that satisfies the predicate and move the snapshot if needed with visible
    // snapshots in z-order
    void forEachSnapshot(const Visitor& visitor, const ConstPredicate& predicate);

    // Visit each snapshot interesting to input reverse z-order
    void forEachInputSnapshot(const ConstVisitor& visitor) const;

+6 −2
Original line number Diff line number Diff line
@@ -58,7 +58,8 @@ RequestedLayerState::RequestedLayerState(const LayerCreationArgs& args)
        parentId(args.parentId),
        layerIdToMirror(args.layerIdToMirror) {
    layerId = static_cast<int32_t>(args.sequence);
    changes |= RequestedLayerState::Changes::Created;
    changes |= RequestedLayerState::Changes::Created |
            RequestedLayerState::Changes::RequiresComposition;
    metadata.merge(args.metadata);
    changes |= RequestedLayerState::Changes::Metadata;
    handleAlive = true;
@@ -248,7 +249,8 @@ void RequestedLayerState::merge(const ResolvedComposerState& resolvedComposerSta

    if (hadSomethingToDraw != hasSomethingToDraw()) {
        changes |= RequestedLayerState::Changes::Visibility |
                RequestedLayerState::Changes::VisibleRegion;
                RequestedLayerState::Changes::VisibleRegion |
                RequestedLayerState::Changes::RequiresComposition;
    }
    if (clientChanges & layer_state_t::HIERARCHY_CHANGES)
        changes |= RequestedLayerState::Changes::Hierarchy;
@@ -258,6 +260,8 @@ void RequestedLayerState::merge(const ResolvedComposerState& resolvedComposerSta
        changes |= RequestedLayerState::Changes::Geometry;
    if (clientChanges & layer_state_t::AFFECTS_CHILDREN)
        changes |= RequestedLayerState::Changes::AffectsChildren;
    if (clientChanges & layer_state_t::REQUIRES_COMPOSITION)
        changes |= RequestedLayerState::Changes::RequiresComposition;
    if (clientChanges & layer_state_t::INPUT_CHANGES)
        changes |= RequestedLayerState::Changes::Input;
    if (clientChanges & layer_state_t::VISIBLE_REGION_CHANGES)
Loading