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

Commit a7cda15d authored by Robert Carr's avatar Robert Carr
Browse files

SurfaceFlinger: Check frameIsEarly earlier

If we allow the transaction to apply but then later delay
the buffer we may end up 'splitting a transaction' applying
part of it without applying an included buffer.

Bug: 179712630
Test: Existing tests pass
Change-Id: Ia54ba0f9b34a7b676af95418181c2e0f0b807b25
parent d2bed277
Loading
Loading
Loading
Loading
+0 −6
Original line number Diff line number Diff line
@@ -414,12 +414,6 @@ bool BufferLayer::shouldPresentNow(nsecs_t expectedPresentTime) const {
        return true;
    }

    // If the next planned present time is not current, return and try again later
    if (frameIsEarly(expectedPresentTime)) {
        ATRACE_NAME("frameIsEarly()");
        return false;
    }

    // If this layer doesn't have a frame is shouldn't be presented
    if (!hasFrameUpdate()) {
        return false;
+2 −0
Original line number Diff line number Diff line
@@ -924,6 +924,8 @@ public:

    pid_t getOwnerPid() { return mOwnerPid; }

    virtual bool frameIsEarly(nsecs_t /*expectedPresentTime*/) const { return false; }

    // This layer is not a clone, but it's the parent to the cloned hierarchy. The
    // variable mClonedChild represents the top layer that will be cloned so this
    // layer will be the parent of mClonedChild.
+4 −0
Original line number Diff line number Diff line
@@ -3361,6 +3361,10 @@ bool SurfaceFlinger::transactionIsReadyToBeApplied(
        if (!layer) {
            continue;
        }
        if (layer->frameIsEarly(expectedPresentTime)) {
            ATRACE_NAME("frameIsEarly()");
            return false;
        }

        if (!mScheduler->isVsyncValid(expectedPresentTime, layer->getOwnerUid())) {
            ATRACE_NAME("!isVsyncValidForUid");