BeginFrameSourceWayland improved handling for late/missing callbacks [chromium/src : main]

0 views
Skip to first unread message

Kramer Ge (Gerrit)

unread,
Aug 5, 2026, 3:44:59 PM (8 days ago) Aug 5
to Mitchell Cohen, android-bu...@system.gserviceaccount.com, chromium...@chromium.org, max+watc...@igalia.com, nickdiego+wa...@igalia.com, ozone-...@chromium.org
Attention needed from Mitchell Cohen

Kramer Ge added 6 comments

File ui/ozone/platform/wayland/host/begin_frame_source_wayland.cc
Line 274, Patchset 8 (Latest): const bool suspended = frame_manager_->IsWindowSuspended();
Kramer Ge . unresolved

does the compositor always ack a `frame` callback when it un-suspends us? Since we do not trust compositor delivering frame callbacks consistently I think we probably want to observe when window is unsuspended.

File ui/ozone/platform/wayland/host/wayland_frame_manager.h
Line 306, Patchset 8 (Latest): wl::Object<wl_callback> no_damage_frame_callback_;
Kramer Ge . unresolved

There's a potential TODO here, I think we can think about integrating this synthetic callback request as dummy entries into the `submitted_frames_` s.t. we can deduce what bfs should do by looking at the last submitted frame.

File ui/ozone/platform/wayland/host/wayland_frame_manager.cc
Line 244, Patchset 8 (Latest): MaybeProcessPendingFrame();
Kramer Ge . unresolved

This can cause `OnFrameCallbackUnavailable()` being called multiple times back-to-back, if:
```
!should_skip_frame_callbacks_ && !!submitted_frames_.back()->wl_frame_callback
```
which happens when `surface->AttachBuffer()` returns `false`. or when `DiscardFrame()` happens. Ideally we only want to do one beginframe at the end. Perhaps we can do a `ScopedFrameCallbackCount` object which tracks whether this recursive call requested any callback, and call `OnFrameCallbackUnavailable()` if it destructs and that number is 0.

