From 7687b3cd32e0d568188ad453a3f940a0c616a121 Mon Sep 17 00:00:00 2001 From: Valerie Hau Date: Wed, 15 Apr 2020 18:09:40 -0700 Subject: [RESTRICT AUTOMERGE] Send callbacks earlier Missed callbacks if connected displayDevice is not powered on Bug: 153112115 Test: build, boot, SurfaceFlinger_test Change-Id: Idb89eebe70535d9bf4ca7a067d8aac10037e1d67 --- services/surfaceflinger/SurfaceFlinger.cpp | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/services/surfaceflinger/SurfaceFlinger.cpp b/services/surfaceflinger/SurfaceFlinger.cpp index 60b3a11754..184deb0147 100644 --- a/services/surfaceflinger/SurfaceFlinger.cpp +++ b/services/surfaceflinger/SurfaceFlinger.cpp @@ -2159,6 +2159,16 @@ void SurfaceFlinger::postComposition() } }); + mTransactionCompletedThread.addPresentFence(mPreviousPresentFences[0]); + + // Lock the mStateLock in case SurfaceFlinger is in the middle of applying a transaction. + // If we do not lock here, a callback could be sent without all of its SurfaceControls and + // metrics. + { + Mutex::Autolock _l(mStateLock); + mTransactionCompletedThread.sendCallbacks(); + } + if (presentFenceTime->isValid()) { mScheduler->addPresentFence(presentFenceTime); } @@ -2230,16 +2240,6 @@ void SurfaceFlinger::postComposition() } } - mTransactionCompletedThread.addPresentFence(mPreviousPresentFences[0]); - - // Lock the mStateLock in case SurfaceFlinger is in the middle of applying a transaction. - // If we do not lock here, a callback could be sent without all of its SurfaceControls and - // metrics. - { - Mutex::Autolock _l(mStateLock); - mTransactionCompletedThread.sendCallbacks(); - } - if (mLumaSampling && mRegionSamplingThread) { mRegionSamplingThread->notifyNewContent(); } -- cgit v1.2.3-59-g8ed1b