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

Commit 5df94318 authored by Vishnu Nair's avatar Vishnu Nair Committed by Android (Google) Code Review
Browse files

Merge "Update output's dirty region when content changes" into main

parents 52683c69 a4b3a10e
Loading
Loading
Loading
Loading
+4 −2
Original line number Diff line number Diff line
@@ -250,6 +250,7 @@ std::string LayerSnapshot::getIsVisibleReason() const {
    if (drawShadows()) reason << " shadowSettings.length=" << shadowSettings.length;
    if (backgroundBlurRadius > 0) reason << " backgroundBlurRadius=" << backgroundBlurRadius;
    if (blurRegions.size() > 0) reason << " blurRegions.size()=" << blurRegions.size();
    if (contentDirty) reason << " contentDirty";
    return reason.str();
}

@@ -359,8 +360,9 @@ void LayerSnapshot::merge(const RequestedLayerState& requested, bool forceUpdate
                          uint32_t displayRotationFlags) {
    clientChanges = requested.what;
    changes = requested.changes;
    contentDirty = requested.what & layer_state_t::CONTENT_DIRTY;
    hasReadyFrame = requested.autoRefresh;
    autoRefresh = requested.autoRefresh;
    contentDirty = requested.what & layer_state_t::CONTENT_DIRTY || autoRefresh;
    hasReadyFrame = autoRefresh;
    sidebandStreamHasFrame = requested.hasSidebandStreamFrame();
    updateSurfaceDamage(requested, requested.hasReadyFrame(), forceFullDamage, surfaceDamage);

+1 −0
Original line number Diff line number Diff line
@@ -77,6 +77,7 @@ struct LayerSnapshot : public compositionengine::LayerFECompositionState {
    gui::LayerMetadata layerMetadata;
    gui::LayerMetadata relativeLayerMetadata;
    bool hasReadyFrame; // used in post composition to check if there is another frame ready
    bool autoRefresh;
    ui::Transform localTransformInverse;
    gui::WindowInfo inputInfo;
    ui::Transform localTransform;
+5 −3
Original line number Diff line number Diff line
@@ -314,8 +314,8 @@ void updateMetadataAndGameMode(LayerSnapshot& snapshot, const RequestedLayerStat
void clearChanges(LayerSnapshot& snapshot) {
    snapshot.changes.clear();
    snapshot.clientChanges = 0;
    snapshot.contentDirty = false;
    snapshot.hasReadyFrame = false;
    snapshot.contentDirty = snapshot.autoRefresh;
    snapshot.hasReadyFrame = snapshot.autoRefresh;
    snapshot.sidebandStreamHasFrame = false;
    snapshot.surfaceDamage.clear();
}
@@ -724,10 +724,12 @@ void LayerSnapshotBuilder::updateSnapshot(LayerSnapshot& snapshot, const Args& a
    if (args.displayChanges) snapshot.changes |= RequestedLayerState::Changes::Geometry;
    snapshot.reachablilty = LayerSnapshot::Reachablilty::Reachable;
    snapshot.clientChanges |= (parentSnapshot.clientChanges & layer_state_t::AFFECTS_CHILDREN);
    // mark the content as dirty if the parent state changes can dirty the child's content (for
    // example alpha)
    snapshot.contentDirty |= (snapshot.clientChanges & layer_state_t::CONTENT_DIRTY) != 0;
    snapshot.isHiddenByPolicyFromParent = parentSnapshot.isHiddenByPolicyFromParent ||
            parentSnapshot.invalidTransform || requested.isHiddenByPolicy() ||
            (args.excludeLayerIds.find(path.id) != args.excludeLayerIds.end());

    const bool forceUpdate = args.forceUpdate == ForceUpdateFlags::ALL ||
            snapshot.clientChanges & layer_state_t::eReparent ||
            snapshot.changes.any(RequestedLayerState::Changes::Visibility |
+3 −8
Original line number Diff line number Diff line
@@ -2532,17 +2532,13 @@ bool SurfaceFlinger::updateLayerSnapshots(VsyncId vsyncId, nsecs_t frameTimeNs,
        frontend::LayerSnapshot* snapshot = mLayerSnapshotBuilder.getSnapshot(it->second->sequence);
        gui::GameMode gameMode = (snapshot) ? snapshot->gameMode : gui::GameMode::Unsupported;
        mLayersWithQueuedFrames.emplace(it->second, gameMode);
        mLayersIdsWithQueuedFrames.emplace(it->second->sequence);
    }

    updateLayerHistory(latchTime);
    mLayerSnapshotBuilder.forEachSnapshot([&](const frontend::LayerSnapshot& snapshot) {
        // update output dirty region if we have a queued buffer that is visible or a snapshot
        // recently became invisible
        // TODO(b/360050020) investigate if we need to update dirty region when layer color changes
        if ((snapshot.isVisible &&
             (mLayersIdsWithQueuedFrames.find(snapshot.path.id) !=
              mLayersIdsWithQueuedFrames.end())) ||
        // update output's dirty region if a snapshot is visible and its
        // content is dirty or if a snapshot recently became invisible
        if ((snapshot.isVisible && snapshot.contentDirty) ||
            (!snapshot.isVisible && snapshot.changes.test(Changes::Visibility))) {
            Region visibleReg;
            visibleReg.set(snapshot.transformedBoundsWithoutTransparentRegion);
@@ -2932,7 +2928,6 @@ CompositeResultsPerDisplay SurfaceFlinger::composite(
    mScheduler->modulateVsync({}, &VsyncModulator::onDisplayRefresh, hasGpuUseOrReuse);

    mLayersWithQueuedFrames.clear();
    mLayersIdsWithQueuedFrames.clear();
    doActiveLayersTracingIfNeeded(true, mVisibleRegionsDirty, pacesetterTarget.frameBeginTime(),
                                  vsyncId);

+0 −1
Original line number Diff line number Diff line
@@ -1241,7 +1241,6 @@ private:
    // latched.
    std::unordered_set<std::pair<sp<Layer>, gui::GameMode>, LayerIntHash> mLayersWithQueuedFrames;
    std::unordered_set<sp<Layer>, SpHash<Layer>> mLayersWithBuffersRemoved;
    std::unordered_set<uint32_t> mLayersIdsWithQueuedFrames;

    // Sorted list of layers that were composed during previous frame. This is used to
    // avoid an expensive traversal of the layer hierarchy when there are no
Loading