Skip to content
This repository was archived by the owner on Feb 25, 2025. It is now read-only.

Commit df253d9

Browse files
author
Jonah Williams
authored
[Impeller] revert removal of wait until scheduled. (#44121)
More context is "See also", but this doesn't work for applications with particularly high application load. Reverts #42160 Fixes flutter/flutter#131490 See also : flutter/flutter#131520
1 parent f5c17f0 commit df253d9

File tree

1 file changed

+6
-24
lines changed

1 file changed

+6
-24
lines changed

impeller/renderer/backend/metal/surface_mtl.mm

Lines changed: 6 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -218,20 +218,6 @@
218218
return IRect::MakeSize(resolve_texture_->GetSize());
219219
}
220220

221-
static bool ShouldWaitForCommandBuffer() {
222-
#if ((FML_OS_MACOSX && !FML_OS_IOS) || FML_OS_IOS_SIMULATOR)
223-
// If a transaction is present, `presentDrawable` will present too early. And
224-
// so we wait on an empty command buffer to get scheduled instead, which
225-
// forces us to also wait for all of the previous command buffers in the queue
226-
// to get scheduled.
227-
return true;
228-
#else
229-
// On Physical iOS devices we still need to wait if we're taking a frame
230-
// capture.
231-
return [[MTLCaptureManager sharedCaptureManager] isCapturing];
232-
#endif // ((FML_OS_MACOSX && !FML_OS_IOS) || FML_OS_IOS_SIMULATOR)
233-
}
234-
235221
// |Surface|
236222
bool SurfaceMTL::Present() const {
237223
auto context = context_.lock();
@@ -262,16 +248,12 @@ static bool ShouldWaitForCommandBuffer() {
262248
}
263249

264250
if (drawable_) {
265-
// In certain situations, we need to wait until the command queue has been
266-
// flushed before presenting to the onscreen texture. See the comments in
267-
// `ShouldWaitForCommandBuffer` for more details.
268-
if (ShouldWaitForCommandBuffer()) {
269-
id<MTLCommandBuffer> command_buffer =
270-
ContextMTL::Cast(context.get())
271-
->CreateMTLCommandBuffer("Present Waiter Command Buffer");
272-
[command_buffer commit];
273-
[command_buffer waitUntilScheduled];
274-
}
251+
TRACE_EVENT0("flutter", "waitUntilScheduled");
252+
id<MTLCommandBuffer> command_buffer =
253+
ContextMTL::Cast(context.get())
254+
->CreateMTLCommandBuffer("Present Waiter Command Buffer");
255+
[command_buffer commit];
256+
[command_buffer waitUntilScheduled];
275257
[drawable_ present];
276258
}
277259

0 commit comments

Comments
 (0)