fix(cua-driver/linux): stop idle X11 overlay frame ticks - #2258
Closed
KeroZelvin wants to merge 6 commits into
Closed
fix(cua-driver/linux): stop idle X11 overlay frame ticks#2258KeroZelvin wants to merge 6 commits into
KeroZelvin wants to merge 6 commits into
Conversation
KeroZelvin
force-pushed
the
fix/linux-x11-idle-overlay
branch
from
July 17, 2026 23:08
55b7bee to
b82e215
Compare
KeroZelvin
marked this pull request as ready for review
July 17, 2026 23:17
KeroZelvin
requested review from
ddupont808,
f-trycua and
r33drichards
as code owners
July 17, 2026 23:17
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: b82e215408
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
Collaborator
|
closing as superseded by #2331 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Fixes #2204.
Context
The X11 overlay loop currently allocates and paints a full-screen
tiny_skia::Pixmap, converts RGBA to BGRA, updates the X Shape region, and callsXPutImageevery 16 ms even when the default cursor is still at its off-screen sentinel or all cursors have settled. It also keeps painting unchanged pixels throughout the default 20-second opaque idle-hide delay after an action.That is the Linux equivalent of the idle render-loop problem addressed for macOS in #1865 and Windows in #1933. It leaves
cua-overlay-x11consuming a substantial fraction of one core while an MCP session is idle.Implementation
needs_frame_tickstate detection for active animation, spring settle, click pulse, and the actual 180 ms idle fade.dt = 0, including commands drained immediately after a maintenance timeout.Instantdeadlines for z-order maintenance and idle fade. The remaining timeout is calculated immediately before blocking, so synchronous X11 maintenance cannot extend the deadline.SK::INPUTandSK::BOUNDINGto empty before mapping the initial overlay window, preventing an opaque black full-screen window on bare/non-composited X servers.Regression coverage
Added focused Linux tests for:
MoveToandClickPulseatdt = 0SetEnabled(false)final-clear rendering followed by frame- and z-order-scheduler parkingValidation boundary
The exact patched build passed the scheduler suite and isolated Xvfb startup, idle, action, and settle checks. A later live 1920×2160 X11 Hermes session became unusable after an unreturned high-level Chrome hotkey request and required an orderly reboot. No kernel lockup, OOM, GPU fault, or coredump evidence survived, and the hotkey is not itself an overlay animation command, so I cannot attribute that incident to this patch. I am recording it as a validation boundary rather than a regression claim: this PR proves quiescent overlay parking, not full live desktop/input-stack safety.
--no-overlayremains the safest operational fallback pending broader watchdog-backed live validation.Follow-ups / out of scope
shape_rectangles,put_image,free_gc, andflushfailures. Rate-limited diagnostics, sampled asynchronous error checks, and a safe clear/unmap/park policy after repeated failures belong in a focused follow-up.Validation
The exact PR diff was replayed, independently reviewed, and full-workspace tested on current
upstream/mainat763a6ea21b86ad5f8a70ab2581edee1dd7370efa. The published head is12fc510c7and remains mergeable. Current upstream main has since advanced to95c68886; a fresh merge-tree check is clean, and upstream has not changedplatform-linux/src/overlay.rssince this PR's base. Issue #2204 remains open, current main still contains the unconditional 16 ms X11 paint loop, and open-PR searches found no competing Linux idle-overlay repair. The latest upstream commit only changes browser telemetry files; it does not touch the Linux overlay.cargo test --workspaceon the patch replayed onto current main — passedcargo test --workspace --no-runon the patch replayed onto current main — passedcargo test --workspace -- --test-threads=1on the exact published branch — passedcargo test -p platform-linux --lib— 113 passedcargo test -p platform-linux overlay --lib— 19 scheduler/overlay tests passedcargo check -p platform-linux --target x86_64-pc-windows-gnu— passed; the previous head failed with unresolvedDurationreferencescargo test -p cursor-overlay— 12 passed; doc tests passedcargo build -p cua-driver— passedrustfmt --edition 2021 crates/platform-linux/src/overlay.rs --check— passedgit diff --check— passedThe repository-wide
cargo fmt --all --checkand strict Clippy gates are not green on current upstream main because of pre-existing formatting and lint debt outside this diff. The changed Linux overlay file passes its focused formatter check, and strict Clippy reported no diagnostic in the newly added scheduler/deadline code.Isolated Xvfb verification used bare 1920×2160 debug builds and sampled the
cua-overlay-x11thread from/proc/<pid>/task:upstream/main(b088628a; overlay identical at current763a6ea2), initial MCP idleBefore the first command,
xwininfo -shapereportedWindow shape extents: 0x0+0+0, proving the mapped startup overlay has an empty bounding region. The MCP initialize andmove_cursorcalls succeeded, the patched driver remained alive, and all Xvfb/driver processes were cleaned up afterward.