`DisplayContext` now has `pointer_cache_size` and `color_pointer_cache_size`, the sizes the client sent in its Pointer Capability Set (MS-RDPBCGR 2.2.7.1.5), so the display can pick a valid `cache_index`. They are updated at each activation. The encoder drops, with a warning, a pointer update whose `cache_index` is not less than the matching size: | Update | Limit | |---|---| | `RGBAPointer`, `LargePointer` | `pointerCacheSize` | | `ColorPointer` | `colorPointerCacheSize` | | `CachedPointer` | the larger of the two, as the entry was filled by a Color or a New Pointer Update | Test: `pointer_cache_index` (testsuite-core) checks each limit with mstsc's sizes (21 and 20) and fails without the guard. The e2e `each_connection_gets_its_own_display_context` checks that `DisplayContext` has the sizes the IronRDP client sends. Also checked with the `server` example changed as in #2290: | Client | `cache_index` | before | after | |---|---|---|---| | mstsc 10.0.19041.4717 | 20 | session continues | session continues | | mstsc | 21, 100 | protocol error, disconnected | update dropped, session continues | | FreeRDP 3.32.1 | 129 | disconnected | update dropped, session continues | mstsc accepts a `ColorPointer` at index 20 although it sends `colorPointerCacheSize` 20; the encoder drops it, as the spec gives 20 entries. Fixes #2290
IronRDP benchmarks
RemoteFX decode
Benchmarks for the RemoteFX (RFX) decode path, on native targets and on WASM.
Running
Native, via the standard Criterion harness:
cargo xtask bench rfx-decode
Criterion accepts a regex to select a subset, so you can iterate on one stage without re-running the full suite:
cargo xtask bench rfx-decode --filter 'stage/rlgr'
Validating a change
Use Criterion baselines to compare two runs.
Save a baseline on the unmodified code, make the change, then re-run against the baseline.
This example names the baseline before.
# On the unmodified code.
cargo xtask bench rfx-decode --save-baseline before
# ... make the change ...
cargo xtask bench rfx-decode --baseline before
WASM
Requires Node.js:
cargo xtask wasm install
cargo xtask bench rfx-decode-wasm
wasm install adds the wasm32-unknown-unknown target.
The bench task installs the locked Node dependencies, builds benches/rfx-decode-wasm in release mode, and runs run.mjs on the result.
Add --simd to build with +simd128.
run.mjs reports whether the module was built with SIMD and how many SIMD instructions it contains.
It then times full-frame decoding and each decode stage.
Run it before and after a change to see the effect.
The runner uses raw WebAssembly exports rather than wasm-bindgen glue.
Stage inputs are restored in batches before timing; no estimated copy cost is subtracted.
Batching amortizes JS call and timer overhead.
Stage times cover one component, except YCbCr conversion, which covers all three components of a tile.
Fixtures
Fixtures are generated at runtime.
A synthetic screen is rendered, encoded with rfx_encode_component, and decoded as a video-mode stream with headers sent once.
The round-trip test (cargo test -p rfx-decode-fixtures) guards them.
Synthetic workloads:
| pattern | content | why |
|---|---|---|
gradient |
smooth 2D ramp | low-frequency color variation |
desktop |
solid background, windows, borders, taskbar | idle or lightly used session |
text |
dense small glyphs on white | terminal, editor, spreadsheet |
photo |
smooth blobs plus fine detail | wallpaper, image viewer |
noise |
pseudorandom | entropy-decoder stress workload |
Everything is deterministic (a fixed xorshift, integer-only rendering), so fixtures are identical across runs, machines and targets.