Skip to content

Fix black window in the subsurface view renderer - #191850

Merged
auto-submit[bot] merged 2 commits into
flutter:masterfrom
robert-ancell:fix-subsurface-texture-format
Aug 28, 2026
Merged

auto-submit[bot] merged 2 commits into
flutter:masterfrom
robert-ancell:fix-subsurface-texture-format

Conversation

@robert-ancell

Copy link
Copy Markdown
Contributor

FlViewRendererSubsurface is the default renderer on Wayland, so Flutter apps running with Impeller on Mesa drivers currently show nothing but a black window.

It picked its framebuffer format from
epoxy_has_gl_extension("GL_EXT_texture_format_BGRA8888"), which asks what the driver is capable of rather than what the engine actually rendered. The frame was composited into a BGRA framebuffer while the engine had rendered RGBA, so nothing reached the screen. The failure is silent: the framebuffer is complete, no GL errors are raised, and the Wayland surface is committed as normal.

That check used to be correct, and was invalidated by 5f97c7f ("Fixes MSAA on the linux embedder", #191379) in two ways:

  • It replaced the identical check in fl_opengl_frame.cc with one that reads the format the engine reported in the layer's backing store, making the extension check the stale copy of a rule that had moved on.
  • It made the engine render RGBA even where the extension is advertised. With Impeller the backing store is now allocated by fl_framebuffer_new_multisample(), whose offscreen MSAA path attaches a multisample renderbuffer of GL_RGBA8 and no texture, and fl_engine.cc reports GL_RGBA8 for those. Driver capability and rendered format are therefore no longer the same question.

FlViewRendererSubsurface was written before that landed and merged cleanly after it, in 706edcd ("Add FlViewRendererSubsurface", #191389), because the two changes touch different files and so never conflicted textually.

Move the rule into fl_compositor_opengl_get_frame_format() and use it from both paths so they cannot disagree again. fl_engine.cc remains the only place that chooses a format; both consumers now follow what it reports. Every backing store in a frame is created from context-wide capabilities, so they all share a format, and the first one describes the frame. Take it from the first backing store rather than the first layer, as platform views carry no format and would otherwise decide it by being drawn first.

The bug is not reachable from a unit test, as presenting a frame requires a realized Wayland subsurface and the tests run on X11, so test the shared function directly, including that an advertised extension does not change its result.

FlViewRendererSubsurface is the default renderer on Wayland, so Flutter apps
running with Impeller on Mesa drivers currently show nothing but a black
window.

It picked its framebuffer format from
epoxy_has_gl_extension("GL_EXT_texture_format_BGRA8888"), which asks what the
driver is capable of rather than what the engine actually rendered. The frame
was composited into a BGRA framebuffer while the engine had rendered RGBA, so
nothing reached the screen. The failure is silent: the framebuffer is
complete, no GL errors are raised, and the Wayland surface is committed as
normal.

That check used to be correct, and was invalidated by 5f97c7f ("Fixes MSAA
on the linux embedder", flutter#191379) in two ways:

- It replaced the identical check in fl_opengl_frame.cc with one that reads
  the format the engine reported in the layer's backing store, making the
  extension check the stale copy of a rule that had moved on.
- It made the engine render RGBA even where the extension is advertised. With
  Impeller the backing store is now allocated by
  fl_framebuffer_new_multisample(), whose offscreen MSAA path attaches a
  multisample renderbuffer of GL_RGBA8 and no texture, and fl_engine.cc
  reports GL_RGBA8 for those. Driver capability and rendered format are
  therefore no longer the same question.

FlViewRendererSubsurface was written before that landed and merged cleanly
after it, in 706edcd ("Add FlViewRendererSubsurface", flutter#191389), because
the two changes touch different files and so never conflicted textually.

Move the rule into fl_compositor_opengl_get_frame_format() and use it from
both paths so they cannot disagree again. fl_engine.cc remains the only place
that chooses a format; both consumers now follow what it reports. Every
backing store in a frame is created from context-wide capabilities, so they
all share a format, and the first one describes the frame. Take it from the
first backing store rather than the first layer, as platform views carry no
format and would otherwise decide it by being drawn first.

The bug is not reachable from a unit test, as presenting a frame requires a
realized Wayland subsurface and the tests run on X11, so test the shared
function directly, including that an advertised extension does not change its
result.
@robert-ancell
robert-ancell requested a review from a team as a code owner August 27, 2026 00:22
@flutter-dashboard flutter-dashboard Bot added the CICD Run CI/CD label Aug 27, 2026
@github-actions github-actions Bot added engine flutter/engine related. See also e: labels. platform-linux Building on or for Linux specifically a: desktop Running on desktop team-linux Owned by the Linux platform team labels Aug 27, 2026
@robert-ancell
robert-ancell requested a review from mattkae August 27, 2026 00:22

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Code Review

This pull request introduces fl_compositor_opengl_get_frame_format to determine the texture format for compositing layers based on their backing stores, replacing ad-hoc format detection in fl_opengl_frame.cc and fl_view_renderer_subsurface.cc. Feedback highlights an issue where open_gl.framebuffer.target is accessed without verifying open_gl.type, which is unsafe when the backing store is a texture. Additionally, the feedback recommends updating the new unit tests to explicitly initialize open_gl.type to match the active union member being tested.

Comment thread engine/src/flutter/shell/platform/linux/fl_compositor_opengl.cc
FlutterOpenGLBackingStore is a union discriminated by open_gl.type, so
framebuffer.target is only meaningful when that type is
kFlutterOpenGLTargetTypeFramebuffer. Check it before reading, and fall back to
RGBA otherwise.

fl_engine.cc only ever creates framebuffer backing stores, so this does not
change behaviour, but it keeps the function from reporting a format read out
of an inactive union member.

The existing tests built backing stores with a framebuffer but left open_gl.type
zeroed, which is kFlutterOpenGLTargetTypeTexture, so they described something
the engine never produces. Set the type they mean.

@mattkae mattkae left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Nice!

@robert-ancell robert-ancell added the autosubmit Merge PR when tree becomes green via auto submit App label Aug 27, 2026
@auto-submit
auto-submit Bot added this pull request to the merge queue Aug 27, 2026
Merged via the queue into flutter:master with commit 684c004 Aug 28, 2026
23 checks passed
@flutter-dashboard flutter-dashboard Bot removed the autosubmit Merge PR when tree becomes green via auto submit App label Aug 28, 2026
@robert-ancell
robert-ancell deleted the fix-subsurface-texture-format branch August 28, 2026 01:59
auto-submit Bot pushed a commit to flutter/packages that referenced this pull request Aug 28, 2026
flutter/flutter@e8dca90...8d8c1aa

2026-08-28 [email protected] Roll Packages from bd3cbc1 to cd4cdd0 (15 revisions) (flutter/flutter#191965)
2026-08-28 [email protected] Bump customer testing version to pick up forui tests (flutter/flutter#191931)
2026-08-28 [email protected] Use leading scroll offset instead of infinite offset to reveal pinned slivers (flutter/flutter#191329)
2026-08-28 [email protected] Roll Skia from 21f71051e749 to fe0b9a5261f9 (1 revision) (flutter/flutter#191960)
2026-08-28 [email protected] Share the common Linux window controller code in mixins (flutter/flutter#191930)
2026-08-28 [email protected] Roll Dart SDK from 2cf2f69fd9f0 to ae63a6eca3f1 (1 revision) (flutter/flutter#191953)
2026-08-28 [email protected] Roll Skia from 11e3a7cb0fd0 to 21f71051e749 (3 revisions) (flutter/flutter#191942)
2026-08-28 [email protected] Roll Dart SDK from e030e77d5413 to 2cf2f69fd9f0 (2 revisions) (flutter/flutter#191934)
2026-08-28 [email protected] Remove no-shuffle in flutter tools overall experience test (flutter/flutter#191861)
2026-08-28 [email protected] [flutter_tools] Gracefully handle Windows Application Control and security policy execution blocks (flutter/flutter#191912)
2026-08-28 [email protected] [tool] Migrate ConfigCommand to modular dependency injection (flutter/flutter#190743)
2026-08-28 [email protected] Roll Skia from 37459da0a755 to 11e3a7cb0fd0 (9 revisions) (flutter/flutter#191929)
2026-08-28 [email protected] Connect to moved-to-rect after the window is realized (flutter/flutter#191773)
2026-08-28 [email protected] macOS: Compare accessibility strings as NSStrings in tests (flutter/flutter#191853)
2026-08-28 [email protected] macOS: Record test accessibility notifications in a dictionary (flutter/flutter#191854)
2026-08-28 [email protected] Roll Fuchsia Test Scripts from 6SXRz6wsA2Zm_rAqP... to u_fSMsPU22VvUsvSo... (flutter/flutter#191927)
2026-08-28 [email protected] Roll Dart SDK from cb4c39d067f3 to e030e77d5413 (3 revisions) (flutter/flutter#191923)
2026-08-27 [email protected] Migrate ios driver tests batch 2 to simulators (flutter/flutter#190930)
2026-08-27 [email protected] [flutter_test] Ensure LiveTestWidgetsFlutterBinding executes frame and pointer callbacks in the test zone (flutter/flutter#191595)
2026-08-27 [email protected] Deprecate legacy gen_defaults tool (flutter/flutter#191911)
2026-08-27 [email protected] Fix black window in the subsurface view renderer (flutter/flutter#191850)
2026-08-27 [email protected] Roll Skia from 82e972ea84b1 to 37459da0a755 (10 revisions) (flutter/flutter#191906)
2026-08-27 [email protected] iOS: Key the platform view factory registries by NSString (flutter/flutter#191855)
2026-08-27 [email protected] Sync CHANGELOG.md from stable (flutter/flutter#191895)
2026-08-27 [email protected] [flutter_tools] Honor configured build-dir across flutter project and build targets (flutter/flutter#191592)
2026-08-27 [email protected] Revert: Handle linear and radial gradients in UberSDF (flutter/flutter#191913)
2026-08-27 [email protected] Explicitly disable HCPP in hybrid_android_views integration test (flutter/flutter#191894)

If this roll has caused a breakage, revert this CL and stop the roller
using the controls here:
https://autoroll.skia.org/r/flutter-packages
Please CC [email protected],[email protected] on the revert to ensure that a human
is aware of the problem.

To file a bug in Packages: https://github.com/flutter/flutter/issues/new/choose

To report a problem with the AutoRoller itself, please file a bug:
https://issues.skia.org/issues/new?component=1389291&template=1850622

Documentation for the AutoRoller is here:
https://skia.googlesource.com/buildbot/+doc/main/autoroll/README.md
victorsanni pushed a commit to victorsanni/packages that referenced this pull request Sep 9, 2026
…r#12679)

flutter/flutter@e8dca90...8d8c1aa

2026-08-28 [email protected] Roll Packages from bd3cbc1 to cd4cdd0 (15 revisions) (flutter/flutter#191965)
2026-08-28 [email protected] Bump customer testing version to pick up forui tests (flutter/flutter#191931)
2026-08-28 [email protected] Use leading scroll offset instead of infinite offset to reveal pinned slivers (flutter/flutter#191329)
2026-08-28 [email protected] Roll Skia from 21f71051e749 to fe0b9a5261f9 (1 revision) (flutter/flutter#191960)
2026-08-28 [email protected] Share the common Linux window controller code in mixins (flutter/flutter#191930)
2026-08-28 [email protected] Roll Dart SDK from 2cf2f69fd9f0 to ae63a6eca3f1 (1 revision) (flutter/flutter#191953)
2026-08-28 [email protected] Roll Skia from 11e3a7cb0fd0 to 21f71051e749 (3 revisions) (flutter/flutter#191942)
2026-08-28 [email protected] Roll Dart SDK from e030e77d5413 to 2cf2f69fd9f0 (2 revisions) (flutter/flutter#191934)
2026-08-28 [email protected] Remove no-shuffle in flutter tools overall experience test (flutter/flutter#191861)
2026-08-28 [email protected] [flutter_tools] Gracefully handle Windows Application Control and security policy execution blocks (flutter/flutter#191912)
2026-08-28 [email protected] [tool] Migrate ConfigCommand to modular dependency injection (flutter/flutter#190743)
2026-08-28 [email protected] Roll Skia from 37459da0a755 to 11e3a7cb0fd0 (9 revisions) (flutter/flutter#191929)
2026-08-28 [email protected] Connect to moved-to-rect after the window is realized (flutter/flutter#191773)
2026-08-28 [email protected] macOS: Compare accessibility strings as NSStrings in tests (flutter/flutter#191853)
2026-08-28 [email protected] macOS: Record test accessibility notifications in a dictionary (flutter/flutter#191854)
2026-08-28 [email protected] Roll Fuchsia Test Scripts from 6SXRz6wsA2Zm_rAqP... to u_fSMsPU22VvUsvSo... (flutter/flutter#191927)
2026-08-28 [email protected] Roll Dart SDK from cb4c39d067f3 to e030e77d5413 (3 revisions) (flutter/flutter#191923)
2026-08-27 [email protected] Migrate ios driver tests batch 2 to simulators (flutter/flutter#190930)
2026-08-27 [email protected] [flutter_test] Ensure LiveTestWidgetsFlutterBinding executes frame and pointer callbacks in the test zone (flutter/flutter#191595)
2026-08-27 [email protected] Deprecate legacy gen_defaults tool (flutter/flutter#191911)
2026-08-27 [email protected] Fix black window in the subsurface view renderer (flutter/flutter#191850)
2026-08-27 [email protected] Roll Skia from 82e972ea84b1 to 37459da0a755 (10 revisions) (flutter/flutter#191906)
2026-08-27 [email protected] iOS: Key the platform view factory registries by NSString (flutter/flutter#191855)
2026-08-27 [email protected] Sync CHANGELOG.md from stable (flutter/flutter#191895)
2026-08-27 [email protected] [flutter_tools] Honor configured build-dir across flutter project and build targets (flutter/flutter#191592)
2026-08-27 [email protected] Revert: Handle linear and radial gradients in UberSDF (flutter/flutter#191913)
2026-08-27 [email protected] Explicitly disable HCPP in hybrid_android_views integration test (flutter/flutter#191894)

If this roll has caused a breakage, revert this CL and stop the roller
using the controls here:
https://autoroll.skia.org/r/flutter-packages
Please CC [email protected],[email protected] on the revert to ensure that a human
is aware of the problem.

To file a bug in Packages: https://github.com/flutter/flutter/issues/new/choose

To report a problem with the AutoRoller itself, please file a bug:
https://issues.skia.org/issues/new?component=1389291&template=1850622

Documentation for the AutoRoller is here:
https://skia.googlesource.com/buildbot/+doc/main/autoroll/README.md
victorsanni pushed a commit to victorsanni/packages that referenced this pull request Sep 9, 2026
…r#12679)

flutter/flutter@e8dca90...8d8c1aa

2026-08-28 [email protected] Roll Packages from bd3cbc1 to cd4cdd0 (15 revisions) (flutter/flutter#191965)
2026-08-28 [email protected] Bump customer testing version to pick up forui tests (flutter/flutter#191931)
2026-08-28 [email protected] Use leading scroll offset instead of infinite offset to reveal pinned slivers (flutter/flutter#191329)
2026-08-28 [email protected] Roll Skia from 21f71051e749 to fe0b9a5261f9 (1 revision) (flutter/flutter#191960)
2026-08-28 [email protected] Share the common Linux window controller code in mixins (flutter/flutter#191930)
2026-08-28 [email protected] Roll Dart SDK from 2cf2f69fd9f0 to ae63a6eca3f1 (1 revision) (flutter/flutter#191953)
2026-08-28 [email protected] Roll Skia from 11e3a7cb0fd0 to 21f71051e749 (3 revisions) (flutter/flutter#191942)
2026-08-28 [email protected] Roll Dart SDK from e030e77d5413 to 2cf2f69fd9f0 (2 revisions) (flutter/flutter#191934)
2026-08-28 [email protected] Remove no-shuffle in flutter tools overall experience test (flutter/flutter#191861)
2026-08-28 [email protected] [flutter_tools] Gracefully handle Windows Application Control and security policy execution blocks (flutter/flutter#191912)
2026-08-28 [email protected] [tool] Migrate ConfigCommand to modular dependency injection (flutter/flutter#190743)
2026-08-28 [email protected] Roll Skia from 37459da0a755 to 11e3a7cb0fd0 (9 revisions) (flutter/flutter#191929)
2026-08-28 [email protected] Connect to moved-to-rect after the window is realized (flutter/flutter#191773)
2026-08-28 [email protected] macOS: Compare accessibility strings as NSStrings in tests (flutter/flutter#191853)
2026-08-28 [email protected] macOS: Record test accessibility notifications in a dictionary (flutter/flutter#191854)
2026-08-28 [email protected] Roll Fuchsia Test Scripts from 6SXRz6wsA2Zm_rAqP... to u_fSMsPU22VvUsvSo... (flutter/flutter#191927)
2026-08-28 [email protected] Roll Dart SDK from cb4c39d067f3 to e030e77d5413 (3 revisions) (flutter/flutter#191923)
2026-08-27 [email protected] Migrate ios driver tests batch 2 to simulators (flutter/flutter#190930)
2026-08-27 [email protected] [flutter_test] Ensure LiveTestWidgetsFlutterBinding executes frame and pointer callbacks in the test zone (flutter/flutter#191595)
2026-08-27 [email protected] Deprecate legacy gen_defaults tool (flutter/flutter#191911)
2026-08-27 [email protected] Fix black window in the subsurface view renderer (flutter/flutter#191850)
2026-08-27 [email protected] Roll Skia from 82e972ea84b1 to 37459da0a755 (10 revisions) (flutter/flutter#191906)
2026-08-27 [email protected] iOS: Key the platform view factory registries by NSString (flutter/flutter#191855)
2026-08-27 [email protected] Sync CHANGELOG.md from stable (flutter/flutter#191895)
2026-08-27 [email protected] [flutter_tools] Honor configured build-dir across flutter project and build targets (flutter/flutter#191592)
2026-08-27 [email protected] Revert: Handle linear and radial gradients in UberSDF (flutter/flutter#191913)
2026-08-27 [email protected] Explicitly disable HCPP in hybrid_android_views integration test (flutter/flutter#191894)

If this roll has caused a breakage, revert this CL and stop the roller
using the controls here:
https://autoroll.skia.org/r/flutter-packages
Please CC [email protected],[email protected] on the revert to ensure that a human
is aware of the problem.

To file a bug in Packages: https://github.com/flutter/flutter/issues/new/choose

To report a problem with the AutoRoller itself, please file a bug:
https://issues.skia.org/issues/new?component=1389291&template=1850622

Documentation for the AutoRoller is here:
https://skia.googlesource.com/buildbot/+doc/main/autoroll/README.md
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

a: desktop Running on desktop CICD Run CI/CD engine flutter/engine related. See also e: labels. platform-linux Building on or for Linux specifically team-linux Owned by the Linux platform team

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants