Skip to content

Add independent uncompressed RGB10 streaming - #229

Open
yibiao-h wants to merge 4 commits into
swellweb:mainfrom
yibiao-h:codex/rgb10-raw-streaming
Open

yibiao-h wants to merge 4 commits into
swellweb:mainfrom
yibiao-h:codex/rgb10-raw-streaming

Conversation

@yibiao-h

@yibiao-h yibiao-h commented Oct 29, 2026 •

Copy link
Copy Markdown

Adds RGB 10-bit uncompressed as an explicit Video Compression choice, independently of Resolution and frame rate. A 4.5K session sends captured 4480×2520 packed RGB10 without a video encoder or chroma subsampling. Unsupported receivers reject an explicit RAW request before capture.

Updated to 99dca8d by merging main 7008853 without rewriting the branch. Conflicts are resolved while retaining main's HEVC capability/fallback checks, first-frame status fix, latest-frame presentation, receive-buffer negotiation, and UI/localization maintenance.

Scope

  • Capture kCVPixelFormatType_ARGB2101010LEPacked (l10r) with Display P3 metadata. Keep the existing raw-frame packet type, validate packed layout, and use at most three owned Metal staging buffers with a pixel-preserving CPU fallback. Release buffers only after the final network data reference is released; preserve receiver upload-slot ownership across failed presentations.
  • Receive directly into parser-owned storage, with bounded socket draining and resumable buffered packets. Preserve the 8/6/4 MiB receive-buffer negotiation and deferred presentation of the newest decoded frame from main.
  • Separate resolution/frame rate from compression; migrate legacy combined profiles without overriding explicit codec choices. Preserve choices through discovery refresh, restart and copying sessions. Keep existing encoded/NV12 compatibility and CLI aliases.
  • Show requested/actual stream dimensions instead of the receiver's fixed idle 2560×1440 label, preserve metadata across language changes, and reset it on disconnect. Package the receiver icon at all declared Retina sizes.
  • Correct local send-slot completion accounting and cable-test accounting. Local network completion is not receiver presentation. As Betafer's controlled test demonstrates, removing stale local accounting need not improve throughput when another limit governs admission; this PR makes no unconditional FPS claim.

DPCM relationship

The Metal presentation foundation was adapted from #201. This PR targets main and contains no DPCM codec, compute decoder or DPCM menu option. The author's follow-up aalpgiray/targetBridge#2 has now merged and #201 targets main; #228 remains a closed duplicate. Shared capture/display/session changes allow independent testing, and will need reconciliation if both proposals merge.

Validation at 99dca8d

  • 253 Sender XCTest cases passed, using distinct test/host bundle identifiers and a readback check of the real app's preferences. Capability probes also passed, including 16 explicit RAW selections that must not fall back to an encoded codec. Queue/completion, startup, identity, health and cable-test guards passed.
  • Sender and Receiver arm64 + x86_64 Release builds passed. Universal test packages, build stamp 20261121180151 / version 3.6.1-rc.2, passed strict signatures, extracted-file comparison, dependency/resource checks and all ten receiver icon sizes. These are ad-hoc local test packages, not notarized releases.
  • Receiver portable tests passed, including 3,358 parser checks; resumable parser/drain and newest-frame lifetime checks passed under ASan/UBSan. Synthetic Metal tests passed in both cursor-plane modes, including exact 1024-level RGB10 ramps, single-pixel checkers/isolated points and failure-injected upload ownership. HEVC NV12/BGRA 1/2/3-frame startup and deferred-surface lifetime checks passed. All five localizations and their negative regression fixtures passed.
  • Two-Mac RAW acceptance: Thunderbolt Bridge, sender Mac18,5, receiver M1 iMac (iMac21,1), both macOS 27.2.1 (26B131). Two connections each ran a 60-second moving checkerboard/gradient/fine-line workload. Both retained actual 4480×2520 RAW and 2240×1260 logical / 2× HiDPI after reconnect. Receiver FPS logs averaged 56.76 / 58.77, both ranging 52–60, after excluding the first five and last two one-second buckets. No in-stream RAW/decode errors were observed. Original apps and preferences were restored and read back afterward.

