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

Do not share the GrDirectContext across engine instances on Android #28694

Merged
merged 1 commit into from
Sep 18, 2021

Conversation

jason-simmons
Copy link
Member

The AndroidContext is owned by the PlatformViewAndroid and is
destructed on the platform thread. If the AndroidContext owns the
GrDirectContext, then the GrDirectContext will also be destructed on
the platform thread.

This is unsafe because the platform thread does not have the EGL
context required to invoke OpenGL ES APIs.

See flutter/flutter#87937
See flutter/flutter#89658

The AndroidContext is owned by the PlatformViewAndroid and is
destructed on the platform thread.  If the AndroidContext owns the
GrDirectContext, then the GrDirectContext will also be destructed on
the platform thread.

This is unsafe because the platform thread does not have the EGL
context required to invoke OpenGL ES APIs.

See flutter/flutter#87937
See flutter/flutter#89658
@flutter-dashboard
Copy link

It looks like this pull request may not have tests. Please make sure to add tests before merging. If you need an exemption to this rule, contact Hixie on the #hackers channel in Chat.

If you are not sure if you need tests, consider this rule of thumb: the purpose of a test is to make sure someone doesn't accidentally revert the fix. Ask yourself, is there anything in your PR that you feel it is important we not accidentally revert back to how it was before your fix?

Reviewers: Read the Tree Hygiene page and make sure this patch meets those guidelines before LGTMing.

Copy link
Member

@gaaclarke gaaclarke left a comment

Choose a reason for hiding this comment

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

LGTM!
(note: releaseResourcesAndAbandonContext is now called in GPUSurface GL because context_owner_ = true).

@gaaclarke
Copy link
Member

What do we want to do about tests? Since this is sort of revert, we just want to add the test to the PR that reverts it?

@jason-simmons
Copy link
Member Author

yes - this is reverting to the approach used on the Android platform prior to a4f02b7

@jason-simmons jason-simmons added the waiting for tree to go green This PR is approved and tested, but waiting for the tree to be green to land. label Sep 18, 2021
@fluttergithubbot fluttergithubbot merged commit 27281c4 into flutter:master Sep 18, 2021
engine-flutter-autoroll added a commit to engine-flutter-autoroll/flutter that referenced this pull request Sep 18, 2021
gaaclarke added a commit to gaaclarke/engine that referenced this pull request Sep 22, 2021
gaaclarke added a commit to gaaclarke/engine that referenced this pull request Oct 4, 2021
gaaclarke added a commit to gaaclarke/engine that referenced this pull request Oct 19, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
cla: yes needs tests platform-android waiting for tree to go green This PR is approved and tested, but waiting for the tree to be green to land.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants