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

Commit cb4aaaa2 authored by Automerger Merge Worker's avatar Automerger Merge Worker
Browse files

Merge "[AChoreographer] Resolves a deadlock" into rvc-dev am: a821321b am:...

Merge "[AChoreographer] Resolves a deadlock" into rvc-dev am: a821321b am: 230381c3 am: b3042800

Change-Id: I061d6b7cf23c6c7ef1d1272d5bb0cfb9fc581468
parents 2760e076 b3042800
Loading
Loading
Loading
Loading
+12 −3
Original line number Diff line number Diff line
@@ -185,9 +185,18 @@ void Choreographer::unregisterRefreshRateCallback(AChoreographer_refreshRateCall
}

void Choreographer::scheduleCallbacks() {
    const nsecs_t now = systemTime(SYSTEM_TIME_MONOTONIC);
    nsecs_t dueTime;
    {
        AutoMutex _{mLock};
    nsecs_t now = systemTime(SYSTEM_TIME_MONOTONIC);
    if (mFrameCallbacks.top().dueTime <= now) {
        // If there are no pending callbacks then don't schedule a vsync
        if (mFrameCallbacks.empty()) {
            return;
        }
        dueTime = mFrameCallbacks.top().dueTime;
    }

    if (dueTime <= now) {
        ALOGV("choreographer %p ~ scheduling vsync", this);
        scheduleVsync();
        return;