First patch for async renderengine.
1. return a std::future object from DrawLayers() instead to make it
asynchronously
2. retire drawFence value from drawLayers() parameter list.
Bug: 180657548
Test: android.hardware.graphics.composer@2.2-vts, libcompositionengine_test, libsurfaceflinger_unittest and
librenderengine_test pass
Change-Id: If63c11762d1cce7b053cc72aaeaed6dd7904877f
diff --git a/services/surfaceflinger/SurfaceFlinger.cpp b/services/surfaceflinger/SurfaceFlinger.cpp
index 5d8d79b..15db2ed 100644
--- a/services/surfaceflinger/SurfaceFlinger.cpp
+++ b/services/surfaceflinger/SurfaceFlinger.cpp
@@ -6328,12 +6328,14 @@
// Use an empty fence for the buffer fence, since we just created the buffer so
// there is no need for synchronization with the GPU.
base::unique_fd bufferFence;
- base::unique_fd drawFence;
getRenderEngine().useProtectedContext(useProtected);
const constexpr bool kUseFramebufferCache = false;
- getRenderEngine().drawLayers(clientCompositionDisplay, clientCompositionLayerPointers, buffer,
- kUseFramebufferCache, std::move(bufferFence), &drawFence);
+ auto [status, drawFence] =
+ getRenderEngine()
+ .drawLayers(clientCompositionDisplay, clientCompositionLayerPointers, buffer,
+ kUseFramebufferCache, std::move(bufferFence))
+ .get();
if (drawFence >= 0) {
sp<Fence> releaseFence = new Fence(dup(drawFence));
@@ -6346,7 +6348,7 @@
// Always switch back to unprotected context.
getRenderEngine().useProtectedContext(false);
- return NO_ERROR;
+ return status;
}
void SurfaceFlinger::windowInfosReported() {