Skip to content

Commit fac5ec2

Browse files
committed
Dispatch tonemapAndDrawGainmap on main thread with non-threaded RE
Bug: 404962998 Flag: EXEMPT bug fix Test: builds Change-Id: Ia9cbe71665cd11fc5076204776ef4bac85ff7c05
1 parent 7d0d256 commit fac5ec2

File tree

1 file changed

+16
-6
lines changed

1 file changed

+16
-6
lines changed

services/surfaceflinger/SurfaceFlinger.cpp

Lines changed: 16 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -7876,12 +7876,22 @@ ftl::SharedFuture<FenceResult> SurfaceFlinger::captureScreenshot(
78767876
return fenceResult;
78777877
}
78787878

7879-
return getRenderEngine()
7880-
.tonemapAndDrawGainmap(hdrBuffer, fenceResult.value()->get(),
7881-
hdrSdrRatio,
7882-
static_cast<ui::Dataspace>(dataspace),
7883-
buffer, gainmapBuffer)
7884-
.get();
7879+
auto tonemapAndDrawGainmap = [&]() -> FenceResult {
7880+
return getRenderEngine()
7881+
.tonemapAndDrawGainmap(hdrBuffer,
7882+
fenceResult.value()->get(),
7883+
hdrSdrRatio,
7884+
static_cast<ui::Dataspace>(
7885+
dataspace),
7886+
buffer, gainmapBuffer)
7887+
.get();
7888+
};
7889+
7890+
if (mRenderEngine->isThreaded()) {
7891+
return tonemapAndDrawGainmap();
7892+
} else {
7893+
return mScheduler->schedule(std::move(tonemapAndDrawGainmap)).get();
7894+
}
78857895
})
78867896
.share();
78877897
} else {

0 commit comments

Comments
 (0)