The hardware runs are short functional/FPS observations, not an A/B performance result or constant-60 guarantee. Intel runtime, extended soak, input/audio acceptance and physical panel/color-depth certification remain outside this validation. 4480×2520 at 60 FPS needs approximately 21.68 Gbit/s of application video payload. GitHub has not reported remote workflow runs/status checks for this revision at the time of this update; the evidence above is local validation.

Biao and others added 2 commits October 29, 2026 22:20
Add negotiated RAW_FRAME format 2 with l10r capture, a bounded owned Metal
packet pool and CPU fallback. Keep every packed RGB sample bit and retain
legacy NV12, H.264 and HEVC compatibility. Expose RGB10 independently from
resolution presets, with explicit rejection when the receiver lacks support.

Preserve shared HiDPI, codec startup, capture lifetime, send-budget, cable-test,
parser, network-address snapshot and diagnostic fixes. Add synthetic byte,
ownership, malformed-input and render-target regressions, including upload
allocation/presentation failures that must not advance into occupied slots.

This standalone branch contains no DPCM codec, compute decoder, capability,
packet route or menu. The shared Metal presentation and health foundation is
derived from Aykut Alpgiray Ates's original TargetBridge PR swellweb#201; attribution
is retained in source and docs/Raw-RGB10.md.

Validated: 220 Sender unit tests; Sender and Receiver arm64/x86_64 builds;
Receiver C/Python and Sender Ruby guards; localization parity; synthetic
Metal RGB10/cursor/lifecycle tests with both cursor-plane modes. Render-target
fidelity does not establish compositor, panel or sustained remote performance.

Co-authored-by: Aykut Alpgiray Ates <[email protected]>
@Betafer

Betafer commented Nov 5, 2026

Copy link
Copy Markdown
Contributor

I tested the local send-slot accounting change in isolation and wanted to share a follow-up. In a deterministic fixture, when the video queue was held busy and three sends completed, the previous accounting still showed three pending slots. With immediate accounting at network completion, the counter dropped to zero on both the encoded and NV12 paths.

I also compared the two accounting modes in the same local Sender binary on a 5120×2880 HEVC stream over Thunderbolt Bridge, with the remote decode-feedback limit fixed at two. I used the same looping motion clip and two 60-second measured runs per mode. Sent FPS was 43.25 with deferred accounting and 43.12 with immediate accounting. Mean capture-callback-to-decode-ACK time was 54.08 ms and 54.40 ms respectively, with p95 at 62.9 ms in both modes.

The local slot budget never blocked admission during the live runs, while the remote credit limit did. That explains why the isolated correction fixed stale accounting in the fixture without a measurable throughput gain in this workload.

@yibiao-h yibiao-h changed the title Add uncompressed RGB10 streaming and reduce receive overhead Add independent uncompressed RGB10 streaming Nov 21, 2026
@yibiao-h
yibiao-h marked this pull request as ready for review November 21, 2026 10:24
@yibiao-h

Copy link
Copy Markdown
Author

@Betafer Thanks for isolating the accounting modes and reporting both the deterministic and live results. Your distinction is the right one: immediate completion fixes stale local slot accounting, but when local slots never block admission and remote credits do, it should not be presented as a throughput improvement. I have made that limitation explicit in the PR description and RAW documentation.

The branch is now updated to 99dca8d, merging main 7008853 and resolving the conflicts while preserving immediate local completion accounting and main's HEVC/receiver maintenance fixes. The local guards, 253 Sender tests, both architecture builds, parser/lifetime sanitizers and synthetic RAW/HEVC checks pass.

Two new 60-second 4.5K RAW runs on an M1 iMac receiver also retained 4480×2520 / 2× HiDPI through reconnect, with receiver-log means of 56.76 and 58.77 FPS. Those are functional checks, not an accounting-mode A/B comparison, and do not establish a performance gain over your HEVC workload.

This branch does not currently implement the per-frame remote decode-ACK/credit extension used in your comparison. Could you share the Sender revision and that extension's revision or patch so the limiting stage can be reproduced precisely? The local accounting correction stands independently of that follow-up.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants