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

Commit 9845fe6a authored by Rachel Lee's avatar Rachel Lee Committed by Automerger Merge Worker
Browse files

Merge "Revert "Don't clear timestamps when enabling HW vsync."" into...

Merge "Revert "Don't clear timestamps when enabling HW vsync."" into udc-qpr-dev am: 17c5b081 am: 820ff386

Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/native/+/23753602



Change-Id: Id4c10851c4c740d5f72fd2182ee658a244ae424c
Signed-off-by: default avatarAutomerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
parents 7f187a9d 820ff386
Loading
Loading
Loading
Loading
+1 −10
Original line number Diff line number Diff line
@@ -17,7 +17,6 @@
#define ATRACE_TAG ATRACE_TAG_GRAPHICS

#include <ftl/fake_guard.h>
#include <gui/TraceUtils.h>
#include <scheduler/Fps.h>
#include <scheduler/Timer.h>

@@ -145,14 +144,6 @@ void VsyncSchedule::startPeriodTransition(Period period, bool force) {
}

bool VsyncSchedule::addResyncSample(TimePoint timestamp, ftl::Optional<Period> hwcVsyncPeriod) {
    ATRACE_CALL();

    if (mClearTimestampsOnNextSample) {
        ATRACE_FORMAT("clearing sample after HW vsync enabled", __func__);
        getTracker().resetModel();
        mClearTimestampsOnNextSample = false;
    }

    bool needsHwVsync = false;
    bool periodFlushed = false;
    {
@@ -179,7 +170,7 @@ void VsyncSchedule::enableHardwareVsync() {

void VsyncSchedule::enableHardwareVsyncLocked() {
    if (mHwVsyncState == HwVsyncState::Disabled) {
        mClearTimestampsOnNextSample = true;
        getTracker().resetModel();
        mRequestHardwareVsync(mId, true);
        mHwVsyncState = HwVsyncState::Enabled;
    }
+0 −5
Original line number Diff line number Diff line
@@ -151,11 +151,6 @@ private:
    // device is off.
    HwVsyncState mPendingHwVsyncState GUARDED_BY(kMainThreadContext) = HwVsyncState::Disabled;

    // Whether to reset the timestamps stored in the vsync model on the next hw vsync sample. This
    // is to avoid clearing the model when hw vsync is enabled, in order to be consistent with the
    // stale timestamps. Instead, clear the model on the first hw vsync callback.
    bool mClearTimestampsOnNextSample = false;

    class PredictedVsyncTracer;
    using TracerPtr = std::unique_ptr<PredictedVsyncTracer>;

+7 −5
Original line number Diff line number Diff line
@@ -91,16 +91,18 @@ struct EventThreadIsSupportedVariant : public EventThreadBaseSupportedVariant {
};

struct DispSyncIsSupportedVariant {
    static void setupStartPeriodTransitionCallExpectations(DisplayTransactionTest* test) {
    static void setupResetModelCallExpectations(DisplayTransactionTest* test) {
        auto vsyncSchedule = test->mFlinger.scheduler()->getVsyncSchedule();
        EXPECT_CALL(static_cast<mock::VsyncController&>(vsyncSchedule->getController()),
                    startPeriodTransition(DEFAULT_VSYNC_PERIOD, false))
                .Times(1);
        EXPECT_CALL(static_cast<mock::VSyncTracker&>(vsyncSchedule->getTracker()), resetModel())
                .Times(1);
    }
};

struct DispSyncNotSupportedVariant {
    static void setupStartPeriodTransitionCallExpectations(DisplayTransactionTest* /* test */) {}
    static void setupResetModelCallExpectations(DisplayTransactionTest* /* test */) {}
};

// --------------------------------------------------------------------
@@ -123,7 +125,7 @@ struct TransitionOffToOnVariant : public TransitionVariantCommon<PowerMode::OFF,
    static void setupCallExpectations(DisplayTransactionTest* test) {
        Case::setupComposerCallExpectations(test, IComposerClient::PowerMode::ON);
        Case::EventThread::setupEnableVsyncCallExpectations(test);
        Case::DispSync::setupStartPeriodTransitionCallExpectations(test);
        Case::DispSync::setupResetModelCallExpectations(test);
        Case::setupRepaintEverythingCallExpectations(test);
    }

@@ -184,7 +186,7 @@ struct TransitionDozeSuspendToDozeVariant
    template <typename Case>
    static void setupCallExpectations(DisplayTransactionTest* test) {
        Case::EventThread::setupEnableVsyncCallExpectations(test);
        Case::DispSync::setupStartPeriodTransitionCallExpectations(test);
        Case::DispSync::setupResetModelCallExpectations(test);
        Case::setupComposerCallExpectations(test, Case::Doze::ACTUAL_POWER_MODE_FOR_DOZE);
    }
};
@@ -202,7 +204,7 @@ struct TransitionDozeSuspendToOnVariant
    template <typename Case>
    static void setupCallExpectations(DisplayTransactionTest* test) {
        Case::EventThread::setupEnableVsyncCallExpectations(test);
        Case::DispSync::setupStartPeriodTransitionCallExpectations(test);
        Case::DispSync::setupResetModelCallExpectations(test);
        Case::setupComposerCallExpectations(test, IComposerClient::PowerMode::ON);
    }
};