SurfaceFlinger: Emit TransactionCompleted callbacks directly.
Transaction complete callbacks (BLAST Buffer release callbacks), are
emitted from a TransactionCompletedThread. There's no clear reason
for this behavior, as the actual runtime is exceedingly minimal. This
opens us to scheduling delays when we call
TransactionCompletedThread.sendCallbacks. In this CL we both remove the
threaded nature of TransactionCompletedThread, and also take advantage
of it running on the main thread to reduce some unnecessary copying and
further reduce its runtime.
Bug: 176691195
Test: Existing tests pass
Change-Id: Ib1661df24c4a2ee39fc28c29a395158ce0ee7b7f
diff --git a/services/surfaceflinger/BufferStateLayer.cpp b/services/surfaceflinger/BufferStateLayer.cpp
index 3dc62e3..5b831a7 100644
--- a/services/surfaceflinger/BufferStateLayer.cpp
+++ b/services/surfaceflinger/BufferStateLayer.cpp
@@ -188,7 +188,7 @@
JankData(surfaceFrame->getToken(), surfaceFrame->getJankType().value()));
}
- mFlinger->getTransactionCompletedThread().finalizePendingCallbackHandles(
+ mFlinger->getTransactionCallbackInvoker().finalizePendingCallbackHandles(
mDrawingState.callbackHandles, jankData);
mDrawingState.callbackHandles = {};
@@ -443,14 +443,14 @@
// Notify the transaction completed thread that there is a pending latched callback
// handle
- mFlinger->getTransactionCompletedThread().registerPendingCallbackHandle(handle);
+ mFlinger->getTransactionCallbackInvoker().registerPendingCallbackHandle(handle);
// Store so latched time and release fence can be set
mCurrentState.callbackHandles.push_back(handle);
} else { // If this layer will NOT need to be relatched and presented this frame
// Notify the transaction completed thread this handle is done
- mFlinger->getTransactionCompletedThread().registerUnpresentedCallbackHandle(handle);
+ mFlinger->getTransactionCallbackInvoker().registerUnpresentedCallbackHandle(handle);
}
}