summaryrefslogtreecommitdiff
path: root/services/surfaceflinger/RegionSamplingThread.cpp
diff options
context:
space:
mode:
author Melody Hsu <melodymhsu@google.com> 2024-10-29 07:24:29 +0000
committer Melody Hsu <melodymhsu@google.com> 2024-10-29 07:31:21 +0000
commit0b80c74300b73e937ee9a9cb58487bd126daa4d8 (patch)
tree0b99de22cc2999a5ffed6b2aa354ad6fb1bbb2ef /services/surfaceflinger/RegionSamplingThread.cpp
parent2a10ab9b5c1d2135243e60caf38e9214609f5984 (diff)
Reorder release fence attachment for non-threaded RE
Changes when release fences are attached to layers for non-threaded RenderEngine to ensure that fences are added and fired in the same hop to the main thread. This removes the dependency on legacy screenshot code and prevents a deadlock where screenshot requests are blocked on the main thread while the main thread is blocked on the previous screenshot request finishing. Bug: b/351894825 Test: atest SurfaceFlinger_test Flag: EXEMPT refactor and for flag removal Change-Id: If9d4134aba1106484f94231c5104a57a605147b8
Diffstat (limited to 'services/surfaceflinger/RegionSamplingThread.cpp')
-rw-r--r--services/surfaceflinger/RegionSamplingThread.cpp11
1 files changed, 5 insertions, 6 deletions
diff --git a/services/surfaceflinger/RegionSamplingThread.cpp b/services/surfaceflinger/RegionSamplingThread.cpp
index 011fd9e20a..08f831c8e5 100644
--- a/services/surfaceflinger/RegionSamplingThread.cpp
+++ b/services/surfaceflinger/RegionSamplingThread.cpp
@@ -354,14 +354,13 @@ void RegionSamplingThread::captureSample() {
RenderArea::Options::CAPTURE_SECURE_LAYERS);
FenceResult fenceResult;
- if (FlagManager::getInstance().single_hop_screenshot() &&
- mFlinger.mRenderEngine->isThreaded()) {
- std::vector<sp<LayerFE>> layerFEs;
- auto displayState = mFlinger.getSnapshotsFromMainThread(renderAreaBuilder,
- getLayerSnapshotsFn, layerFEs);
+ if (FlagManager::getInstance().single_hop_screenshot()) {
+ std::vector<std::pair<Layer*, sp<LayerFE>>> layers;
+ auto displayState =
+ mFlinger.getSnapshotsFromMainThread(renderAreaBuilder, getLayerSnapshotsFn, layers);
fenceResult = mFlinger.captureScreenshot(renderAreaBuilder, buffer, kRegionSampling,
kGrayscale, kIsProtected, kAttachGainmap, nullptr,
- displayState, layerFEs)
+ displayState, layers)
.get();
} else {
fenceResult = mFlinger.captureScreenshotLegacy(renderAreaBuilder, getLayerSnapshotsFn,