diff options
author | 2024-05-08 03:51:46 +0000 | |
---|---|---|
committer | 2024-05-08 18:39:02 +0000 | |
commit | 2ffa36b70412a84873e67a6d31123bafdafc9b78 (patch) | |
tree | e6435c0459d91470bf24d6f073ea604d4262f860 /services/surfaceflinger/RegionSamplingThread.cpp | |
parent | d844150e737bd1745837f53bbacaa8725d72aecb (diff) |
Refactor RenderAreaFuture to use RenderAreaBuilder
Cleans up renderArea logic and allows all the work that needs
to be done on the main thread in the same place. This will aid
in the effort to reduce the number of hops to the SF main
thread during screenshots.
Bug: b/294936197
Test: atest SurfaceFlinger_test
Test: presubmit
Change-Id: I4234b49638aaecceb8d1fcff7f5cd43698b6c47f
Diffstat (limited to 'services/surfaceflinger/RegionSamplingThread.cpp')
-rw-r--r-- | services/surfaceflinger/RegionSamplingThread.cpp | 18 |
1 files changed, 8 insertions, 10 deletions
diff --git a/services/surfaceflinger/RegionSamplingThread.cpp b/services/surfaceflinger/RegionSamplingThread.cpp index 2ec20ad5c2..2b4e234604 100644 --- a/services/surfaceflinger/RegionSamplingThread.cpp +++ b/services/surfaceflinger/RegionSamplingThread.cpp @@ -279,14 +279,6 @@ void RegionSamplingThread::captureSample() { const Rect sampledBounds = sampleRegion.bounds(); constexpr bool kHintForSeamlessTransition = false; - SurfaceFlinger::RenderAreaFuture renderAreaFuture = ftl::defer([=] { - DisplayRenderAreaBuilder displayRenderArea(sampledBounds, sampledBounds.getSize(), - ui::Dataspace::V0_SRGB, - kHintForSeamlessTransition, - true /* captureSecureLayers */, displayWeak); - return displayRenderArea.build(); - }); - std::unordered_set<sp<IRegionSamplingListener>, SpHash<IRegionSamplingListener>> listeners; auto layerFilterFn = [&](const char* layerName, uint32_t layerId, const Rect& bounds, @@ -381,8 +373,14 @@ void RegionSamplingThread::captureSample() { constexpr bool kIsProtected = false; if (const auto fenceResult = - mFlinger.captureScreenshot(std::move(renderAreaFuture), getLayerSnapshots, buffer, - kRegionSampling, kGrayscale, kIsProtected, nullptr) + mFlinger.captureScreenshot(SurfaceFlinger::RenderAreaBuilderVariant( + std::in_place_type<DisplayRenderAreaBuilder>, + sampledBounds, sampledBounds.getSize(), + ui::Dataspace::V0_SRGB, + kHintForSeamlessTransition, + true /* captureSecureLayers */, displayWeak), + getLayerSnapshots, buffer, kRegionSampling, kGrayscale, + kIsProtected, nullptr) .get(); fenceResult.ok()) { fenceResult.value()->waitForever(LOG_TAG); |