From bb561921105876e1be4a82cceb71a475e3fa1adf Mon Sep 17 00:00:00 2001 From: Vadim Caen Date: Tue, 29 Oct 2024 15:57:24 +0100 Subject: Fix condition for waiting next frame mNextFrameNumber is initiallized to 1. If we want to wait for the first frame to be drawn, one would expect to call mSurface.waitForNextFrame(0 /* lastFrame */), but since mNextFrameNumber is always greater then lastFrame, the method never waits. Test: N/A Bug: 376248818 Bug: 376828703 Flag: EXEMPT bug fix Change-Id: I8804479bad8102a441a95951ac27c1cc0711d7b0 --- libs/gui/Surface.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'libs/gui/Surface.cpp') diff --git a/libs/gui/Surface.cpp b/libs/gui/Surface.cpp index 66e7ddd915..e41f9bbf43 100644 --- a/libs/gui/Surface.cpp +++ b/libs/gui/Surface.cpp @@ -2735,8 +2735,8 @@ status_t Surface::unlockAndPost() bool Surface::waitForNextFrame(uint64_t lastFrame, nsecs_t timeout) { Mutex::Autolock lock(mMutex); - if (mNextFrameNumber > lastFrame) { - return true; + if (mLastFrameNumber > lastFrame) { + return true; } return mQueueBufferCondition.waitRelative(mMutex, timeout) == OK; } -- cgit v1.2.3-59-g8ed1b