Second Patch for async RenderEngine
- pass a vector of <LayerSettings> instead of a vector of pointers to
drawLayers function to ensure lifecycle safety.
- capture all local variables to call drawLayerInternals in the render
engine thread to avoid of pointers being invalidated if it takes long
time to pop mFunctions calls.
- change renderScreenImplLocked return type as a shared_future
object to unblock SF main thread for screen capture events.
- block region sampling thread only when SF main thread hasn't
completed capture screen event.
Bug: 180657548
Test: SurfaceFlinger_test, android.hardware.graphics.composer@2.2-vts, libcompositionengine_test, librenderengine_test, libsurfaceflinger_unittest pass
Change-Id: I615f2927d30524988fb12df22fe331e7217c3058
diff --git a/services/surfaceflinger/TransactionCallbackInvoker.h b/services/surfaceflinger/TransactionCallbackInvoker.h
index 7e879e1..100dbfa 100644
--- a/services/surfaceflinger/TransactionCallbackInvoker.h
+++ b/services/surfaceflinger/TransactionCallbackInvoker.h
@@ -18,8 +18,9 @@
#include <condition_variable>
#include <deque>
-#include <queue>
+#include <future>
#include <mutex>
+#include <queue>
#include <thread>
#include <unordered_map>
#include <unordered_set>
@@ -28,6 +29,7 @@
#include <binder/IBinder.h>
#include <gui/ITransactionCompletedListener.h>
+#include <renderengine/RenderEngine.h>
#include <ui/Fence.h>
namespace android {
@@ -42,7 +44,9 @@
wp<IBinder> surfaceControl;
bool releasePreviousBuffer = false;
+ std::string name;
sp<Fence> previousReleaseFence;
+ std::vector<std::shared_future<renderengine::RenderEngineResult>> previousReleaseFences;
nsecs_t acquireTime = -1;
nsecs_t latchTime = -1;
uint32_t transformHint = 0;