summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChia-I Wu <olv@google.com>2018-06-26 10:18:18 +0800
committerChia-I Wu <olv@google.com>2018-07-03 15:22:06 +0800
commitad8d827e921250c9b5cc52922bc76852136cb49c (patch)
tree160f7442a6f25906ffb2c1ded5eafafb41352036
parenta4e15b05b5b8e50cd5008f777bb719475ea3d955 (diff)
downloadnative-ad8d827e921250c9b5cc52922bc76852136cb49c.tar.gz
surfaceflinger: signalRefresh after boot animation starts
Assume BootStage::BOOTLOADER initially. Switch to BootStage::BOOTANIMATION on first buffer latch and switch to BootStage::FINISHED after bootFinished is called. Do not invoke signalRefresh when in BootStage::BOOTLOADER. We do not want to replace bootloader splash by a blank screen. This saves HWC from workarounds that may or may not work reliably. Bug: 79434305 Bug: 110772452 Test: reboot and observe Change-Id: I9e892e629303177431acd2cfe23f0f984ca6866e Merged-In: I9e892e629303177431acd2cfe23f0f984ca6866e
-rw-r--r--services/surfaceflinger/SurfaceFlinger.cpp11
-rw-r--r--services/surfaceflinger/SurfaceFlinger.h8
2 files changed, 16 insertions, 3 deletions
diff --git a/services/surfaceflinger/SurfaceFlinger.cpp b/services/surfaceflinger/SurfaceFlinger.cpp
index cd51dd1d61..68594661b0 100644
--- a/services/surfaceflinger/SurfaceFlinger.cpp
+++ b/services/surfaceflinger/SurfaceFlinger.cpp
@@ -223,6 +223,7 @@ SurfaceFlinger::SurfaceFlinger(SurfaceFlinger::SkipInitializationTag)
mVisibleRegionsDirty(false),
mGeometryInvalid(false),
mAnimCompositionPending(false),
+ mBootStage(BootStage::BOOTLOADER),
mDebugRegion(0),
mDebugDDMS(0),
mDebugDisableHWC(0),
@@ -231,7 +232,6 @@ SurfaceFlinger::SurfaceFlinger(SurfaceFlinger::SkipInitializationTag)
mLastSwapBufferTime(0),
mDebugInTransaction(0),
mLastTransactionTime(0),
- mBootFinished(false),
mForceFullDamage(false),
mPrimaryDispSync("PrimaryDispSync"),
mPrimaryHWVsyncEnabled(false),
@@ -498,6 +498,7 @@ void SurfaceFlinger::bootFinished()
sp<LambdaMessage> readProperties = new LambdaMessage([&]() {
readPersistentProperties();
+ mBootStage = BootStage::FINISHED;
});
postMessageAsync(readProperties);
}
@@ -1527,7 +1528,7 @@ void SurfaceFlinger::onMessageReceived(int32_t what) {
bool refreshNeeded = handleMessageTransaction();
refreshNeeded |= handleMessageInvalidate();
refreshNeeded |= mRepaintEverything;
- if (refreshNeeded) {
+ if (refreshNeeded && CC_LIKELY(mBootStage != BootStage::BOOTLOADER)) {
// Signal a refresh if a transaction modified the window state,
// a new buffer was latched, or if HWC has requested a full
// repaint
@@ -2886,6 +2887,12 @@ bool SurfaceFlinger::handlePageFlip()
signalLayerUpdate();
}
+ // enter boot animation on first buffer latch
+ if (CC_UNLIKELY(mBootStage == BootStage::BOOTLOADER && newDataLatched)) {
+ ALOGI("Enter boot animation");
+ mBootStage = BootStage::BOOTANIMATION;
+ }
+
// Only continue with the refresh if there is actually new work to do
return !mLayersWithQueuedFrames.empty() && newDataLatched;
}
diff --git a/services/surfaceflinger/SurfaceFlinger.h b/services/surfaceflinger/SurfaceFlinger.h
index 8da97b1264..87bc9ccb0a 100644
--- a/services/surfaceflinger/SurfaceFlinger.h
+++ b/services/surfaceflinger/SurfaceFlinger.h
@@ -808,6 +808,13 @@ private:
sp<Fence> mPreviousPresentFence = Fence::NO_FENCE;
bool mHadClientComposition = false;
+ enum class BootStage {
+ BOOTLOADER,
+ BOOTANIMATION,
+ FINISHED,
+ };
+ BootStage mBootStage;
+
struct HotplugEvent {
hwc2_display_t display;
HWC2::Connection connection = HWC2::Connection::Invalid;
@@ -828,7 +835,6 @@ private:
nsecs_t mLastSwapBufferTime;
volatile nsecs_t mDebugInTransaction;
nsecs_t mLastTransactionTime;
- bool mBootFinished;
bool mForceFullDamage;
bool mPropagateBackpressure = true;
std::unique_ptr<SurfaceInterceptor> mInterceptor =