Sitelet https://github.com/flutter/flutter/pull/192461
Skip to content

[Linux] Clear the frame when there is nothing to render - #192461

Merged
robert-ancell merged 3 commits into
flutter:masterfrom
robert-ancell:linux-empty-frame
Sep 14, 2026
Merged

robert-ancell merged 3 commits into
flutter:masterfrom
robert-ancell:linux-empty-frame

Conversation

@robert-ancell

Copy link
Copy Markdown
Contributor

If everything on screen is transparent the engine sends a frame with no layers in it. We treated that as "nothing to do" and kept showing the last frame, so the old contents stayed on screen forever.

Now each frame clears before the layers are drawn, so an empty frame clears the window. This also fixes transparent parts of a frame showing the previous frame through them.

Two other things stopped an empty frame working:

  • The Wayland renderer returned before presenting the frame, so a first frame with no layers never showed the window.
  • The software renderer only drew a layer if it was the only layer, and drew it in the corner instead of at its position. It now draws all the layers like the OpenGL renderer does.

Fixes #191870

@robert-ancell
robert-ancell requested a review from a team as a code owner September 9, 2026 04:12
@flutter-dashboard flutter-dashboard Bot added the CICD Run CI/CD label Sep 9, 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 Sep 9, 2026

@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 updates the Linux platform shell's OpenGL and software compositors and renderers to correctly handle frames with zero layers by clearing the previous frame's contents instead of returning early. It also updates the software compositor to support rendering multiple layers with their respective offsets and sizes, and adds corresponding unit tests and mock OpenGL functions to verify these behaviors. There are no review comments, and I have no feedback to provide.

If everything on screen is transparent the engine sends a frame with no
layers in it. We treated that as "nothing to do" and kept showing the
last frame, so the old contents stayed on screen forever.

Now each frame clears before the layers are drawn, so an empty frame
clears the window. This also fixes transparent parts of a frame showing
the previous frame through them.

Two other things stopped an empty frame working:

- The Wayland renderer returned before presenting the frame, so a first
  frame with no layers never showed the window.
- The software renderer only drew a layer if it was the only layer, and
  drew it in the corner instead of at its position. It now draws all the
  layers like the OpenGL renderer does.

Fixes flutter#191870
mattkae
mattkae previously approved these changes Sep 9, 2026

@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.

Makes sense to me! So many code paths 🙃

@robert-ancell robert-ancell added the autosubmit Merge PR when tree becomes green via auto submit App label Sep 10, 2026
@auto-submit auto-submit Bot removed the autosubmit Merge PR when tree becomes green via auto submit App label Sep 10, 2026
@auto-submit

auto-submit Bot commented Sep 10, 2026

Copy link
Copy Markdown
Contributor

autosubmit label was removed for flutter/flutter/192461, because - The status or check suite Dashboard Checks has failed. Please fix the issues identified (or deflake) before re-applying this label.

@robert-ancell robert-ancell added the autosubmit Merge PR when tree becomes green via auto submit App label Sep 10, 2026
@auto-submit auto-submit Bot removed the autosubmit Merge PR when tree becomes green via auto submit App label Sep 10, 2026
@auto-submit

auto-submit Bot commented Sep 10, 2026

Copy link
Copy Markdown
Contributor

autosubmit label was removed for flutter/flutter/192461, because - The status or check suite Dashboard Checks has failed. Please fix the issues identified (or deflake) before re-applying this label.

@mattkae mattkae added the autosubmit Merge PR when tree becomes green via auto submit App label Sep 10, 2026
@auto-submit auto-submit Bot removed the autosubmit Merge PR when tree becomes green via auto submit App label Sep 10, 2026
@auto-submit

auto-submit Bot commented Sep 10, 2026

Copy link
Copy Markdown
Contributor

autosubmit label was removed for flutter/flutter/192461, because - The status or check suite Dashboard Checks has failed. Please fix the issues identified (or deflake) before re-applying this label.

@auto-submit

auto-submit Bot commented Sep 10, 2026

Copy link
Copy Markdown
Contributor

autosubmit label was removed for flutter/flutter/192461, because Pull request flutter/flutter/192461 is not in a mergeable state.

