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

Commit 1d844de1 authored by Ben Widawsky's avatar Ben Widawsky Committed by Android (Google) Code Review
Browse files

Merge "SF: Use VsyncSchedule's ID for EventThread" into main

parents 6919a49a 59954c48
Loading
Loading
Loading
Loading
+7 −7
Original line number Diff line number Diff line
@@ -426,8 +426,8 @@ void EventThread::onVsync(nsecs_t vsyncTime, nsecs_t wakeupTime, nsecs_t readyTi

    LOG_FATAL_IF(!mVSyncState);
    mVsyncTracer = (mVsyncTracer + 1) % 2;
    mPendingEvents.push_back(makeVSync(mVSyncState->displayId, wakeupTime, ++mVSyncState->count,
                                       vsyncTime, readyTime));
    mPendingEvents.push_back(makeVSync(mVsyncSchedule->getPhysicalDisplayId(), wakeupTime,
                                       ++mVSyncState->count, vsyncTime, readyTime));
    mCondition.notify_all();
}

@@ -486,9 +486,9 @@ void EventThread::threadMain(std::unique_lock<std::mutex>& lock) {
            if (event->header.type == DisplayEventReceiver::DISPLAY_EVENT_HOTPLUG) {
                if (event->hotplug.connectionError == 0) {
                    if (event->hotplug.connected && !mVSyncState) {
                        mVSyncState.emplace(event->header.displayId);
                    } else if (!event->hotplug.connected && mVSyncState &&
                               mVSyncState->displayId == event->header.displayId) {
                        mVSyncState.emplace();
                    } else if (!event->hotplug.connected &&
                               mVsyncSchedule->getPhysicalDisplayId() == event->header.displayId) {
                        mVSyncState.reset();
                    }
                } else {
@@ -559,7 +559,7 @@ void EventThread::threadMain(std::unique_lock<std::mutex>& lock) {
                const auto now = systemTime(SYSTEM_TIME_MONOTONIC);
                const auto deadlineTimestamp = now + timeout.count();
                const auto expectedVSyncTime = deadlineTimestamp + timeout.count();
                mPendingEvents.push_back(makeVSync(mVSyncState->displayId, now,
                mPendingEvents.push_back(makeVSync(mVsyncSchedule->getPhysicalDisplayId(), now,
                                                   ++mVSyncState->count, expectedVSyncTime,
                                                   deadlineTimestamp));
            }
@@ -739,7 +739,7 @@ void EventThread::dump(std::string& result) const {
    StringAppendF(&result, "%s: state=%s VSyncState=", mThreadName, toCString(mState));
    if (mVSyncState) {
        StringAppendF(&result, "{displayId=%s, count=%u%s}\n",
                      to_string(mVSyncState->displayId).c_str(), mVSyncState->count,
                      to_string(mVsyncSchedule->getPhysicalDisplayId()).c_str(), mVSyncState->count,
                      mVSyncState->synthetic ? ", synthetic" : "");
    } else {
        StringAppendF(&result, "none\n");
+0 −4
Original line number Diff line number Diff line
@@ -235,10 +235,6 @@ private:

    // VSYNC state of connected display.
    struct VSyncState {
        explicit VSyncState(PhysicalDisplayId displayId) : displayId(displayId) {}

        const PhysicalDisplayId displayId;

        // Number of VSYNC events since display was connected.
        uint32_t count = 0;

+2 −0
Original line number Diff line number Diff line
@@ -112,6 +112,8 @@ public:

    bool getPendingHardwareVsyncState() const REQUIRES(kMainThreadContext);

    PhysicalDisplayId getPhysicalDisplayId() const { return mId; }

protected:
    using ControllerPtr = std::unique_ptr<VsyncController>;