Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

EGL context cannot be shared between threads #59930

Closed
blasten opened this issue Jun 20, 2020 · 10 comments · Fixed by flutter/engine#20722
Closed

EGL context cannot be shared between threads #59930

blasten opened this issue Jun 20, 2020 · 10 comments · Fixed by flutter/engine#20722
Assignees
Labels
a: platform-views Embedding Android/iOS views in Flutter apps engine flutter/engine repository. See also e: labels. P0 Critical issues such as a build break or regression

Comments

@blasten
Copy link

blasten commented Jun 20, 2020

If context is current to some other thread, or if either draw or read are bound to contexts in another thread, an EGL_BAD_ACCESS error is generated.
https://www.khronos.org/registry/EGL/sdk/docs/man/html/eglMakeCurrent.xhtml

This affects hybrid mode because the raster and the platform thread need to be merged. We might need to make a separate EGL context for the platform thread.

@blasten blasten added the engine flutter/engine repository. See also e: labels. label Jun 20, 2020
@blasten blasten added this to To do in Ecosystem - Bitcoin Jun 20, 2020
@blasten
Copy link
Author

blasten commented Jun 20, 2020

This is required for #58291

@blasten
Copy link
Author

blasten commented Jun 22, 2020

This is blocked as dynamic thread merging isn't ready. From @cyanglaz:

deadlock in shell::OnPlatformViewDestroy

@cyanglaz
Copy link
Contributor

#57067 is the issue blocking thread merging

@chinmaygarde
Copy link
Member

chinmaygarde commented Aug 17, 2020

This was cross referenced from #63585. Can this just be reworded to "Enable dynamic thread merging on Android." to better reflect the action item? Can you comment on the priority? This seems like a blocker to the platform views work.

@chinmaygarde chinmaygarde added this to the 1.22 - August 2020 milestone Aug 17, 2020
@chinmaygarde chinmaygarde added P2 a: platform-views Embedding Android/iOS views in Flutter apps labels Aug 17, 2020
@blasten
Copy link
Author

blasten commented Aug 17, 2020

@chinmaygarde priority looks good. I will update this issue in a bit as I'm currently debugging this issue.

@blasten
Copy link
Author

blasten commented Aug 20, 2020

This issue is fixed by clearing the context before the context switch. For instance, in the raster thread before it is made current on the platform thread. However, a single context switch appears to cause significant frame drops. I haven’t identified the cause.

@cyanglaz I initially thought that resetting the context on every frame was the cause, but I have verified that the slow down occurs after a single reset. So, it might not be related to the context reset. I’m still investigating.

@cyanglaz
Copy link
Contributor

I haven't tried this yet but: does context switching without thread merging also cause performance issues?

@blasten
Copy link
Author

blasten commented Aug 20, 2020

does context switching without thread merging also cause performance issues?

No

@github-actions
Copy link

This thread has been automatically locked since there has not been any recent activity after it was closed. If you are still experiencing a similar issue, please open a new bug, including the output of flutter doctor -v and a minimal reproduction of the issue.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Aug 13, 2021
@flutter-triage-bot flutter-triage-bot bot added P0 Critical issues such as a build break or regression and removed P2 labels Jun 28, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
a: platform-views Embedding Android/iOS views in Flutter apps engine flutter/engine repository. See also e: labels. P0 Critical issues such as a build break or regression
3 participants