# Conflicts:
#	engine/src/flutter/shell/platform/linux/fl_view_renderer_subsurface.cc
@robert-ancell robert-ancell added the autosubmit Merge PR when tree becomes green via auto submit App label Sep 10, 2026
@auto-submit

auto-submit Bot commented Sep 10, 2026

Copy link
Copy Markdown
Contributor

autosubmit label was removed for flutter/flutter/192461, because - The status or check suite Dashboard Checks has failed. Please fix the issues identified (or deflake) before re-applying this label.

@auto-submit auto-submit Bot removed the autosubmit Merge PR when tree becomes green via auto submit App label Sep 10, 2026
@robert-ancell robert-ancell added the autosubmit Merge PR when tree becomes green via auto submit App label Sep 11, 2026
@auto-submit

auto-submit Bot commented Sep 11, 2026

Copy link
Copy Markdown
Contributor

autosubmit label was removed for flutter/flutter/192461, because - The status or check suite Dashboard Checks has failed. Please fix the issues identified (or deflake) before re-applying this label.

@auto-submit auto-submit Bot removed the autosubmit Merge PR when tree becomes green via auto submit App label Sep 11, 2026
@robert-ancell
robert-ancell added this pull request to the merge queue Sep 14, 2026
Merged via the queue into flutter:master with commit 07b6e70 Sep 14, 2026
30 checks passed
@robert-ancell
robert-ancell deleted the linux-empty-frame branch September 14, 2026 01:03
auto-submit Bot pushed a commit to flutter/packages that referenced this pull request Sep 16, 2026
flutter/flutter@8b3e8f5...27fec0e

2026-09-14 ttankkeo112@gmail.com Add dedicated rubber band spring for overscroll recovery in BouncingScrollPhysics (flutter/flutter#187568)
2026-09-14 engine-flutter-autoroll@skia.org Roll Skia from 83c984a6daf5 to 59904977fcbb (8 revisions) (flutter/flutter#192767)
2026-09-14 34871572+gmackall@users.noreply.github.com Request unbuffered dispatch for platform view motion events after `_PlatformViewGestureRecognizer` rejects gesture (flutter/flutter#192259)
2026-09-14 engine-flutter-autoroll@skia.org Roll Fuchsia GN SDK from ZsxUUK2SfA-TrNvb8... to PDJz3b3CL31uoLOkD... (flutter/flutter#192440)
2026-09-14 codefu@google.com ci(bringup): cleanup some bringup (flutter/flutter#192752)
2026-09-14 kevmoo@users.noreply.github.com Warn users on potential removal of dart:html in dry run (flutter/flutter#192710)
2026-09-14 codefu@google.com docs: migrate design document guidance to flutter/rfc (flutter/flutter#192648)
2026-09-14 154381524+flutteractionsbot@users.noreply.github.com Sync CHANGELOG.md from stable (flutter/flutter#192499)
2026-09-14 engine-flutter-autoroll@skia.org Roll Skia from 7a6fd7ff72d5 to 83c984a6daf5 (1 revision) (flutter/flutter#192745)
2026-09-14 1961493+harryterkelsen@users.noreply.github.com RELAND: [devicelab] Clean up Chrome profile directories and trap abort signals in web benchmarks (flutter/flutter#192655)
2026-09-14 kevmoo@users.noreply.github.com fix(web): hide --web-content-hash until content hashing is complete (flutter/flutter#192663)
2026-09-14 engine-flutter-autoroll@skia.org Roll Skia from 527751088719 to 7a6fd7ff72d5 (2 revisions) (flutter/flutter#192725)
2026-09-14 engine-flutter-autoroll@skia.org Roll Skia from eaf9f82813eb to 527751088719 (1 revision) (flutter/flutter#192722)
2026-09-14 engine-flutter-autoroll@skia.org Roll Fuchsia Linux SDK from AQu85JoTHCMET3Q8G... to 7R1l5MhSZZUr1Q6D1... (flutter/flutter#192719)
2026-09-14 robert.ancell@canonical.com [Linux] Clear the frame when there is nothing to render (flutter/flutter#192461)

If this roll has caused a breakage, revert this CL and set the roller
to dry run mode using the controls here:
https://autoroll.skia.org/r/flutter-packages
Please CC stuartmorgan@google.com,tarrinneal@google.com 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.

[Linux] A frame with nothing to rasterize is never presented, so the previous frame stays on screen indefinitely

2 participants