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

Commit 377c2033 authored by Matthew Bouyack's avatar Matthew Bouyack
Browse files

In SurfaceFlinger, test fence before merging

If the old fence for a given layer has already expired, we can replace
it with the new fence rather than merging the two.

This saves 300-400us per frame on Android Wear

Change-Id: I5d907c336c7383ae4e2e0f71e42f23749494a359
parent 6db42ac3
Loading
Loading
Loading
Loading
+12 −0
Original line number Diff line number Diff line
@@ -314,6 +314,18 @@ status_t ConsumerBase::addReleaseFenceLocked(int slot,

    if (!mSlots[slot].mFence.get()) {
        mSlots[slot].mFence = fence;
        return OK;
    }

    auto signaled = mSlots[slot].mFence->hasSignaled();

    if (!signaled) {
        CB_LOGE("fence has invalid state");
        return BAD_VALUE;
    }

    if (*signaled) {
        mSlots[slot].mFence = fence;
    } else {
        char fenceName[32] = {};
        snprintf(fenceName, 32, "%.28s:%d", mName.string(), slot);