BeginFrameSource implementation for Wayland [chromium/src : main]

0 views
Skip to first unread message

Mitchell Cohen (Gerrit)

unread,
Jan 21, 2026, 4:43:12 PM (11 days ago) Jan 21
to Kramer Ge, AyeAye, chromium...@chromium.org, Ian Vollick, chromium-a...@chromium.org, extension...@chromium.org, jbauma...@chromium.org, max+watc...@igalia.com, nickdiego+wa...@igalia.com, ozone-...@chromium.org, roblia...@chromium.org, sky+...@chromium.org
Attention needed from Kramer Ge

Mitchell Cohen added 1 comment

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

@fang...@chromium.org: I don't know exactly what it would take to get this production-ready or if it's even the right approach. Will comment on code where I have some questions I wasn't able to answer.

I based this on the existing classes and factory method and iOS implementation which has similar constraints (needing to go across process boundaries). It does seem to work, and I thought it might be a good starting point to investigate.

Run with `./chrome --enable-features=WaylandExternalBeginFrameSource --vmodule=begin_frame_source_wayland=1`.

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: I5bc7a8c1e791e607ce854af59a1bca6286dbc418
Gerrit-Change-Number: 7507210
Gerrit-PatchSet: 1
Gerrit-Owner: Mitchell Cohen <mitc...@agilebits.com>
Gerrit-Reviewer: Kramer Ge <fang...@chromium.org>
Gerrit-CC: Ian Vollick <vol...@chromium.org>
Gerrit-Attention: Kramer Ge <fang...@chromium.org>
Gerrit-Comment-Date: Wed, 21 Jan 2026 21:43:08 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
satisfied_requirement
unsatisfied_requirement
open
diffy

Mitchell Cohen (Gerrit)

unread,
Jan 21, 2026, 4:56:40 PM (11 days ago) Jan 21
to Jonathan Ross, AyeAye, chromium...@chromium.org, Ian Vollick, chromium-a...@chromium.org, extension...@chromium.org, jbauma...@chromium.org, max+watc...@igalia.com, nickdiego+wa...@igalia.com, ozone-...@chromium.org, roblia...@chromium.org, sky+...@chromium.org

Mitchell Cohen added 4 comments

File ui/compositor/begin_frame_source_wayland.cc
Line 153, Patchset 1 (Latest): // There won't be a frame callback with no damage so schedule one.
Mitchell Cohen . unresolved

is this something that could be changed on the WaylandFrameManager side?

Line 161, Patchset 1 (Latest): // Safety fallback in case the frame callback doesn't arrive (e.g., window
Mitchell Cohen . unresolved

This fallback mechanism doesn't feel great to me and it's the part I struggled with the most in this PoC.

  • If it runs on every presentation feedback interval, or close to it, we basically end up reinventing a delay-based pacer, and Wayland frame callbacks are useless. - - But if it's on a longer delay, Chrome freezes while waiting for frame callbacks that never come (common when switching tabs).

So the current approach of frequently needing to schedule frames in OnBeginFrameAck conflicts with the idea of frames being event-driven. There's probably a more sophisticated way to deal with missing frame callbacks and/or to make sure fewer are dropped.

File ui/views/widget/desktop_aura/desktop_window_tree_host_linux.h
Line 129, Patchset 1 (Latest): std::unique_ptr<ui::BeginFrameSourceWayland> begin_frame_source_;
Mitchell Cohen . unresolved

The tree host seems like a strange place to own this driver, and other platforms don't use it this way, but this placement had several advantages: the tree host can pre-configure the compositor to use the external frame source with existing params (that for some reason aren't used by other impls), and it has the earliest access to the compositor, PlatformWindow and Wayland extension.

File ui/views/widget/desktop_aura/desktop_window_tree_host_linux.cc
Line 362, Patchset 1 (Latest): ui::GetWaylandToplevelExtension(*platform_window()) != nullptr;
Mitchell Cohen . unresolved

When I tried to enable the driver for all windows (not just toplevels) I ran into failed DCHECKs in the Viz process. That surprised me because each surface has its own compositor and paces its own frames. I was able to get it to work by removing the check and clearing the frame sink in Viz, but that change seemed too drastic and could not be contained to the PoC.

Open in Gerrit

Related details

Attention set is empty
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: I5bc7a8c1e791e607ce854af59a1bca6286dbc418
Gerrit-Change-Number: 7507210
Gerrit-PatchSet: 1
Gerrit-Owner: Mitchell Cohen <mitc...@agilebits.com>
Gerrit-Reviewer: Kramer Ge <fang...@chromium.org>
Gerrit-CC: Ian Vollick <vol...@chromium.org>
Gerrit-CC: Jonathan Ross <jon...@chromium.org>
Gerrit-Comment-Date: Wed, 21 Jan 2026 21:56:35 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
satisfied_requirement
unsatisfied_requirement
open
diffy
Reply all
Reply to author
Forward
0 new messages