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

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

Merge "SF: LayerSnapshotBuilder updates"

parents 70dbab9f cfb2d25e
Loading
Loading
Loading
Loading
+14 −4
Original line number Original line Diff line number Diff line
@@ -248,9 +248,9 @@ struct layer_state_t {
            layer_state_t::eBackgroundBlurRadiusChanged | layer_state_t::eBackgroundColorChanged |
            layer_state_t::eBackgroundBlurRadiusChanged | layer_state_t::eBackgroundColorChanged |
            layer_state_t::eBlurRegionsChanged | layer_state_t::eColorChanged |
            layer_state_t::eBlurRegionsChanged | layer_state_t::eColorChanged |
            layer_state_t::eColorSpaceAgnosticChanged | layer_state_t::eColorTransformChanged |
            layer_state_t::eColorSpaceAgnosticChanged | layer_state_t::eColorTransformChanged |
            layer_state_t::eCornerRadiusChanged | layer_state_t::eHdrMetadataChanged |
            layer_state_t::eCornerRadiusChanged | layer_state_t::eDimmingEnabledChanged |
            layer_state_t::eRenderBorderChanged | layer_state_t::eShadowRadiusChanged |
            layer_state_t::eHdrMetadataChanged | layer_state_t::eRenderBorderChanged |
            layer_state_t::eStretchChanged;
            layer_state_t::eShadowRadiusChanged | layer_state_t::eStretchChanged;


    // Changes which invalidates the layer's visible region in CE.
    // Changes which invalidates the layer's visible region in CE.
    static constexpr uint64_t CONTENT_DIRTY = layer_state_t::CONTENT_CHANGES |
    static constexpr uint64_t CONTENT_DIRTY = layer_state_t::CONTENT_CHANGES |
@@ -261,7 +261,17 @@ struct layer_state_t {
            layer_state_t::HIERARCHY_CHANGES | layer_state_t::eAlphaChanged |
            layer_state_t::HIERARCHY_CHANGES | layer_state_t::eAlphaChanged |
            layer_state_t::eColorTransformChanged | layer_state_t::eCornerRadiusChanged |
            layer_state_t::eColorTransformChanged | layer_state_t::eCornerRadiusChanged |
            layer_state_t::eFlagsChanged | layer_state_t::eLayerStackChanged |
            layer_state_t::eFlagsChanged | layer_state_t::eLayerStackChanged |
            layer_state_t::eTrustedOverlayChanged;
            layer_state_t::eTrustedOverlayChanged | 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;

    // 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;


    bool hasValidBuffer() const;
    bool hasValidBuffer() const;
    void sanitize(int32_t permissions);
    void sanitize(int32_t permissions);
+2 −1
Original line number Original line Diff line number Diff line
@@ -166,7 +166,8 @@ auto DisplayDevice::getFrontEndInfo() const -> frontend::DisplayInfo {
            .receivesInput = receivesInput(),
            .receivesInput = receivesInput(),
            .isSecure = isSecure(),
            .isSecure = isSecure(),
            .isPrimary = isPrimary(),
            .isPrimary = isPrimary(),
            .rotationFlags = ui::Transform::toRotationFlags(mOrientation)};
            .rotationFlags = ui::Transform::toRotationFlags(mOrientation),
            .transformHint = getTransformHint()};
}
}


void DisplayDevice::setPowerMode(hal::PowerMode mode) {
void DisplayDevice::setPowerMode(hal::PowerMode mode) {
+12 −0
Original line number Original line Diff line number Diff line
@@ -16,6 +16,8 @@


#pragma once
#pragma once


#include <sstream>

#include <gui/DisplayInfo.h>
#include <gui/DisplayInfo.h>


namespace android::surfaceflinger::frontend {
namespace android::surfaceflinger::frontend {
@@ -29,6 +31,16 @@ struct DisplayInfo {
    // TODO(b/238781169) can eliminate once sPrimaryDisplayRotationFlags is removed.
    // TODO(b/238781169) can eliminate once sPrimaryDisplayRotationFlags is removed.
    bool isPrimary;
    bool isPrimary;
    ui::Transform::RotationFlags rotationFlags;
    ui::Transform::RotationFlags rotationFlags;
    ui::Transform::RotationFlags transformHint;
    std::string getDebugString() const {
        std::stringstream debug;
        debug << "DisplayInfo {displayId=" << info.displayId << " lw=" << info.logicalWidth
              << " lh=" << info.logicalHeight << " transform={" << transform.dsdx() << " ,"
              << transform.dsdy() << " ," << transform.dtdx() << " ," << transform.dtdy()
              << "} isSecure=" << isSecure << " isPrimary=" << isPrimary
              << " rotationFlags=" << rotationFlags << " transformHint=" << transformHint << "}";
        return debug.str();
    }
};
};


} // namespace android::surfaceflinger::frontend
} // namespace android::surfaceflinger::frontend
+3 −3
Original line number Original line Diff line number Diff line
@@ -28,8 +28,8 @@ auto layerZCompare = [](const std::pair<LayerHierarchy*, LayerHierarchy::Variant
                        const std::pair<LayerHierarchy*, LayerHierarchy::Variant>& rhs) {
                        const std::pair<LayerHierarchy*, LayerHierarchy::Variant>& rhs) {
    auto lhsLayer = lhs.first->getLayer();
    auto lhsLayer = lhs.first->getLayer();
    auto rhsLayer = rhs.first->getLayer();
    auto rhsLayer = rhs.first->getLayer();
    if (lhsLayer->layerStack != rhsLayer->layerStack) {
    if (lhsLayer->layerStack.id != rhsLayer->layerStack.id) {
        return lhsLayer->layerStack.id < rhsLayer->layerStack.id;
        return lhsLayer->layerStack.id > rhsLayer->layerStack.id;
    }
    }
    if (lhsLayer->z != rhsLayer->z) {
    if (lhsLayer->z != rhsLayer->z) {
        return lhsLayer->z < rhsLayer->z;
        return lhsLayer->z < rhsLayer->z;
@@ -75,11 +75,11 @@ void LayerHierarchy::traverseInZOrder(const Visitor& visitor,
    for (auto it = mChildren.begin(); it < mChildren.end(); it++) {
    for (auto it = mChildren.begin(); it < mChildren.end(); it++) {
        auto& [child, childVariant] = *it;
        auto& [child, childVariant] = *it;
        if (traverseThisLayer && child->getLayer()->z >= 0) {
        if (traverseThisLayer && child->getLayer()->z >= 0) {
            traverseThisLayer = false;
            bool breakTraversal = !visitor(*this, traversalPath);
            bool breakTraversal = !visitor(*this, traversalPath);
            if (breakTraversal) {
            if (breakTraversal) {
                return;
                return;
            }
            }
            traverseThisLayer = false;
        }
        }
        if (childVariant == LayerHierarchy::Variant::Detached) {
        if (childVariant == LayerHierarchy::Variant::Detached) {
            continue;
            continue;
+3 −1
Original line number Original line Diff line number Diff line
@@ -41,11 +41,13 @@ class LayerHierarchyBuilder;
// states.
// states.
class LayerHierarchy {
class LayerHierarchy {
public:
public:
    enum Variant {
    enum Variant : uint32_t {
        Attached,
        Attached,
        Detached,
        Detached,
        Relative,
        Relative,
        Mirror,
        Mirror,
        ftl_first = Attached,
        ftl_last = Mirror,
    };
    };
    // Represents a unique path to a node.
    // Represents a unique path to a node.
    struct TraversalPath {
    struct TraversalPath {
Loading