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

Commit 59083056 authored by Dan Stoza's avatar Dan Stoza
Browse files

SF: Reduce present fence work

Optimizes the implementation of previousFramePending to only call into
the sync driver once (rather than 2-3 times).

Test: atest libsurfaceflinger_unittest
Bug: 153112939
Change-Id: I79cc96c6bf6aa4e94d79157431caa432f2652b9a
parent 8ea808c0
Loading
Loading
Loading
Loading
+4 −5
Original line number Diff line number Diff line
@@ -1782,11 +1782,10 @@ bool SurfaceFlinger::previousFramePending(int graceTimeMs) NO_THREAD_SAFETY_ANAL
        return false;
    }

    if (graceTimeMs > 0 && fence->getStatus() == Fence::Status::Unsignaled) {
        fence->wait(graceTimeMs);
    }

    return (fence->getStatus() == Fence::Status::Unsignaled);
    const status_t status = fence->wait(graceTimeMs);
    // This is the same as Fence::Status::Unsignaled, but it saves a getStatus() call,
    // which calls wait(0) again internally
    return status == -ETIME;
}

nsecs_t SurfaceFlinger::previousFramePresentTime() NO_THREAD_SAFETY_ANALYSIS {