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

Commit 2f8ab0ea authored by Rachel Lee's avatar Rachel Lee Committed by Android (Google) Code Review
Browse files

Merge changes from topics "rename", "strategy-donotprop" into main

* changes:
  native: Rename frame rate selection strategies
  Logic for selection strategy "DoNotPropagate"
parents 86382017 70f7b69b
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -86,7 +86,7 @@ layer_state_t::layer_state_t()
        defaultFrameRateCompatibility(ANATIVEWINDOW_FRAME_RATE_COMPATIBILITY_DEFAULT),
        frameRateCategory(ANATIVEWINDOW_FRAME_RATE_CATEGORY_DEFAULT),
        frameRateCategorySmoothSwitchOnly(false),
        frameRateSelectionStrategy(ANATIVEWINDOW_FRAME_RATE_SELECTION_STRATEGY_SELF),
        frameRateSelectionStrategy(ANATIVEWINDOW_FRAME_RATE_SELECTION_STRATEGY_PROPAGATE),
        fixedTransformHint(ui::Transform::ROT_INVALID),
        autoRefresh(false),
        isTrustedOverlay(false),
+21 −4
Original line number Diff line number Diff line
@@ -1103,17 +1103,34 @@ enum {
enum {
    /**
     * Default value. The layer uses its own frame rate specifications, assuming it has any
     * specifications, instead of its parent's.
     * specifications, instead of its parent's. If it does not have its own frame rate
     * specifications, it will try to use its parent's. It will propagate its specifications to any
     * descendants that do not have their own.
     *
     * However, FRAME_RATE_SELECTION_STRATEGY_OVERRIDE_CHILDREN on an ancestor layer
     * supersedes this behavior, meaning that this layer will inherit frame rate specifications
     * regardless of whether it has its own.
     */
    ANATIVEWINDOW_FRAME_RATE_SELECTION_STRATEGY_SELF = 0,
    ANATIVEWINDOW_FRAME_RATE_SELECTION_STRATEGY_PROPAGATE = 0,

    /**
     * The layer's frame rate specifications will propagate to and override those of its descendant
     * layers.
     * The layer with this strategy has the ANATIVEWINDOW_FRAME_RATE_SELECTION_STRATEGY_SELF
     * behavior for itself.
     *
     * The layer itself has the FRAME_RATE_SELECTION_STRATEGY_PROPAGATE behavior.
     * Thus, ancestor layer that also has the strategy
     * FRAME_RATE_SELECTION_STRATEGY_OVERRIDE_CHILDREN will override this layer's
     * frame rate specifications.
     */
    ANATIVEWINDOW_FRAME_RATE_SELECTION_STRATEGY_OVERRIDE_CHILDREN = 1,

    /**
     * The layer's frame rate specifications will not propagate to its descendant
     * layers, even if the descendant layer has no frame rate specifications.
     * However, FRAME_RATE_SELECTION_STRATEGY_OVERRIDE_CHILDREN on an ancestor
     * layer supersedes this behavior.
     */
    ANATIVEWINDOW_FRAME_RATE_SELECTION_STRATEGY_SELF = 2,
};

static inline int native_window_set_frame_rate(struct ANativeWindow* window, float frameRate,
+14 −8
Original line number Diff line number Diff line
@@ -814,9 +814,12 @@ void LayerSnapshotBuilder::updateSnapshot(LayerSnapshot& snapshot, const Args& a
                RequestedLayerState::Changes::Hierarchy) ||
        snapshot.changes.any(RequestedLayerState::Changes::FrameRate |
                             RequestedLayerState::Changes::Hierarchy)) {
        bool shouldOverrideChildren = parentSnapshot.frameRateSelectionStrategy ==
        const bool shouldOverrideChildren = parentSnapshot.frameRateSelectionStrategy ==
                scheduler::LayerInfo::FrameRateSelectionStrategy::OverrideChildren;
        if (!requested.requestedFrameRate.isValid() || shouldOverrideChildren) {
        const bool propagationAllowed = parentSnapshot.frameRateSelectionStrategy !=
                scheduler::LayerInfo::FrameRateSelectionStrategy::Self;
        if ((!requested.requestedFrameRate.isValid() && propagationAllowed) ||
            shouldOverrideChildren) {
            snapshot.inheritedFrameRate = parentSnapshot.inheritedFrameRate;
        } else {
            snapshot.inheritedFrameRate = requested.requestedFrameRate;
@@ -828,12 +831,15 @@ void LayerSnapshotBuilder::updateSnapshot(LayerSnapshot& snapshot, const Args& a
    }

    if (forceUpdate || snapshot.clientChanges & layer_state_t::eFrameRateSelectionStrategyChanged) {
        if (parentSnapshot.frameRateSelectionStrategy ==
            scheduler::LayerInfo::FrameRateSelectionStrategy::OverrideChildren) {
            snapshot.frameRateSelectionStrategy =
                    scheduler::LayerInfo::FrameRateSelectionStrategy::OverrideChildren;
        } else {
            const auto strategy = scheduler::LayerInfo::convertFrameRateSelectionStrategy(
                    requested.frameRateSelectionStrategy);
        snapshot.frameRateSelectionStrategy =
                strategy == scheduler::LayerInfo::FrameRateSelectionStrategy::Self
                ? parentSnapshot.frameRateSelectionStrategy
                : strategy;
            snapshot.frameRateSelectionStrategy = strategy;
        }
    }

    if (forceUpdate || snapshot.clientChanges & layer_state_t::eFrameRateSelectionPriority) {
+1 −1
Original line number Diff line number Diff line
@@ -125,7 +125,7 @@ RequestedLayerState::RequestedLayerState(const LayerCreationArgs& args)
    frameRateCategory = static_cast<int8_t>(FrameRateCategory::Default);
    frameRateCategorySmoothSwitchOnly = false;
    frameRateSelectionStrategy =
            static_cast<int8_t>(scheduler::LayerInfo::FrameRateSelectionStrategy::Self);
            static_cast<int8_t>(scheduler::LayerInfo::FrameRateSelectionStrategy::Propagate);
    dataspace = ui::Dataspace::V0_SRGB;
    gameMode = gui::GameMode::Unsupported;
    requestedFrameRate = {};
+7 −6
Original line number Diff line number Diff line
@@ -193,7 +193,7 @@ Layer::Layer(const surfaceflinger::LayerCreationArgs& args)
    mDrawingState.dropInputMode = gui::DropInputMode::NONE;
    mDrawingState.dimmingEnabled = true;
    mDrawingState.defaultFrameRateCompatibility = FrameRateCompatibility::Default;
    mDrawingState.frameRateSelectionStrategy = FrameRateSelectionStrategy::Self;
    mDrawingState.frameRateSelectionStrategy = FrameRateSelectionStrategy::Propagate;

    if (args.flags & ISurfaceComposerClient::eNoColorFill) {
        // Set an invalid color so there is no color fill.
@@ -1273,14 +1273,15 @@ bool Layer::propagateFrameRateForLayerTree(FrameRate parentFrameRate, bool overr
    auto now = systemTime();
    *transactionNeeded |= setFrameRateForLayerTreeLegacy(frameRate, now);

    // The frame rate is propagated to the children
    // The frame rate is propagated to the children by default, but some properties may override it.
    bool childrenHaveFrameRate = false;
    const bool overrideChildrenFrameRate = overrideChildren || shouldOverrideChildrenFrameRate();
    const bool canPropagateFrameRate = shouldPropagateFrameRate() || overrideChildrenFrameRate;
    for (const sp<Layer>& child : mCurrentChildren) {
        childrenHaveFrameRate |=
                child->propagateFrameRateForLayerTree(frameRate,
                                                      overrideChildren ||
                                                              shouldOverrideChildrenFrameRate(),
                                                      transactionNeeded);
                child->propagateFrameRateForLayerTree(canPropagateFrameRate ? frameRate
                                                                            : FrameRate(),
                                                      overrideChildrenFrameRate, transactionNeeded);
    }

    // If we don't have a valid frame rate specification, but the children do, we set this
Loading