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

Commit f20c192e authored by Ady Abraham's avatar Ady Abraham
Browse files

SurfaceFlinger: fix frame rate override on BLAST

Apply BLAST transactions only is the vsync is considered valid
for that layer (i.e. the vsync aligns to the overriden vsync policy).

Bug: 170502573
Test: atest FrameRateOverrideHostTest
Change-Id: I379f76556922391df370b551f3034d2c01c94859
parent 7121caf2
Loading
Loading
Loading
Loading
+16 −8
Original line number Diff line number Diff line
@@ -3288,7 +3288,6 @@ bool SurfaceFlinger::transactionIsReadyToBeApplied(int64_t desiredPresentTime,
        if (s.acquireFence && s.acquireFence->getStatus() == Fence::Status::Unsignaled) {
          ready = false;
        }
        if (updateTransactionCounters) {
        sp<Layer> layer = nullptr;
        if (s.surface) {
            layer = fromHandleLocked(s.surface).promote();
@@ -3296,6 +3295,11 @@ bool SurfaceFlinger::transactionIsReadyToBeApplied(int64_t desiredPresentTime,
            ALOGW("Transaction with buffer, but no Layer?");
            continue;
        }
        if (layer && !mScheduler->isVsyncValid(expectedPresentTime, layer->getOwnerUid())) {
            ATRACE_NAME("!isVsyncValidForUid");
            ready = false;
        }
        if (updateTransactionCounters) {
              // See BufferStateLayer::mPendingBufferTransactions
              if (layer) layer->incrementPendingBufferCount();

@@ -3338,7 +3342,11 @@ status_t SurfaceFlinger::setTransactionState(
    const bool pendingTransactions = itr != mTransactionQueues.end();
    // Expected present time is computed and cached on invalidate, so it may be stale.
    if (!pendingTransactions) {
        mExpectedPresentTime = calculateExpectedPresentTime(systemTime());
        // The transaction might arrive just before the next vsync but after
        // invalidate was called. In that case we need to get the next vsync
        // afterwards.
        const auto referenceTime = std::max(mExpectedPresentTime.load(), systemTime());
        mExpectedPresentTime = calculateExpectedPresentTime(referenceTime);
    }

    IPCThreadState* ipc = IPCThreadState::self();