Skip to content

fix(linux): bootstrap Flutter EGL on an isolated worker - #273

Merged
nmfisher merged 15 commits into
developfrom
fix/linux-egl-context-bootstrap
Aug 22, 2026
Merged

fix(linux): bootstrap Flutter EGL on an isolated worker#273
nmfisher merged 15 commits into
developfrom
fix/linux-egl-context-bootstrap

Conversation

@nmfisher

@nmfisher nmfisher commented Aug 21, 2026

Copy link
Copy Markdown
Owner

On Linux+EGL, Flutter only exposes the real raster EGLDisplay/EGLContext while FlTextureGL.populate runs, so desktop EGL initialization and texture operations cannot safely run on the Flutter GTK platform or raster threads.

The fix:

  1. Displays a temporary 1x1 bootstrap texture before Filament initializes.
  2. Captures the raster EGLDisplay/EGLContext and GL API/version in populate.
  3. Creates Filament desktop OpenGL on the captured EGLDisplay.
  4. Executes producer EGL initialization, allocation, and destruction on a persistent worker.
  5. Uses the existing GBM/DMA-BUF texture transport for both Flutter desktop GL and GLES, removing the parallel direct-sharing path.

The bootstrap is a narrow texture-ID handshake and does not enter the platform surface descriptor registry. This removes the GDK-context fallback and the separate direct-EGLImage allocation/cleanup implementation.

We also add a smoke test on both X11 and a headless Weston GL compositor with GDK_BACKEND=wayland and no DISPLAY, preventing XWayland fallback. This must run on a self-hosted runner with a real GPU and read/write access to /dev/dri/renderD128.

nmfisher and others added 15 commits August 20, 2026 16:47
🤖 Generated with GitHub Actions
- TEMPORARY push trigger on this branch while under test on the
  self-hosted runner; remove before merging.
- Fall back to :0 when the x11-display input is absent (push events
  have no inputs context, which would otherwise blank DISPLAY).
- Distro-aware dependency step: keep apt-get for Ubuntu, add a dnf
  path for Fedora that no-ops when deps are preinstalled and sudo
  needs a password.

Co-Authored-By: Claude <noreply@anthropic.com>
- ThermionFlutterPluginInitializer -> ThermionTextureBootstrap, moved
  into the widgets layer next to ViewerWidget; the name now says what
  it does (deferred texture handshake) instead of implying a scope.
- The plugin no longer constructs widgets: buildInitializationScope is
  replaced by createContextBootstrap/destroyContextBootstrap, which
  default to null/no-op for platforms without the Linux OpenGL
  prerequisite.
- The injected allocator pair stays a unit: with an injected create
  hook, destruction falls back to the descriptor, never the plugin.

No behavior change; sequencing and dispose-races are covered by
texture_bootstrap_test and lifecycle_test.

Co-Authored-By: Claude <noreply@anthropic.com>
🤖 Generated with GitHub Actions
The branch was validated on the self-hosted X11/Wayland runner; keep the
workflow dispatch-only for future manual runs.

Co-Authored-By: Claude <noreply@anthropic.com>
@nmfisher
nmfisher merged commit fcf2a34 into develop Aug 22, 2026
19 of 20 checks passed
@nmfisher
nmfisher deleted the fix/linux-egl-context-bootstrap branch August 22, 2026 12:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant