From fc46c1e6e58ff5acdc72feea409e4aa03f978be9 Mon Sep 17 00:00:00 2001 From: Vishnu Nair Date: Wed, 21 Apr 2021 08:31:32 -0700 Subject: Introduce ASurfaceTransaction_setOnCommit api Introduce a new callback for SurfaceControl transactions that fire after we commit a transaction in SurfaceFlinger. This will help some clients pace when they should apply the next transaction so it get applied on the next vsync. If they wait for the existing transaction complete callback, there may not be enough time between when the client applies the transaction and surface flinger waking up and apply it on the new vsync. This would mean the update would arrive a frame late. This callback is guaranteed to fire before the transaction complete callback. It includes all the stats as the transaction complete callback with the exception of jank data, present fence and the previous buffer release fence. This callback piggybacks of the oncomplete callback implementation by modifying the callback id to provide a callback type. The callbacks are filtered in SurfaceFlinger to invoke them earlier. In SurfaceComposerClient, they are filtered again to make sure the callbacks are invoked in order, oncommit before oncomplete. Bug: 185843251 Test: atest ASurfaceControlTest Change-Id: I57e85d75214376935e366d3825a6f3f1a8a4e79b --- libs/gui/ISurfaceComposer.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'libs/gui/ISurfaceComposer.cpp') diff --git a/libs/gui/ISurfaceComposer.cpp b/libs/gui/ISurfaceComposer.cpp index 454aa9eb7b..0e28966a9b 100644 --- a/libs/gui/ISurfaceComposer.cpp +++ b/libs/gui/ISurfaceComposer.cpp @@ -99,7 +99,7 @@ public: SAFE_PARCEL(data.writeVectorSize, listenerCallbacks); for (const auto& [listener, callbackIds] : listenerCallbacks) { SAFE_PARCEL(data.writeStrongBinder, listener); - SAFE_PARCEL(data.writeInt64Vector, callbackIds); + SAFE_PARCEL(data.writeParcelableVector, callbackIds); } SAFE_PARCEL(data.writeUint64, transactionId); @@ -1246,7 +1246,7 @@ status_t BnSurfaceComposer::onTransact( for (int32_t i = 0; i < listenersSize; i++) { SAFE_PARCEL(data.readStrongBinder, &tmpBinder); std::vector callbackIds; - SAFE_PARCEL(data.readInt64Vector, &callbackIds); + SAFE_PARCEL(data.readParcelableVector, &callbackIds); listenerCallbacks.emplace_back(tmpBinder, callbackIds); } -- cgit v1.2.3-59-g8ed1b