-
Notifications
You must be signed in to change notification settings - Fork 29.7k
Description
Background
In flutter/engine#42160 I removed the final command buffer schedule as we observed no problems with this on common scenarios. Unfortunately @knopp discovered that this isn't always valid. For now, lets revert to make sure things are still working. That said, there is definitely some room for improvement here:
Overview
Impeller unconditionally sets presentsWithTransaction to true. From the documentation:
Setting this value to YES makes the layer draw its contents synchronously, using whichever Core Animation transaction is current at the time you call the drawable’s present method. To ensure that a transaction is available when you schedule the drawable to be presented, first commit the command buffer containing your Metal rendering commands. Then, call its waitUntilScheduled method to synchronously wait until the command queue schedules the command buffer to execute on the GPU. Finally, call the drawable’s present method.
Removing the [waitUntilScheduled] call appeared to work because the applications we tested on weren't under enough load. The application in #131490 (comment) is much, much heavier.
So what is happening?
Some of the UI isn't showing up, if I were to guess I would say that some % of the cmd buffers aren't scheduled and are simply getting dropped by CA. That would imply there are two ways to fix it:
-
Add back the waitUntilScheduled. This was reported to work and confirmed by me. Doing so follows the documention above as well.
-
Set presentsWithTransaction to
NO. This is confirmed by me to work locally, though using a slightly different[command_buffer presentDrawable:drawable_];technique.
We require presentsWithTransaction to be enabled when presenting with platform views in the scene. Previously we switched from conditionally presenting with transaction to unconditionally presenting in flutter/engine#41501 . We can't opt out of this unless we fixed the issue.