perf: damage-driven idle suppression + sync send buffer reuse - #24
Merged
Merged
Conversation
The producer ran the full capture→convert→encode path every cadence tick even when nothing on screen changed. The X11 capturer now subscribes a DAMAGE object on the root window at NON_EMPTY report level and the producer idles between 25 ms damage polls while the screen is clean. - Capturer::changed() defaults to true, so backends without damage tracking behave exactly as before. - NON_EMPTY only fires on the empty→non-empty transition; a dirty read issues DamageSubtract back to empty to re-arm notification. - The wait is bounded at 1 s: the stream still gets a periodic refresh frame and the producer returns to the caller's is_closed check. - A pending keyframe request (controls.idr) wakes the wait early — a viewer joining or recovering from loss never waits out the cap. - Skipped slots reset the cadence instead of counting as deadline misses, so the bitrate controller doesn't see phantom overload. - Damage object is destroyed on drop; absent extension falls back to always-dirty. Live-verified on Xorg :10 and Xvfb: dirty → clean → clear_area repaint → dirty. Generated with [Devin](https://devin.ai) Co-Authored-By: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com>
Every chunk alloc'd a fresh vec![0; len] — on a large manifest that's an alloc/free per 256 KiB chunk, four streams wide. Each stream now owns a single buffer sized to MAX_CHUNK and resizes per chunk. Generated with [Devin](https://devin.ai) Co-Authored-By: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com>
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
NON_EMPTY, re-armed viaDamageSubtract); while the screen is still, capture→convert→encode is skipped entirely (25 ms damage poll, bounded 1 s so a refresh frame still lands once a second and teardown stays prompt). A pendingcontrols.idrkeyframe request wakes the wait early.Capturer::changed()defaults totrueso backends without damage tracking are unchanged.vec![0; len]allocation per chunk.:10) and Xvfb: damage object present, dirty → clean →clear_arearepaint → dirty.Test plan
cargo fmt --all -- --checkcargo build -p rds-desktop -p rds-sync --all-featurescargo clippy -p rds-desktop --all-targets --all-features -- -D warningscargo test --workspace --all-features— 35 targets, 0 failurescargo-machetecleanGenerated with Devin