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

Commit 308a1895 authored by Arthur Hung's avatar Arthur Hung Committed by Android (Google) Code Review
Browse files

Merge "Reduce setInputWindows call (1/2)"

parents 343409e8 9ed43398
Loading
Loading
Loading
Loading
+14 −3
Original line number Diff line number Diff line
@@ -732,6 +732,10 @@ uint32_t Layer::doTransaction(uint32_t flags) {
        mNeedsFiltering = getActiveTransform(s).needsBilinearFiltering();
    }

    if (!mPotentialCursor && (flags & Layer::eVisibleRegion)) {
        mFlinger->mUpdateInputInfo = true;
    }

    commitTransaction(mDrawingState);

    return flags;
@@ -882,7 +886,7 @@ bool Layer::setTrustedOverlay(bool isTrustedOverlay) {
    if (mDrawingState.isTrustedOverlay == isTrustedOverlay) return false;
    mDrawingState.isTrustedOverlay = isTrustedOverlay;
    mDrawingState.modified = true;
    mFlinger->mInputInfoChanged = true;
    mFlinger->mUpdateInputInfo = true;
    setTransactionFlags(eTransactionNeeded);
    return true;
}
@@ -979,6 +983,13 @@ bool Layer::setBackgroundBlurRadius(int backgroundBlurRadius) {
    return true;
}
bool Layer::setMatrix(const layer_state_t::matrix22_t& matrix) {
    if (matrix.dsdx == mDrawingState.transform.dsdx() &&
        matrix.dtdy == mDrawingState.transform.dtdy() &&
        matrix.dtdx == mDrawingState.transform.dtdx() &&
        matrix.dsdy == mDrawingState.transform.dsdy()) {
        return false;
    }

    ui::Transform t;
    t.set(matrix.dsdx, matrix.dtdy, matrix.dtdx, matrix.dsdy);

@@ -2053,7 +2064,7 @@ void Layer::setInputInfo(const WindowInfo& info) {
    mDrawingState.inputInfo = info;
    mDrawingState.touchableRegionCrop = fromHandle(info.touchableRegionCropHandle.promote());
    mDrawingState.modified = true;
    mFlinger->mInputInfoChanged = true;
    mFlinger->mUpdateInputInfo = true;
    setTransactionFlags(eTransactionNeeded);
}

+9 −5
Original line number Diff line number Diff line
@@ -3114,6 +3114,7 @@ void SurfaceFlinger::processDisplayChangesLocked() {
    const KeyedVector<wp<IBinder>, DisplayDeviceState>& draw(mDrawingState.displays);
    if (!curr.isIdenticalTo(draw)) {
        mVisibleRegionsDirty = true;
        mUpdateInputInfo = true;

        // find the displays that were removed
        // (ie: in drawing state but not in current state)
@@ -3158,6 +3159,7 @@ void SurfaceFlinger::commitTransactionsLocked(uint32_t transactionFlags) {
    if (mSomeChildrenChanged) {
        mVisibleRegionsDirty = true;
        mSomeChildrenChanged = false;
        mUpdateInputInfo = true;
    }

    // Update transform hint.
@@ -3221,6 +3223,7 @@ void SurfaceFlinger::commitTransactionsLocked(uint32_t transactionFlags) {
        mLayersAdded = false;
        // Layers have been added.
        mVisibleRegionsDirty = true;
        mUpdateInputInfo = true;
    }

    // some layers might have been removed, so
@@ -3228,6 +3231,7 @@ void SurfaceFlinger::commitTransactionsLocked(uint32_t transactionFlags) {
    if (mLayersRemoved) {
        mLayersRemoved = false;
        mVisibleRegionsDirty = true;
        mUpdateInputInfo = true;
        mDrawingState.traverseInZOrder([&](Layer* layer) {
            if (mLayersPendingRemoval.indexOf(layer) >= 0) {
                // this layer is not visible anymore
@@ -3252,14 +3256,14 @@ void SurfaceFlinger::updateInputFlinger() {
    std::vector<WindowInfo> windowInfos;
    std::vector<DisplayInfo> displayInfos;
    bool updateWindowInfo = false;
    if (mVisibleRegionsDirty || mInputInfoChanged) {
        mInputInfoChanged = false;
    if (mUpdateInputInfo) {
        mUpdateInputInfo = false;
        updateWindowInfo = true;
        buildWindowInfos(windowInfos, displayInfos);
    }
    if (!updateWindowInfo && mInputWindowCommands.empty()) {
    } else if (mInputWindowCommands.empty()) {
        return;
    }

    BackgroundExecutor::getInstance().sendCallbacks({[updateWindowInfo,
                                                      windowInfos = std::move(windowInfos),
                                                      displayInfos = std::move(displayInfos),
@@ -4608,7 +4612,7 @@ uint32_t SurfaceFlinger::setClientStateLocked(const FrameTimelineInfo& frameTime
    if (what & layer_state_t::eDropInputModeChanged) {
        if (layer->setDropInputMode(s.dropInputMode)) {
            flags |= eTraversalNeeded;
            mInputInfoChanged = true;
            mUpdateInputInfo = true;
        }
    }
    // This has to happen after we reparent children because when we reparent to null we remove
+1 −1
Original line number Diff line number Diff line
@@ -1198,7 +1198,7 @@ private:
    // Set during transaction application stage to track if the input info or children
    // for a layer has changed.
    // TODO: Also move visibleRegions over to a boolean system.
    bool mInputInfoChanged = false;
    bool mUpdateInputInfo = false;
    bool mSomeChildrenChanged;
    bool mSomeDataspaceChanged = false;
    bool mForceTransactionDisplayChange = false;