-
Notifications
You must be signed in to change notification settings - Fork 6k
Don't depend on an implicit transaction when presenting drawables on the raster thread. #18076
Conversation
…the raster thread. The way transactions were added changed in flutter@68fd833. This broke rendering using both Metal and OpenGL when no implicit transaction was present on the transaction stack. The failure models differ based on Metal vs. OpenGL and iOS/device versions. On older versions of iOS, rendering would consume memory till exhaustion. On newer iOS versions, rendering would be stuck (till a timeout). This patch brings transaction management back in line with as it was earlier and also makes the Metal backend resilient to transactions being present on the transaction stack at all. Since this is still quite brittle, transaction management must be moved to IOSSurface as a followup. Fixes flutter/flutter#55784.
// When there are platform views in the scene, the drawable needs to be presented in the same | ||
// transaction as the one created for platform views. When the drawable are being presented from | ||
// the raster thread, there is no such transaction. | ||
layer_.get().presentsWithTransaction = [[NSThread currentThread] isMainThread]; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ideally, I would do the same thing in gpu_surace_gl
but that does not have access to the layer as it is platform agnostic. The right fix for this is to add a method to the surface delegate that sets the layer property on iOS.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Shall we add a memory test to our devicelab that plays a video for a while to guard future regressions like flutter/flutter#55784 ? CC @dnfield |
That is necessary but not currently sufficient because the memory issue only manifest on iPhone 6. On newer iPhones, there is stutter till the presentation times out. |
…bles on the raster thread. (flutter/engine#18076)
…bles on the raster thread. (flutter/engine#18076)
…bles on the raster thread. (flutter/engine#18076)
…bles on the raster thread. (flutter/engine#18076)
The way transactions were added changed in
68fd833.
This broke rendering using both Metal and OpenGL when no implicit transaction
was present on the transaction stack. The failure models differ based on Metal
vs. OpenGL and iOS/device versions. On older versions of iOS, rendering would
consume memory till exhaustion. On newer iOS versions, rendering would be stuck
(till a timeout). This patch brings transaction management back in line with as
it was earlier and also makes the Metal backend resilient to transactions being
present on the transaction stack at all. Since this is still quite brittle,
transaction management must be moved to IOSSurface as a followup.
Fixes flutter/flutter#55784.