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

Commit 1130b3dc authored by Ady Abraham's avatar Ady Abraham
Browse files

SF: fix frameTimelineVsyncId = 0

Fix a case where we would send 0 as the frame vsync id,
which is incorrect.

Test: expand notification shade + press power button
Bug: 181694819
Bug: 162890590
Change-Id: I7b910f9d022424a9a5246883d958f0c2a1933f5c
parent 30c6ac31
Loading
Loading
Loading
Loading
+9 −3
Original line number Original line Diff line number Diff line
@@ -354,7 +354,7 @@ void EventThread::onVSyncEvent(nsecs_t timestamp, nsecs_t expectedVSyncTimestamp
            return mTokenManager->generateTokenForPredictions(
            return mTokenManager->generateTokenForPredictions(
                    {timestamp, deadlineTimestamp, expectedVSyncTimestamp});
                    {timestamp, deadlineTimestamp, expectedVSyncTimestamp});
        }
        }
        return static_cast<int64_t>(0);
        return FrameTimelineInfo::INVALID_VSYNC_ID;
    }();
    }();


    mPendingEvents.push_back(makeVSync(mVSyncState->displayId, timestamp, ++mVSyncState->count,
    mPendingEvents.push_back(makeVSync(mVSyncState->displayId, timestamp, ++mVSyncState->count,
@@ -494,10 +494,16 @@ void EventThread::threadMain(std::unique_lock<std::mutex>& lock) {
                const auto now = systemTime(SYSTEM_TIME_MONOTONIC);
                const auto now = systemTime(SYSTEM_TIME_MONOTONIC);
                const auto deadlineTimestamp = now + timeout.count();
                const auto deadlineTimestamp = now + timeout.count();
                const auto expectedVSyncTime = deadlineTimestamp + timeout.count();
                const auto expectedVSyncTime = deadlineTimestamp + timeout.count();
                // TODO(b/162890590): use TokenManager to populate vsyncId
                const int64_t vsyncId = [&] {
                    if (mTokenManager != nullptr) {
                        return mTokenManager->generateTokenForPredictions(
                                {now, deadlineTimestamp, expectedVSyncTime});
                    }
                    return FrameTimelineInfo::INVALID_VSYNC_ID;
                }();
                mPendingEvents.push_back(makeVSync(mVSyncState->displayId, now,
                mPendingEvents.push_back(makeVSync(mVSyncState->displayId, now,
                                                   ++mVSyncState->count, expectedVSyncTime,
                                                   ++mVSyncState->count, expectedVSyncTime,
                                                   deadlineTimestamp, /*vsyncId=*/0));
                                                   deadlineTimestamp, vsyncId));
            }
            }
        }
        }
    }
    }