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

Conversation

chinmaygarde
Copy link
Member

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.

…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];
Copy link
Member Author

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.

Copy link
Contributor

@cyanglaz cyanglaz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

Copy link
Member

@cbracken cbracken left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM stamp from a Japanese personal seal

@liyuqian
Copy link
Contributor

liyuqian commented May 1, 2020

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

@chinmaygarde
Copy link
Member Author

Shall we add a memory test

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.

@chinmaygarde chinmaygarde merged commit e9f2060 into flutter:master May 1, 2020
@chinmaygarde chinmaygarde deleted the transaction_present branch May 1, 2020 20:05
engine-flutter-autoroll added a commit to engine-flutter-autoroll/flutter that referenced this pull request May 1, 2020
engine-flutter-autoroll added a commit to engine-flutter-autoroll/flutter that referenced this pull request May 1, 2020
engine-flutter-autoroll added a commit to engine-flutter-autoroll/flutter that referenced this pull request May 2, 2020
engine-flutter-autoroll added a commit to engine-flutter-autoroll/flutter that referenced this pull request May 5, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Video player causes iOS app to run out of memory and crash
5 participants