Line 249, Patchset 8 (Latest): if (frame_timing_observer_ && !should_skip_frame_callbacks_ &&
Kramer Ge . unresolved

`should_skip_frame_callbacks_` is true when we know chrome is capturing content, meanwhile the window is suspended. So we should temporarily drive a synthetic begin frame timer in this scenario. With timeout being 100ms google meet video captured in a minimized window would be 10fps.

Line 486, Patchset 8 (Latest): // On Mutter, we don't receive frame.callback acks if we don't attach a
// new wl_buffer, which leads to graphics freeze. So only setup
// frame_callback when we're attaching a different buffer and frame
// callbacks are not being skipped due to video capture in the background.
Kramer Ge . unresolved

I forgot this workaround existed. Is this observation still true? If true, `no_damage_frame_callback_` we set will not be acked and we're still relying on the 100ms timeout.

Line 1031, Patchset 8 (Latest): if (no_damage_frame_callback_ ||
Kramer Ge . unresolved

I think we should reset this field when `Hide()`, because the surface may become unmapped.

Open in Gerrit

Related details

Attention is currently required from:
  • Mitchell Cohen
Submit Requirements:
  • requirement satisfiedCode-Coverage
  • requirement is not satisfiedCode-Owners
  • requirement is not satisfiedCode-Review
  • requirement is not satisfiedNo-Unresolved-Comments
  • requirement is not satisfiedReview-Enforcement
Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
Gerrit-MessageType: comment
Gerrit-Project: chromium/src
Gerrit-Branch: main
Gerrit-Change-Id: I3f3bd16dd105ceafbb88ee4a089cc43379b91048
Gerrit-Change-Number: 8133107
Gerrit-PatchSet: 8
Gerrit-Owner: Mitchell Cohen <mitc...@agilebits.com>
Gerrit-Reviewer: Kramer Ge <fang...@chromium.org>
Gerrit-Attention: Mitchell Cohen <mitc...@agilebits.com>
Gerrit-Comment-Date: Wed, 05 Aug 2026 19:44:49 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
satisfied_requirement
unsatisfied_requirement
open
diffy

Mitchell Cohen (Gerrit)

unread,
Aug 6, 2026, 9:01:06 PM (6 days ago) Aug 6
to android-bu...@system.gserviceaccount.com, Kramer Ge, chromium...@chromium.org, max+watc...@igalia.com, nickdiego+wa...@igalia.com, ozone-...@chromium.org
Attention needed from Kramer Ge

Mitchell Cohen added 7 comments

Patchset-level comments
File-level comment, Patchset 12 (Latest):
Mitchell Cohen . unresolved

Thanks @fang...@chromium.org. Your review inspired me to change the ownership model so that the frame source now owns the BFS, which makes it much easier to observe state changes and control the lifecycle. Let me know what you think!

File ui/ozone/platform/wayland/host/begin_frame_source_wayland.cc
Line 274, Patchset 8: const bool suspended = frame_manager_->IsWindowSuspended();
Kramer Ge . resolved

does the compositor always ack a `frame` callback when it un-suspends us? Since we do not trust compositor delivering frame callbacks consistently I think we probably want to observe when window is unsuspended.

Mitchell Cohen

Done

File ui/ozone/platform/wayland/host/wayland_frame_manager.h
Line 306, Patchset 8: wl::Object<wl_callback> no_damage_frame_callback_;
Kramer Ge . resolved

There's a potential TODO here, I think we can think about integrating this synthetic callback request as dummy entries into the `submitted_frames_` s.t. we can deduce what bfs should do by looking at the last submitted frame.

Mitchell Cohen

Done

File ui/ozone/platform/wayland/host/wayland_frame_manager.cc
Line 244, Patchset 8: MaybeProcessPendingFrame();
Kramer Ge . unresolved

This can cause `OnFrameCallbackUnavailable()` being called multiple times back-to-back, if:
```
!should_skip_frame_callbacks_ && !!submitted_frames_.back()->wl_frame_callback
```
which happens when `surface->AttachBuffer()` returns `false`. or when `DiscardFrame()` happens. Ideally we only want to do one beginframe at the end. Perhaps we can do a `ScopedFrameCallbackCount` object which tracks whether this recursive call requested any callback, and call `OnFrameCallbackUnavailable()` if it destructs and that number is 0.

Mitchell Cohen

True, but it is not a huge issue if `OnFrameCallbackUnavailable()` is called multiple times since the frame source will only handle one frame per vsync.

I think the cleanest improvement would be to replace the tail call with a while loop and some internal state, but it seems like too much for this CL. Thoughts?

Line 249, Patchset 8: if (frame_timing_observer_ && !should_skip_frame_callbacks_ &&
Kramer Ge . resolved

`should_skip_frame_callbacks_` is true when we know chrome is capturing content, meanwhile the window is suspended. So we should temporarily drive a synthetic begin frame timer in this scenario. With timeout being 100ms google meet video captured in a minimized window would be 10fps.

Mitchell Cohen

Done

Line 486, Patchset 8: // On Mutter, we don't receive frame.callback acks if we don't attach a

// new wl_buffer, which leads to graphics freeze. So only setup
// frame_callback when we're attaching a different buffer and frame
// callbacks are not being skipped due to video capture in the background.
Kramer Ge . unresolved

I forgot this workaround existed. Is this observation still true? If true, `no_damage_frame_callback_` we set will not be acked and we're still relying on the 100ms timeout.

Mitchell Cohen

I am unsure about this, I haven't been able to repro it myself.

Line 1031, Patchset 8: if (no_damage_frame_callback_ ||
Kramer Ge . resolved

I think we should reset this field when `Hide()`, because the surface may become unmapped.

Mitchell Cohen

Done

Open in Gerrit

Related details

Attention is currently required from:
  • Kramer Ge
Submit Requirements:
  • requirement satisfiedCode-Coverage
  • requirement is not satisfiedCode-Owners
  • requirement is not satisfiedCode-Review
  • requirement is not satisfiedNo-Unresolved-Comments
  • requirement is not satisfiedReview-Enforcement
Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
Gerrit-MessageType: comment
Gerrit-Project: chromium/src
Gerrit-Branch: main
Gerrit-Change-Id: I3f3bd16dd105ceafbb88ee4a089cc43379b91048
Gerrit-Change-Number: 8133107
Gerrit-PatchSet: 12
Gerrit-Attention: Kramer Ge <fang...@chromium.org>
Gerrit-Comment-Date: Fri, 07 Aug 2026 01:00:53 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
Comment-In-Reply-To: Kramer Ge <fang...@chromium.org>
satisfied_requirement
unsatisfied_requirement
open
diffy
Reply all
Reply to author
Forward
0 new messages