Fix EGL surface recreation after native handle changes - #21816
Merged
Conversation
AB901
marked this pull request as ready for review
July 21, 2026 19:43
|
You can test this PR using the following package version. |
Collaborator
|
Contributor
Author
|
@cla-avalonia agree |
kekekeks
approved these changes
Jul 22, 2026
MrJul
enabled auto-merge
July 24, 2026 14:29
|
You can test this PR using the following package version. |
MrJul
added a commit
that referenced
this pull request
Jul 29, 2026
Co-authored-by: Julien Lebosquain <julien@lebosquain.net>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What changed
BeginDrawCore.EGLSurface.Root cause
Android can destroy a
SurfaceViewsurface while an activity is in the background and provide a newANativeWindowwhen the activity resumes.EglGlPlatformSurface.RenderTargetdetects thatIEglWindowGlPlatformSurfaceInfo.Handlechanged and recreates itsEGLSurface, but_handlewas readonly and was never updated.After the first handle change, the mismatch therefore remained true for every frame. The renderer repeatedly disposed and recreated the
EGLSurface, continued hitting the abandoned BufferQueue associated with the previous native window, reduced frame rate, and could eventually leave the application surface black.User impact
The cached handle now follows the window surface that was used to create the current
EGLSurface. A handle or size change recreates the EGL surface once instead of once per rendered frame.Reproduction and validation
Test device: OPPO PEDM00, Android 14, 120 Hz display.
Reproduction:
Hardware A/B test using the same application and lifecycle code:
BufferQueue has been abandonedmessages and 157dequeueBufferfailures, repeating at roughly 8 ms intervals.BufferQueue has been abandonedmessages and no abandoned-queuedequeueBufferfailures; the process remained alive and the surface stayed visible.Build validation:
An automated regression test is not included because reproducing the failure requires replacing a real native EGL window during the Android
SurfaceViewlifecycle; the current OpenGL test infrastructure does not provide an injectable window-surface/EGL display boundary.