summaryrefslogtreecommitdiff
path: root/services/surfaceflinger/RegionSamplingThread.cpp
diff options
context:
space:
mode:
author Sally Qi <sallyqi@google.com> 2021-08-20 16:28:35 -0700
committer Sally Qi <sallyqi@google.com> 2021-10-11 16:46:01 -0700
commit403a05bc88c5aa6671adcf4214c2a531f77ac2a4 (patch)
treef5d93d3b2d3815af4f7d5db4fb67936fa33ac5de /services/surfaceflinger/RegionSamplingThread.cpp
parent5795d387464674f24e842ac2ea3477507748b5de (diff)
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
Diffstat (limited to 'services/surfaceflinger/RegionSamplingThread.cpp')
-rw-r--r--services/surfaceflinger/RegionSamplingThread.cpp11
1 files changed, 7 insertions, 4 deletions
diff --git a/services/surfaceflinger/RegionSamplingThread.cpp b/services/surfaceflinger/RegionSamplingThread.cpp
index aa2fec56ad..d0f56b5bdd 100644
--- a/services/surfaceflinger/RegionSamplingThread.cpp
+++ b/services/surfaceflinger/RegionSamplingThread.cpp
@@ -356,10 +356,13 @@ void RegionSamplingThread::captureSample() {
renderengine::ExternalTexture::Usage::WRITEABLE);
}
- const sp<SyncScreenCaptureListener> captureListener = new SyncScreenCaptureListener();
- mFlinger.captureScreenCommon(std::move(renderAreaFuture), traverseLayers, buffer,
- true /* regionSampling */, false /* grayscale */, captureListener);
- ScreenCaptureResults captureResults = captureListener->waitForResults();
+ auto captureScreenResultFuture =
+ mFlinger.captureScreenCommon(std::move(renderAreaFuture), traverseLayers, buffer,
+ true /* regionSampling */, false /* grayscale */, nullptr);
+ auto& captureScreenResult = captureScreenResultFuture.get();
+ if (captureScreenResult.drawFence.ok()) {
+ sync_wait(captureScreenResult.drawFence.get(), -1);
+ }
std::vector<Descriptor> activeDescriptors;
for (const auto& descriptor : descriptors) {