feat(egfx): add ClearCodec client-side decode dispatch#1175
feat(egfx): add ClearCodec client-side decode dispatch#1175Greg Lamberson (glamberson) wants to merge 1 commit into
Conversation
There was a problem hiding this comment.
Pull request overview
This PR introduces ClearCodec support across the stack (PDU parsing, graphics encode/decode, and EGFX client/server integration) and adds a comprehensive test suite to validate correctness and resilience.
Changes:
- Added ClearCodec PDU parsing modules (residual, bands, subcodec, RLEX) under
ironrdp-pdu. - Implemented
ClearCodecDecoder/ClearCodecEncoder(with glyph/V-bar caching) underironrdp-graphics. - Integrated ClearCodec handling into EGFX client decode path and EGFX server frame queuing; added new tests in testsuite-core.
Reviewed changes
Copilot reviewed 15 out of 15 changed files in this pull request and generated 9 comments.
Show a summary per file
| File | Description |
|---|---|
| crates/ironrdp-testsuite-core/tests/graphics/mod.rs | Registers the new ClearCodec graphics test module. |
| crates/ironrdp-testsuite-core/tests/graphics/clearcodec.rs | Adds extensive round-trip and adversarial ClearCodec tests. |
| crates/ironrdp-testsuite-core/tests/egfx/client.rs | Adds EGFX pipeline tests for ClearCodec processing/reset behavior. |
| crates/ironrdp-pdu/src/codecs/mod.rs | Exposes the new ClearCodec codec module in the PDU crate. |
| crates/ironrdp-pdu/src/codecs/clearcodec/mod.rs | Implements ClearCodec bitmap stream + composite payload decoding. |
| crates/ironrdp-pdu/src/codecs/clearcodec/residual.rs | Implements residual layer (BGR RLE) encode/decode helpers. |
| crates/ironrdp-pdu/src/codecs/clearcodec/bands.rs | Implements bands layer decoding (V-bar structures). |
| crates/ironrdp-pdu/src/codecs/clearcodec/subcodec.rs | Implements subcodec layer decoding for regions. |
| crates/ironrdp-pdu/src/codecs/clearcodec/rlex.rs | Implements RLEX subcodec decoding. |
| crates/ironrdp-graphics/src/lib.rs | Exposes ironrdp_graphics::clearcodec. |
| crates/ironrdp-graphics/src/clearcodec/mod.rs | Adds ClearCodec encoder/decoder and decode compositing pipeline. |
| crates/ironrdp-graphics/src/clearcodec/glyph_cache.rs | Implements glyph cache storage for ClearCodec. |
| crates/ironrdp-graphics/src/clearcodec/vbar_cache.rs | Implements V-bar cache storage and reconstruction for bands. |
| crates/ironrdp-egfx/src/server.rs | Adds a send_clearcodec_frame helper to enqueue ClearCodec frames. |
| crates/ironrdp-egfx/src/client.rs | Adds ClearCodec decode path and BGRA→RGBA conversion for bitmap updates. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
You can also share your feedback on Copilot code review. Take the survey.
31e29a7 to
b164178
Compare
b164178 to
50dafcc
Compare
There was a problem hiding this comment.
Pull request overview
Adds client-side ClearCodec decode support to EGFX by wiring a persistent ClearCodec decoder into WireToSurface1 codec dispatch and normalizing output pixels to the existing RGBA BitmapUpdate format.
Changes:
- Add ClearCodec decode path in
GraphicsPipelineClient(including BGRA→RGBA conversion and reset behavior onResetGraphics). - Introduce/extend ClearCodec wire-format parsing in
ironrdp-pduand codec implementation (decoder/encoder + caches) inironrdp-graphics. - Add integration/unit tests covering decode dispatch, pixel format conversion, cache/reset behavior, and adversarial inputs.
Reviewed changes
Copilot reviewed 15 out of 15 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
| crates/ironrdp-egfx/src/client.rs | Adds ClearCodec decoder to client dispatch, resets state on ResetGraphics, and converts BGRA output to RGBA BitmapUpdate. |
| crates/ironrdp-egfx/src/server.rs | Adds send_clearcodec_frame() helper for emitting ClearCodec WireToSurface1 frames. |
| crates/ironrdp-graphics/src/lib.rs | Exposes the new clearcodec module. |
| crates/ironrdp-graphics/src/clearcodec/mod.rs | Implements ClearCodec decoder/encoder and composite layer application (residual/bands/subcodecs). |
| crates/ironrdp-graphics/src/clearcodec/glyph_cache.rs | Introduces glyph cache storage for ClearCodec glyph hits. |
| crates/ironrdp-graphics/src/clearcodec/vbar_cache.rs | Adds V-bar and short V-bar ring-buffer cache implementation used by bands layer. |
| crates/ironrdp-pdu/src/codecs/mod.rs | Exports the ClearCodec wire-format module. |
| crates/ironrdp-pdu/src/codecs/clearcodec/mod.rs | Defines ClearCodec stream/container structures, flags, and composite payload parsing. |
| crates/ironrdp-pdu/src/codecs/clearcodec/residual.rs | Adds residual layer (BGR RLE) decode/encode helpers. |
| crates/ironrdp-pdu/src/codecs/clearcodec/bands.rs | Adds bands layer parsing (V-bar references and inline short V-bar misses). |
| crates/ironrdp-pdu/src/codecs/clearcodec/subcodec.rs | Adds subcodec layer region parsing (raw/NSCodec/RLEX). |
| crates/ironrdp-pdu/src/codecs/clearcodec/rlex.rs | Adds RLEX subcodec decoding (palette + packed run/suite segments). |
| crates/ironrdp-testsuite-core/tests/graphics/mod.rs | Registers the new ClearCodec graphics tests module. |
| crates/ironrdp-testsuite-core/tests/graphics/clearcodec.rs | Adds ClearCodec codec-level integration tests (round-trip, adversarial inputs, cache/session behavior). |
| crates/ironrdp-testsuite-core/tests/egfx/client.rs | Adds EGFX client integration tests for ClearCodec dispatch, RGBA output verification, and reset/re-decode cycle. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
a1c0315 to
9611e12
Compare
|
Reviewed against Haven's downstream EGFX decoder (we ship a hand-rolled equivalent) — overall structure looks great, and the loop-decode + per- One concern in the dimension extraction:
Suggestion: either compute Also: minor — Tested the decoder against a captured Windows Server 2025 EGFX session — once the |
9611e12 to
374d454
Compare
|
Confirmed and fixed. The audit found exactly the off-by-one you described, plus the test fixtures encoded the same inclusive interpretation, which is why CI was green on the broken behavior. The wire-format-is-exclusive comment now lives at the first call site (decode_avc420) and is referenced from decode_clearcodec and handle_uncompressed. Changes in this push:
All three xtask gates (fmt, lints, tests) pass on the squashed commit. Separate from this PR: I'll open a follow-up changing Thanks again for the careful review against Server 2025 captures, this would have shipped wrong without it. |
374d454 to
2f8081d
Compare
9715284 to
0eba461
Compare
|
Force-pushed
Author identity amended to |
c3a3240 to
ced71f2
Compare
Wire ClearCodec decoder into the EGFX client WireToSurface1 codec dispatch. Persistent decoder with V-bar and glyph caches is stored on GraphicsPipelineClient and reset on ResetGraphics. BGRA output is converted to RGBA for the uniform BitmapUpdate format. Includes RLEX stop_index bounds validation against palette count and client-side decode tests in ironrdp-testsuite-core.
ced71f2 to
dc5bea5
Compare
Follow-up to #1174. Supersedes #1195 (the standalone server-helper PR; its 46-line
send_clearcodec_frame()is included here).Wires ClearCodec into the EGFX client's WireToSurface1 codec dispatch,
matching the existing AVC420 and Uncompressed decode patterns.
Changes:
pure Rust, no external codec dependency). Constructed eagerly in
GraphicsPipelineClient::new(), so V-bar (32K full + 16K short
entries) and glyph (4000 entries) ring buffers are allocated up
front regardless of whether ClearCodec frames are subsequently
received.
output to RGBA for the uniform BitmapUpdate pixel format
symmetric server-side use (mirrors send_avc420_frame /
send_avc444_frame pattern, including QoE backpressure recording)
reset/re-decode cycle)
Unlike H.264 which requires an external decoder via the H264Decoder
trait, ClearCodec is pure Rust (ironrdp-graphics).