From d1b485397f4cd538e6ec29cb449f90051a84eaec Mon Sep 17 00:00:00 2001 From: Ady Abraham Date: Wed, 10 Mar 2021 16:05:16 -0800 Subject: SurfaceFlinger: run refresh directly after invalidate Run the refresh immediately after invalidate as there is no point going thru the message queue again, and to ensure that we actually refresh the screen instead of handling other messages that were queued us already n the MessageQueue. Bug: 182214053 Test: SF unit tests Test: Launch an app and observe syatraces Change-Id: Iff647415d46c4b155b20b60b9e7cc07253339100 --- services/surfaceflinger/SurfaceFlinger.cpp | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/services/surfaceflinger/SurfaceFlinger.cpp b/services/surfaceflinger/SurfaceFlinger.cpp index 727386c859..4931bc1544 100644 --- a/services/surfaceflinger/SurfaceFlinger.cpp +++ b/services/surfaceflinger/SurfaceFlinger.cpp @@ -1879,7 +1879,12 @@ void SurfaceFlinger::onMessageInvalidate(int64_t vsyncId, nsecs_t expectedVSyncT // underestimated. mFrameStartTime = frameStart; } - signalRefresh(); + + // Run the refresh immediately after invalidate as there is no point going thru the message + // queue again, and to ensure that we actually refresh the screen instead of handling + // other messages that were queued us already in the MessageQueue. + mRefreshPending = true; + onMessageRefresh(); } } -- cgit v1.2.3-59-g8ed1b