feat(egfx): composite client surface commands into pixel buffers - #1460
Merged
Benoît Cortier (CBenoit) merged 1 commit intoJul 31, 2026
Merged
Conversation
This was referenced Jul 20, 2026
There was a problem hiding this comment.
Pull request overview
Adds persistent EGFX surface composition and frame-scoped output updates.
Changes:
- Composites bitmap, fill, copy, cache, and mapping commands.
- Exposes completed regions through
drain_output(). - Adds compositor unit tests.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 5 comments.
| File | Description |
|---|---|
crates/ironrdp-egfx/src/lib.rs |
Exposes the compositor module. |
crates/ironrdp-egfx/src/compositor.rs |
Implements surface composition, caching, output updates, and tests. |
crates/ironrdp-egfx/src/client.rs |
Integrates composition into EGFX PDU processing. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
The client GraphicsPipelineClient decoded WireToSurface1 bitmaps and forwarded every other surface command (SolidFill, SurfaceToSurface, the bitmap cache, MapSurfaceToOutput) to no-op handler callbacks, so it never maintained the pixel state those commands operate on. Against any server that uses them (GNOME Remote Desktop, Windows) the rendered result was wrong. Add a surface compositor that keeps persistent RGBA8888 surfaces and a bitmap cache, applies each command into them, maps surfaces onto the graphics output, and accumulates the changed output regions per frame. The regions are exposed through GraphicsPipelineClient::drain_output(), committed on EndFrame so a partial frame is never observed. Reads and writes are clipped to their buffers, so a malformed server rectangle shrinks the update to empty rather than reading or writing out of range. Clipping bounds a single access, not the total. Surfaces and cache slots are both keyed by u16, so the compositor also caps the pixel bytes it holds at once and refuses allocations that would exceed it. Output deltas record regions during a frame and copy pixels once at EndFrame, which keeps a PDU carrying 65,535 rectangles to one copy per distinct region, and those copies are charged against the same cap. A ResetGraphics drops pending deltas along with the surfaces that produced them, since their regions describe the previous output. The existing handler callbacks are kept as secondary notifications, so current consumers are unaffected.
Greg Lamberson (glamberson)
force-pushed
the
feat/egfx-client-compositor
branch
from
July 31, 2026 14:49
1c7dee1 to
2f603d4
Compare
|
|
||
| #[cfg(test)] | ||
| mod tests { | ||
| use super::*; |
There was a problem hiding this comment.
issue (non-blocking): My usual nitpick about tests living outside of the testsuite crates; but I don’t want to block this PR on that now. Just informational.
Benoît Cortier (CBenoit)
merged commit Jul 31, 2026
9cd3695
into
Devolutions:master
24 of 25 checks passed
This was referenced Jul 31, 2026
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
GraphicsPipelineClientdecodedWireToSurface1bitmaps but forwardedSolidFill,SurfaceToSurface, the bitmap cache, andMapSurfaceToOutputto no-op handler callbacks, so it never held the pixel state those commands operate on. Any server that uses them (grd, Windows) renders wrong.ironrdp-egfx: persistent RGBA8888 per-surface buffers plus a bitmap cache, applies every surface command, maps surfaces to the output, and accumulates the changed output regions.EndFrameand drained via a newGraphicsPipelineClient::drain_output() -> Vec<OutputUpdate>.GraphicsPipelineHandlercallbacks are retained as notifications, so current consumers are unaffected.Resource bounds
Clipping bounds a single access, not the total, and surfaces, cache slots and per-PDU rectangle counts are all keyed or counted by
u16. Three amplification paths followed from that, all now closed:EndFrame. ASolidFillnaming 65,535 rectangles previously retained a full pixel copy for each; it now costs one copy per distinct region, and repeated paints of one region collapse before reaching the copy. Those copies are charged against the same cap.CacheToSurfaceno longer clones the cached tile to satisfy borrowing, removing a full-tile copy and an uncharged peak from every invocation.ResetGraphicsnow discards committed-but-undrained deltas along with the surfaces that produced them. A payload can carryEndFrameandResetGraphicstogether, and those deltas were clipped against the previous output, so painting them into the new one repaints stale pixels and, after a shrink, addresses a region the new output no longer contains.Reading pixels at commit also means a delta carries the frame's final state, so a region painted twice within a frame yields one update rather than two the consumer would paint over each other.
Validation
cargo xtask check fmt/lints/tests/typos/locksall pass.Notes
OutputUpdateis#[non_exhaustive], matchingBitmapUpdateandSurface; coordinates useExclusiveRectangle.