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

Commit 14c9c7bb authored by Chia-I Wu's avatar Chia-I Wu
Browse files

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
parent 29671059
Loading
Loading
Loading
Loading
+12 −3
Original line number Diff line number Diff line
@@ -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,7 +498,10 @@ void SurfaceFlinger::bootFinished()
    LOG_EVENT_LONG(LOGTAG_SF_STOP_BOOTANIM,
                   ns2ms(systemTime(SYSTEM_TIME_MONOTONIC)));

    postMessageAsync(new LambdaMessage([this] { readPersistentProperties(); }));
    postMessageAsync(new LambdaMessage([this] {
        readPersistentProperties();
        mBootStage = BootStage::FINISHED;
    }));
}

uint32_t SurfaceFlinger::getNewTexture() {
@@ -1478,7 +1481,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
@@ -2835,6 +2838,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;
}
+7 −1
Original line number Diff line number Diff line
@@ -804,6 +804,13 @@ private:
    sp<Fence> mPreviousPresentFence = Fence::NO_FENCE;
    bool mHadClientComposition = false;

    enum class BootStage {
        BOOTLOADER,
        BOOTANIMATION,
        FINISHED,
    };
    BootStage mBootStage;

    struct HotplugEvent {
        hwc2_display_t hwcDisplayId;
        HWC2::Connection connection = HWC2::Connection::Invalid;
@@ -824,7 +831,6 @@ private:
    nsecs_t mLastSwapBufferTime;
    volatile nsecs_t mDebugInTransaction;
    nsecs_t mLastTransactionTime;
    bool mBootFinished;
    bool mForceFullDamage;
    bool mPropagateBackpressure = true;
    std::unique_ptr<SurfaceInterceptor> mInterceptor =