diff options
| -rw-r--r-- | services/surfaceflinger/SurfaceFlinger.cpp | 18 | ||||
| -rw-r--r-- | services/surfaceflinger/SurfaceFlinger.h | 2 |
2 files changed, 11 insertions, 9 deletions
diff --git a/services/surfaceflinger/SurfaceFlinger.cpp b/services/surfaceflinger/SurfaceFlinger.cpp index 94d798f518..7d75657912 100644 --- a/services/surfaceflinger/SurfaceFlinger.cpp +++ b/services/surfaceflinger/SurfaceFlinger.cpp @@ -3320,7 +3320,8 @@ void SurfaceFlinger::flushTransactionQueues() { if (!transactionIsReadyToBeApplied(transaction.frameTimelineInfo, transaction.isAutoTimestamp, transaction.desiredPresentTime, - transaction.states, pendingBuffers)) { + transaction.originUid, transaction.states, + pendingBuffers)) { setTransactionFlags(eTransactionFlushNeeded); break; } @@ -3347,7 +3348,8 @@ void SurfaceFlinger::flushTransactionQueues() { if (!transactionIsReadyToBeApplied(transaction.frameTimelineInfo, transaction.isAutoTimestamp, transaction.desiredPresentTime, - transaction.states, pendingBuffers) || + transaction.originUid, transaction.states, + pendingBuffers) || pendingTransactions) { mPendingTransactionQueues[transaction.applyToken].push(std::move(transaction)); } else { @@ -3382,7 +3384,7 @@ bool SurfaceFlinger::transactionFlushNeeded() { bool SurfaceFlinger::transactionIsReadyToBeApplied( const FrameTimelineInfo& info, bool isAutoTimestamp, int64_t desiredPresentTime, - const Vector<ComposerState>& states, + uid_t originUid, const Vector<ComposerState>& states, std::unordered_set<sp<IBinder>, ISurfaceComposer::SpHash<IBinder>>& pendingBuffers) { ATRACE_CALL(); const nsecs_t expectedPresentTime = mExpectedPresentTime.load(); @@ -3395,6 +3397,11 @@ bool SurfaceFlinger::transactionIsReadyToBeApplied( ready = false; } + if (!mScheduler->isVsyncValid(expectedPresentTime, originUid)) { + ATRACE_NAME("!isVsyncValid"); + ready = false; + } + for (const ComposerState& state : states) { const layer_state_t& s = state.state; const bool acquireFenceChanged = (s.what & layer_state_t::eAcquireFenceChanged); @@ -3423,11 +3430,6 @@ bool SurfaceFlinger::transactionIsReadyToBeApplied( ready = false; } - if (!mScheduler->isVsyncValid(expectedPresentTime, layer->getOwnerUid())) { - ATRACE_NAME("!isVsyncValidForUid"); - ready = false; - } - if (acquireFenceChanged) { // If backpressure is enabled and we already have a buffer to commit, keep the // transaction in the queue. diff --git a/services/surfaceflinger/SurfaceFlinger.h b/services/surfaceflinger/SurfaceFlinger.h index 529c64b121..3787b9db89 100644 --- a/services/surfaceflinger/SurfaceFlinger.h +++ b/services/surfaceflinger/SurfaceFlinger.h @@ -837,7 +837,7 @@ private: void commitOffscreenLayers(); bool transactionIsReadyToBeApplied( const FrameTimelineInfo& info, bool isAutoTimestamp, int64_t desiredPresentTime, - const Vector<ComposerState>& states, + uid_t originUid, const Vector<ComposerState>& states, std::unordered_set<sp<IBinder>, ISurfaceComposer::SpHash<IBinder>>& pendingBuffers) REQUIRES(mStateLock); uint32_t setDisplayStateLocked(const DisplayState& s) REQUIRES(mStateLock); |