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

Commit 94000c4a authored by Dominik Laskowski's avatar Dominik Laskowski
Browse files

SF: Simplify setTransactionFlags

Merge overloads and remove unused return value.

Bug: 185535769
Test: Build
Change-Id: If2fe712614181e82bbe219775745a1ee7af2e210
parent dd5827a6
Loading
Loading
Loading
Loading
+6 −9
Original line number Diff line number Diff line
@@ -3676,16 +3676,13 @@ uint32_t SurfaceFlinger::clearTransactionFlags(uint32_t mask) {
    return mTransactionFlags.fetch_and(~mask) & mask;
}

uint32_t SurfaceFlinger::setTransactionFlags(uint32_t mask) {
    return setTransactionFlags(mask, TransactionSchedule::Late);
}

uint32_t SurfaceFlinger::setTransactionFlags(uint32_t mask, TransactionSchedule schedule,
void SurfaceFlinger::setTransactionFlags(uint32_t mask, TransactionSchedule schedule,
                                         const sp<IBinder>& applyToken) {
    const uint32_t old = mTransactionFlags.fetch_or(mask);
    modulateVsync(&VsyncModulator::setTransactionSchedule, schedule, applyToken);
    if ((old & mask) == 0) scheduleCommit(FrameHint::kActive);
    return old;

    if (const bool scheduled = mTransactionFlags.fetch_or(mask) & mask; !scheduled) {
        scheduleCommit(FrameHint::kActive);
    }
}

bool SurfaceFlinger::stopTransactionProcessing(
+4 −10
Original line number Diff line number Diff line
@@ -779,21 +779,15 @@ private:

    uint32_t getTransactionFlags() const;

    // Sets the masked bits, and returns the old flags.
    uint32_t setTransactionFlags(uint32_t mask);
    // Sets the masked bits, and schedules a commit if needed.
    void setTransactionFlags(uint32_t mask, TransactionSchedule = TransactionSchedule::Late,
                             const sp<IBinder>& applyToken = nullptr);

    // Clears and returns the masked bits.
    uint32_t clearTransactionFlags(uint32_t mask);

    // Indicate SF should call doTraversal on layers, but don't trigger a wakeup! We use this cases
    // where there are still pending transactions but we know they won't be ready until a frame
    // arrives from a different layer. So we need to ensure we performTransaction from invalidate
    // but there is no need to try and wake up immediately to do it. Rather we rely on
    // onFrameAvailable or another layer update to wake us up.
    void setTraversalNeeded();
    uint32_t setTransactionFlags(uint32_t mask, TransactionSchedule,
                                 const sp<IBinder>& applyToken = {});
    void commitOffscreenLayers();

    enum class TransactionReadiness {
        NotReady,
        NotReadyBarrier,