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

Commit c56f5c2a authored by Treehugger Robot's avatar Treehugger Robot Committed by Android (Google) Code Review
Browse files

Merge "SF: keep HWVsync on as long as present fences are ignored" into main

parents 80fead48 a16ac678
Loading
Loading
Loading
Loading
+5 −0
Original line number Diff line number Diff line
@@ -217,6 +217,11 @@ bool VSyncReactor::addHwVsyncTimestamp(nsecs_t timestamp, std::optional<nsecs_t>
        mMoreSamplesNeeded = mTracker.needsMoreSamples();
    }

    if (mExternalIgnoreFences) {
      // keep HWVSync on as long as we ignore present fences.
      mMoreSamplesNeeded = true;
    }

    if (!mMoreSamplesNeeded) {
        setIgnorePresentFencesInternal(false);
    }
+6 −10
Original line number Diff line number Diff line
@@ -195,9 +195,7 @@ TEST_F(VSyncReactorTest, ignoresPresentFencesWhenToldTo) {

TEST_F(VSyncReactorTest, ignoresProperlyAfterAPeriodConfirmation) {
    bool periodFlushed = true;
    EXPECT_CALL(*mMockTracker, addVsyncTimestamp(_)).Times(2);
    mReactor.setIgnorePresentFences(true);

    EXPECT_CALL(*mMockTracker, addVsyncTimestamp(_)).Times(3);
    nsecs_t const newPeriod = 5000;

    mReactor.onDisplayModeChanged(displayMode(newPeriod), false);
@@ -207,7 +205,7 @@ TEST_F(VSyncReactorTest, ignoresProperlyAfterAPeriodConfirmation) {
    EXPECT_FALSE(mReactor.addHwVsyncTimestamp(newPeriod, std::nullopt, &periodFlushed));
    EXPECT_TRUE(periodFlushed);

    EXPECT_TRUE(mReactor.addPresentFence(generateSignalledFenceWithTime(0)));
    EXPECT_FALSE(mReactor.addPresentFence(generateSignalledFenceWithTime(0)));
}

TEST_F(VSyncReactorTest, setPeriodCalledOnceConfirmedChange) {
@@ -463,8 +461,7 @@ TEST_F(VSyncReactorTest, hwVsyncIsRequestedForTrackerMultiplePeriodChanges) {

TEST_F(VSyncReactorTest, periodChangeWithGivenVsyncPeriod) {
    bool periodFlushed = true;
    EXPECT_CALL(*mMockTracker, addVsyncTimestamp(_)).Times(2);
    mReactor.setIgnorePresentFences(true);
    EXPECT_CALL(*mMockTracker, addVsyncTimestamp(_)).Times(3);

    nsecs_t const newPeriod = 5000;
    mReactor.onDisplayModeChanged(displayMode(newPeriod), false);
@@ -476,7 +473,7 @@ TEST_F(VSyncReactorTest, periodChangeWithGivenVsyncPeriod) {
    EXPECT_FALSE(mReactor.addHwVsyncTimestamp(newPeriod, newPeriod, &periodFlushed));
    EXPECT_TRUE(periodFlushed);

    EXPECT_TRUE(mReactor.addPresentFence(generateSignalledFenceWithTime(0)));
    EXPECT_FALSE(mReactor.addPresentFence(generateSignalledFenceWithTime(0)));
}

TEST_F(VSyncReactorTest, periodIsMeasuredIfIgnoringComposer) {
@@ -486,8 +483,7 @@ TEST_F(VSyncReactorTest, periodIsMeasuredIfIgnoringComposer) {
                         *mMockTracker, kPendingLimit, true /* supportKernelIdleTimer */);

    bool periodFlushed = true;
    EXPECT_CALL(*mMockTracker, addVsyncTimestamp(_)).Times(4);
    idleReactor.setIgnorePresentFences(true);
    EXPECT_CALL(*mMockTracker, addVsyncTimestamp(_)).Times(5);

    // First, set the same period, which should only be confirmed when we receive two
    // matching callbacks
@@ -512,7 +508,7 @@ TEST_F(VSyncReactorTest, periodIsMeasuredIfIgnoringComposer) {
    EXPECT_FALSE(idleReactor.addHwVsyncTimestamp(20000, 5000, &periodFlushed));
    EXPECT_TRUE(periodFlushed);

    EXPECT_TRUE(idleReactor.addPresentFence(generateSignalledFenceWithTime(0)));
    EXPECT_FALSE(idleReactor.addPresentFence(generateSignalledFenceWithTime(0)));
}

} // namespace android::scheduler