fix(core): make headless OpenGL display singletons thread-safe#4332
Open
ciscorn wants to merge 7 commits into
Open
fix(core): make headless OpenGL display singletons thread-safe#4332ciscorn wants to merge 7 commits into
ciscorn wants to merge 7 commits into
Conversation
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 8e79cd0f91
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
ciscorn
added a commit
to maplibre/maplibre-native-rs
that referenced
this pull request
Jun 19, 2026
Resolves #229. Linux OpenGL rendering used GLX, which requires X11/Xvfb. This PR adds an EGL context so headless OpenGL works without an X server (beneficial for container environments), and makes EGL the default OpenGL context on Linux. ### Feature changes - `opengl`: OpenGL backend. The Linux default is now EGL (surfaceless, no X server needed) - `glx`: use the GLX (X11) context on Linux (the previous default) ### CI matrix - Linux OpenGL jobs split into `egl` (no xvfb) and `glx` (xvfb). ### Blocker - maplibre/maplibre-native#4332 ### AI assistance Claude was used for investigating MLN and coding assistance.
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.
While experimenting with multi-threaded headless rendering with OpenGL + EGL in maplibre-native-rs, I found that concurrent headless renderer creation can race in the EGL display singleton.
This PR replaces the weak singleton cache with a process-lifetime singleton. I confirmed that this fixes the issue.
The GLX backend does not appear to hit the same display-handle lifetime issue as EGL, but I have observed occasional SEGV. Since it uses a similar weak singleton pattern, this PR applies the same approach to GLX too.