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

Commit 6867ecaf authored by TreeHugger Robot's avatar TreeHugger Robot Committed by Automerger Merge Worker
Browse files

Merge changes from topics "identify_a_pip", "writeStateToHWC_update" into sc-dev am: fa030dc2

Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/native/+/14212772

Change-Id: I60e62c8fbe16559c1eba26e29036c6b0326fb8d6
parents abd25bb7 fa030dc2
Loading
Loading
Loading
Loading
+3 −0
Original line number Diff line number Diff line
@@ -138,6 +138,9 @@ public:

    // Gets the sequence number: a serial number that uniquely identifies a Layer
    virtual int32_t getSequence() const = 0;

    // Whether the layer should be rendered with rounded corners.
    virtual bool hasRoundedCorners() const = 0;
};

// TODO(b/121291683): Specialize std::hash<> for sp<T> so these and others can
+8 −2
Original line number Diff line number Diff line
@@ -16,6 +16,7 @@

#pragma once

#include <cstdint>
#include <optional>
#include <string>

@@ -90,8 +91,13 @@ public:
    // Writes the geometry state to the HWC, or does nothing if this layer does
    // not use the HWC. If includeGeometry is false, the geometry state can be
    // skipped. If skipLayer is true, then the alpha of the layer is forced to
    // 0 so that HWC will ignore it.
    virtual void writeStateToHWC(bool includeGeometry, bool skipLayer) = 0;
    // 0 so that HWC will ignore it. z specifies the order to draw the layer in
    // (starting with 0 for the back layer, and increasing for each following
    // layer). zIsOverridden specifies whether the layer has been reordered.
    // isPeekingThrough specifies whether this layer will be shown through a
    // hole punch in a layer above it.
    virtual void writeStateToHWC(bool includeGeometry, bool skipLayer, uint32_t z,
                                 bool zIsOverridden, bool isPeekingThrough) = 0;

    // Updates the cursor position with the HWC
    virtual void writeCursorPositionToHWC() const = 0;
+7 −3
Original line number Diff line number Diff line
@@ -16,6 +16,7 @@

#pragma once

#include <cstdint>
#include <memory>
#include <string>

@@ -42,7 +43,8 @@ public:

    void updateCompositionState(bool includeGeometry, bool forceClientComposition,
                                ui::Transform::RotationFlags) override;
    void writeStateToHWC(bool includeGeometry, bool skipLayer) override;
    void writeStateToHWC(bool includeGeometry, bool skipLayer, uint32_t z, bool zIsOverridden,
                         bool isPeekingThrough) override;
    void writeCursorPositionToHWC() const override;

    HWC2::Layer* getHwcLayer() const override;
@@ -66,7 +68,8 @@ protected:

private:
    Rect calculateInitialCrop() const;
    void writeOutputDependentGeometryStateToHWC(HWC2::Layer*, Hwc2::IComposerClient::Composition);
    void writeOutputDependentGeometryStateToHWC(HWC2::Layer*, Hwc2::IComposerClient::Composition,
                                                uint32_t z);
    void writeOutputIndependentGeometryStateToHWC(HWC2::Layer*, const LayerFECompositionState&,
                                                  bool skipLayer);
    void writeOutputDependentPerFrameStateToHWC(HWC2::Layer*);
@@ -74,7 +77,8 @@ private:
    void writeSolidColorStateToHWC(HWC2::Layer*, const LayerFECompositionState&);
    void writeSidebandStateToHWC(HWC2::Layer*, const LayerFECompositionState&);
    void writeBufferStateToHWC(HWC2::Layer*, const LayerFECompositionState&);
    void writeCompositionTypeToHWC(HWC2::Layer*, Hwc2::IComposerClient::Composition);
    void writeCompositionTypeToHWC(HWC2::Layer*, Hwc2::IComposerClient::Composition,
                                   bool isPeekingThrough);
    void detectDisallowedCompositionTypeChange(Hwc2::IComposerClient::Composition from,
                                               Hwc2::IComposerClient::Composition to) const;
};
+10 −3
Original line number Diff line number Diff line
@@ -46,6 +46,10 @@ class Layer;

class HWComposer;

namespace compositionengine {
class OutputLayer;
} // namespace compositionengine

namespace compositionengine::impl {

// Note that fields that affect HW composer state may need to be mirrored into
@@ -84,9 +88,6 @@ struct OutputLayerCompositionState {
    // The dataspace for this layer
    ui::Dataspace dataspace{ui::Dataspace::UNKNOWN};

    // The Z order index of this layer on this output
    uint32_t z{0};

    // Overrides the buffer, acquire fence, and display frame stored in LayerFECompositionState
    struct {
        std::shared_ptr<renderengine::ExternalTexture> buffer = nullptr;
@@ -96,6 +97,12 @@ struct OutputLayerCompositionState {
        ProjectionSpace displaySpace;
        Region damageRegion = Region::INVALID_REGION;
        Region visibleRegion;

        // The OutputLayer pointed to by this field will be rearranged to draw
        // behind the OutputLayer represented by this CompositionState and will
        // be visible through it. Unowned - the OutputLayer's lifetime will
        // outlast this.)
        OutputLayer* peekThroughLayer = nullptr;
    } overrideInfo;

    /*
+20 −0
Original line number Diff line number Diff line
@@ -105,12 +105,32 @@ public:

    void dump(std::string& result) const;

    // Whether this represents a single layer with a buffer and rounded corners.
    // If it is, we may be able to draw it by placing it behind another
    // CachedSet and punching a hole.
    bool requiresHolePunch() const;

    // Add a layer that will be drawn behind this one. ::render() will render a
    // hole in this CachedSet's buffer, allowing the supplied layer to peek
    // through. Must be called before ::render().
    // Will do nothing if this CachedSet is not opaque where the hole punch
    // layer is displayed.
    // If isFirstLayer is true, this CachedSet can be considered opaque because
    // nothing (besides the hole punch layer) will be drawn behind it.
    void addHolePunchLayerIfFeasible(const CachedSet&, bool isFirstLayer);

    // Retrieve the layer that will be drawn behind this one.
    OutputLayer* getHolePunchLayer() const;

private:
    CachedSet() = default;

    const NonBufferHash mFingerprint;
    std::chrono::steady_clock::time_point mLastUpdate = std::chrono::steady_clock::now();
    std::vector<Layer> mLayers;

    // Unowned.
    const LayerState* mHolePunchLayer = nullptr;
    Rect mBounds = Rect::EMPTY_RECT;
    Region mVisibleRegion;
    size_t mAge = 0;
Loading