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

Commit 4b9e7c46 authored by Sally Qi's avatar Sally Qi
Browse files

Fix flicker issue on external display.

Relnote: when primary and virtual display fences are already signaled
while external one is still pending, external display fence should be
overridden by merged fence of primary and virtual.

Bug: 264002998
Test: atest libsurfaceflinger_unittest
Change-Id: Ia1ac1fcc20cfd96d148c549c06777be387df1bde
parent c567ddd4
Loading
Loading
Loading
Loading
+3 −4
Original line number Diff line number Diff line
@@ -137,7 +137,6 @@ status_t TransactionCallbackInvoker::addCallbackHandle(const sp<CallbackHandle>&
            sp<Fence> currentFence = future.get().value_or(Fence::NO_FENCE);
            if (prevFence == nullptr && currentFence->getStatus() != Fence::Status::Invalid) {
                prevFence = std::move(currentFence);
                handle->previousReleaseFence = prevFence;
            } else if (prevFence != nullptr) {
                // If both fences are signaled or both are unsignaled, we need to merge
                // them to get an accurate timestamp.
@@ -147,8 +146,7 @@ status_t TransactionCallbackInvoker::addCallbackHandle(const sp<CallbackHandle>&
                    snprintf(fenceName, 32, "%.28s", handle->name.c_str());
                    sp<Fence> mergedFence = Fence::merge(fenceName, prevFence, currentFence);
                    if (mergedFence->isValid()) {
                        handle->previousReleaseFence = std::move(mergedFence);
                        prevFence = handle->previousReleaseFence;
                        prevFence = std::move(mergedFence);
                    }
                } else if (currentFence->getStatus() == Fence::Status::Unsignaled) {
                    // If one fence has signaled and the other hasn't, the unsignaled
@@ -158,10 +156,11 @@ status_t TransactionCallbackInvoker::addCallbackHandle(const sp<CallbackHandle>&
                    // by this point, they will have both signaled and only the timestamp
                    // will be slightly off; any dependencies after this point will
                    // already have been met.
                    handle->previousReleaseFence = std::move(currentFence);
                    prevFence = std::move(currentFence);
                }
            }
        }
        handle->previousReleaseFence = prevFence;
        handle->previousReleaseFences.clear();

        FrameEventHistoryStats eventStats(handle->frameNumber,