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

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

Merge "[sf] Avoid rounded corners without EGL_EXT_protected_content with new frontend" into main

parents 32ca92da 0808ae62
Loading
Loading
Loading
Loading
+9 −3
Original line number Original line Diff line number Diff line
@@ -854,8 +854,9 @@ void LayerSnapshotBuilder::updateSnapshot(LayerSnapshot& snapshot, const Args& a
    }
    }


    if (forceUpdate || snapshot.clientChanges & layer_state_t::eCornerRadiusChanged ||
    if (forceUpdate || snapshot.clientChanges & layer_state_t::eCornerRadiusChanged ||
        snapshot.changes.any(RequestedLayerState::Changes::Geometry)) {
        snapshot.changes.any(RequestedLayerState::Changes::Geometry |
        updateRoundedCorner(snapshot, requested, parentSnapshot);
                             RequestedLayerState::Changes::BufferUsageFlags)) {
        updateRoundedCorner(snapshot, requested, parentSnapshot, args);
    }
    }


    if (forceUpdate || snapshot.clientChanges & layer_state_t::eShadowRadiusChanged ||
    if (forceUpdate || snapshot.clientChanges & layer_state_t::eShadowRadiusChanged ||
@@ -886,7 +887,12 @@ void LayerSnapshotBuilder::updateSnapshot(LayerSnapshot& snapshot, const Args& a


void LayerSnapshotBuilder::updateRoundedCorner(LayerSnapshot& snapshot,
void LayerSnapshotBuilder::updateRoundedCorner(LayerSnapshot& snapshot,
                                               const RequestedLayerState& requested,
                                               const RequestedLayerState& requested,
                                               const LayerSnapshot& parentSnapshot) {
                                               const LayerSnapshot& parentSnapshot,
                                               const Args& args) {
    if (args.skipRoundCornersWhenProtected && requested.isProtected()) {
        snapshot.roundedCorner = RoundedCornerState();
        return;
    }
    snapshot.roundedCorner = RoundedCornerState();
    snapshot.roundedCorner = RoundedCornerState();
    RoundedCornerState parentRoundedCorner;
    RoundedCornerState parentRoundedCorner;
    if (parentSnapshot.roundedCorner.hasRoundedCorners()) {
    if (parentSnapshot.roundedCorner.hasRoundedCorners()) {
+2 −1
Original line number Original line Diff line number Diff line
@@ -54,6 +54,7 @@ public:
        std::unordered_set<uint32_t> excludeLayerIds;
        std::unordered_set<uint32_t> excludeLayerIds;
        const std::unordered_map<std::string, bool>& supportedLayerGenericMetadata;
        const std::unordered_map<std::string, bool>& supportedLayerGenericMetadata;
        const std::unordered_map<std::string, uint32_t>& genericLayerMetadataKeyMap;
        const std::unordered_map<std::string, uint32_t>& genericLayerMetadataKeyMap;
        bool skipRoundCornersWhenProtected = false;
    };
    };
    LayerSnapshotBuilder();
    LayerSnapshotBuilder();


@@ -103,7 +104,7 @@ private:
                                    bool parentIsRelative, const Args& args);
                                    bool parentIsRelative, const Args& args);
    static void resetRelativeState(LayerSnapshot& snapshot);
    static void resetRelativeState(LayerSnapshot& snapshot);
    static void updateRoundedCorner(LayerSnapshot& snapshot, const RequestedLayerState& layerState,
    static void updateRoundedCorner(LayerSnapshot& snapshot, const RequestedLayerState& layerState,
                                    const LayerSnapshot& parentSnapshot);
                                    const LayerSnapshot& parentSnapshot, const Args& args);
    void updateLayerBounds(LayerSnapshot& snapshot, const RequestedLayerState& layerState,
    void updateLayerBounds(LayerSnapshot& snapshot, const RequestedLayerState& layerState,
                           const LayerSnapshot& parentSnapshot, uint32_t displayRotationFlags);
                           const LayerSnapshot& parentSnapshot, uint32_t displayRotationFlags);
    static void updateShadows(LayerSnapshot& snapshot, const RequestedLayerState& requested,
    static void updateShadows(LayerSnapshot& snapshot, const RequestedLayerState& requested,
+10 −0
Original line number Original line Diff line number Diff line
@@ -147,6 +147,8 @@ void RequestedLayerState::merge(const ResolvedComposerState& resolvedComposerSta
    const ui::Size oldBufferSize = hadBuffer
    const ui::Size oldBufferSize = hadBuffer
            ? ui::Size(externalTexture->getWidth(), externalTexture->getHeight())
            ? ui::Size(externalTexture->getWidth(), externalTexture->getHeight())
            : ui::Size();
            : ui::Size();
    const uint64_t oldUsageFlags = hadBuffer ? externalTexture->getUsage() : 0;

    const bool hadSideStream = sidebandStream != nullptr;
    const bool hadSideStream = sidebandStream != nullptr;
    const layer_state_t& clientState = resolvedComposerState.state;
    const layer_state_t& clientState = resolvedComposerState.state;
    const bool hadBlur = hasBlur();
    const bool hadBlur = hasBlur();
@@ -177,6 +179,10 @@ void RequestedLayerState::merge(const ResolvedComposerState& resolvedComposerSta
                changes |= RequestedLayerState::Changes::BufferSize;
                changes |= RequestedLayerState::Changes::BufferSize;
                changes |= RequestedLayerState::Changes::Geometry;
                changes |= RequestedLayerState::Changes::Geometry;
            }
            }
            const uint64_t usageFlags = hasBuffer ? externalTexture->getUsage() : 0;
            if (oldUsageFlags != usageFlags) {
                changes |= RequestedLayerState::Changes::BufferUsageFlags;
            }
        }
        }


        if (hasBuffer != hadBuffer) {
        if (hasBuffer != hadBuffer) {
@@ -570,6 +576,10 @@ bool RequestedLayerState::isSimpleBufferUpdate(const layer_state_t& s) const {
    return true;
    return true;
}
}


bool RequestedLayerState::isProtected() const {
    return externalTexture && externalTexture->getUsage() & GRALLOC_USAGE_PROTECTED;
}

void RequestedLayerState::clearChanges() {
void RequestedLayerState::clearChanges() {
    what = 0;
    what = 0;
    changes.clear();
    changes.clear();
+2 −0
Original line number Original line Diff line number Diff line
@@ -56,6 +56,7 @@ struct RequestedLayerState : layer_state_t {
        Animation = 1u << 17,
        Animation = 1u << 17,
        BufferSize = 1u << 18,
        BufferSize = 1u << 18,
        GameMode = 1u << 19,
        GameMode = 1u << 19,
        BufferUsageFlags = 1u << 20,
    };
    };
    static Rect reduce(const Rect& win, const Region& exclude);
    static Rect reduce(const Rect& win, const Region& exclude);
    RequestedLayerState(const LayerCreationArgs&);
    RequestedLayerState(const LayerCreationArgs&);
@@ -85,6 +86,7 @@ struct RequestedLayerState : layer_state_t {
    bool willReleaseBufferOnLatch() const;
    bool willReleaseBufferOnLatch() const;
    bool backpressureEnabled() const;
    bool backpressureEnabled() const;
    bool isSimpleBufferUpdate(const layer_state_t&) const;
    bool isSimpleBufferUpdate(const layer_state_t&) const;
    bool isProtected() const;


    // Layer serial number.  This gives layers an explicit ordering, so we
    // Layer serial number.  This gives layers an explicit ordering, so we
    // have a stable sort order when their layer stack and Z-order are
    // have a stable sort order when their layer stack and Z-order are
+9 −3
Original line number Original line Diff line number Diff line
@@ -2311,7 +2311,9 @@ bool SurfaceFlinger::updateLayerSnapshots(VsyncId vsyncId, nsecs_t frameTimeNs,
                     .forceFullDamage = mForceFullDamage,
                     .forceFullDamage = mForceFullDamage,
                     .supportedLayerGenericMetadata =
                     .supportedLayerGenericMetadata =
                             getHwComposer().getSupportedLayerGenericMetadata(),
                             getHwComposer().getSupportedLayerGenericMetadata(),
                     .genericLayerMetadataKeyMap = getGenericLayerMetadataKeyMap()};
                     .genericLayerMetadataKeyMap = getGenericLayerMetadataKeyMap(),
                     .skipRoundCornersWhenProtected =
                             !getRenderEngine().supportsProtectedContent()};
        mLayerSnapshotBuilder.update(args);
        mLayerSnapshotBuilder.update(args);
    }
    }


@@ -8660,7 +8662,9 @@ SurfaceFlinger::getLayerSnapshotsForScreenshots(std::optional<ui::LayerStack> la
                     .excludeLayerIds = std::move(excludeLayerIds),
                     .excludeLayerIds = std::move(excludeLayerIds),
                     .supportedLayerGenericMetadata =
                     .supportedLayerGenericMetadata =
                             getHwComposer().getSupportedLayerGenericMetadata(),
                             getHwComposer().getSupportedLayerGenericMetadata(),
                     .genericLayerMetadataKeyMap = getGenericLayerMetadataKeyMap()};
                     .genericLayerMetadataKeyMap = getGenericLayerMetadataKeyMap(),
                     .skipRoundCornersWhenProtected =
                             !getRenderEngine().supportsProtectedContent()};
        mLayerSnapshotBuilder.update(args);
        mLayerSnapshotBuilder.update(args);


        auto getLayerSnapshotsFn =
        auto getLayerSnapshotsFn =
@@ -8695,7 +8699,9 @@ SurfaceFlinger::getLayerSnapshotsForScreenshots(uint32_t rootLayerId, uint32_t u
                     .excludeLayerIds = std::move(excludeLayerIds),
                     .excludeLayerIds = std::move(excludeLayerIds),
                     .supportedLayerGenericMetadata =
                     .supportedLayerGenericMetadata =
                             getHwComposer().getSupportedLayerGenericMetadata(),
                             getHwComposer().getSupportedLayerGenericMetadata(),
                     .genericLayerMetadataKeyMap = getGenericLayerMetadataKeyMap()};
                     .genericLayerMetadataKeyMap = getGenericLayerMetadataKeyMap(),
                     .skipRoundCornersWhenProtected =
                             !getRenderEngine().supportsProtectedContent()};
        mLayerSnapshotBuilder.update(args);
        mLayerSnapshotBuilder.update(args);


        auto getLayerSnapshotsFn =
        auto getLayerSnapshotsFn =
Loading