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

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

Merge "[sf] optimize snapshot updates" into udc-qpr-dev

parents 05b3da48 a02943f3
Loading
Loading
Loading
Loading
+3 −3
Original line number Diff line number Diff line
@@ -270,9 +270,9 @@ struct layer_state_t {
            layer_state_t::eFrameRateChanged | layer_state_t::eFixedTransformHintChanged;

    // Changes affecting data sent to input.
    static constexpr uint64_t INPUT_CHANGES = layer_state_t::GEOMETRY_CHANGES |
            layer_state_t::HIERARCHY_CHANGES | layer_state_t::eInputInfoChanged |
            layer_state_t::eDropInputModeChanged | layer_state_t::eTrustedOverlayChanged;
    static constexpr uint64_t INPUT_CHANGES = layer_state_t::eInputInfoChanged |
            layer_state_t::eDropInputModeChanged | layer_state_t::eTrustedOverlayChanged |
            layer_state_t::eLayerStackChanged;

    // Changes that affect the visible region on a display.
    static constexpr uint64_t VISIBLE_REGION_CHANGES =
+1 −1
Original line number Diff line number Diff line
@@ -16,7 +16,7 @@

#define ATRACE_TAG ATRACE_TAG_GRAPHICS
#undef LOG_TAG
#define LOG_TAG "LayerHierarchy"
#define LOG_TAG "SurfaceFlinger"

#include "LayerHierarchy.h"
#include "LayerLog.h"
+4 −4
Original line number Diff line number Diff line
@@ -42,10 +42,10 @@ class LayerHierarchyBuilder;
class LayerHierarchy {
public:
    enum Variant : uint32_t {
        Attached,
        Detached,
        Relative,
        Mirror,
        Attached, // child of the parent
        Detached, // child of the parent but currently relative parented to another layer
        Relative, // relative child of the parent
        Mirror,   // mirrored from another layer
        ftl_first = Attached,
        ftl_last = Mirror,
    };
+23 −1
Original line number Diff line number Diff line
@@ -17,7 +17,7 @@
#define ATRACE_TAG ATRACE_TAG_GRAPHICS

#undef LOG_TAG
#define LOG_TAG "LayerLifecycleManager"
#define LOG_TAG "SurfaceFlinger"

#include "LayerLifecycleManager.h"
#include "Client.h" // temporarily needed for LayerCreationArgs
@@ -51,6 +51,7 @@ void LayerLifecycleManager::addLayers(std::vector<std::unique_ptr<RequestedLayer
                             it->second.owner.getDebugString().c_str());
        }
        mAddedLayers.push_back(newLayer.get());
        mChangedLayers.push_back(newLayer.get());
        layer.parentId = linkLayer(layer.parentId, layer.id);
        layer.relativeParentId = linkLayer(layer.relativeParentId, layer.id);
        if (layer.layerStackToMirror != ui::INVALID_LAYER_STACK) {
@@ -202,6 +203,10 @@ void LayerLifecycleManager::applyTransactions(const std::vector<TransactionState
                continue;
            }

            if (layer->changes.get() == 0) {
                mChangedLayers.push_back(layer);
            }

            if (transaction.flags & ISurfaceComposer::eAnimation) {
                layer->changes |= RequestedLayerState::Changes::Animation;
            }
@@ -244,6 +249,7 @@ void LayerLifecycleManager::applyTransactions(const std::vector<TransactionState
                    bgColorLayer->what |= layer_state_t::eColorChanged |
                            layer_state_t::eDataspaceChanged | layer_state_t::eAlphaChanged;
                    bgColorLayer->changes |= RequestedLayerState::Changes::Content;
                    mChangedLayers.push_back(bgColorLayer);
                    mGlobalChanges |= RequestedLayerState::Changes::Content;
                }
            }
@@ -290,6 +296,7 @@ void LayerLifecycleManager::commitChanges() {
        }
    }
    mDestroyedLayers.clear();
    mChangedLayers.clear();
    mGlobalChanges.clear();
}

@@ -310,10 +317,25 @@ const std::vector<std::unique_ptr<RequestedLayerState>>& LayerLifecycleManager::
    return mDestroyedLayers;
}

const std::vector<RequestedLayerState*>& LayerLifecycleManager::getChangedLayers() const {
    return mChangedLayers;
}

const ftl::Flags<RequestedLayerState::Changes> LayerLifecycleManager::getGlobalChanges() const {
    return mGlobalChanges;
}

const RequestedLayerState* LayerLifecycleManager::getLayerFromId(uint32_t id) const {
    if (id == UNASSIGNED_LAYER_ID) {
        return nullptr;
    }
    auto it = mIdToLayer.find(id);
    if (it == mIdToLayer.end()) {
        return nullptr;
    }
    return &it->second.owner;
}

RequestedLayerState* LayerLifecycleManager::getLayerFromId(uint32_t id) {
    if (id == UNASSIGNED_LAYER_ID) {
        return nullptr;
+4 −0
Original line number Diff line number Diff line
@@ -76,7 +76,9 @@ public:
    void removeLifecycleListener(std::shared_ptr<ILifecycleListener>);
    const std::vector<std::unique_ptr<RequestedLayerState>>& getLayers() const;
    const std::vector<std::unique_ptr<RequestedLayerState>>& getDestroyedLayers() const;
    const std::vector<RequestedLayerState*>& getChangedLayers() const;
    const ftl::Flags<RequestedLayerState::Changes> getGlobalChanges() const;
    const RequestedLayerState* getLayerFromId(uint32_t) const;

private:
    friend class LayerLifecycleManagerTest;
@@ -111,6 +113,8 @@ private:
    // Keeps track of all the layers that were added in order. Changes will be cleared once
    // committed.
    std::vector<RequestedLayerState*> mAddedLayers;
    // Keeps track of new and layers with states changes since last commit.
    std::vector<RequestedLayerState*> mChangedLayers;
};

} // namespace android::surfaceflinger::frontend
Loading