Repository navigation
Conversation
|
Maintenance review: this stays experimental and outside 3.6.1. Before integration it needs a current-base rebase and measured checks for color management, native cursor behavior, fullscreen/wake, fallback and sustained frame pacing on Intel and Apple Silicon. The open color issues are not being marked fixed by this draft. |
|
Thanks for this, @Betafer. I ported it onto Branch:
Tests: all 7 receiver suites pass, including your renderer-policy (22) and Metal shader tests. The Metal source compiles with Hardware: MacBook Air M5 → iMac18,3 (Radeon Pro, Ventura 13.7.8), Thunderbolt Bridge. x86_64 receiver cross-built against the official 3.6.0 bundle's dylibs. Adaptive mode on real use: 5K 48, OpenGL vs native Metal, same receiver binary:
5K 60, Metal: a median of 58 fps (range 49–61) shown on the iMac, against 45–50 with OpenGL, with receiver CPU at 15.5%. On this hardware the OpenGL upload was what held 5K 60 back. The user also reports the block artifacts are gone at 5K 60. Latency (Air paint → iMac present, measured with a timestamp barcode decoded in the receiver, clock offset tracked every 2 s over the Thunderbolt link): OpenGL 67.6 / 67.4 ms vs Metal 72.7 / 66.8 and 63.6 / 62.9 ms median, in interleaved sessions. That's no significant difference. On a discrete Radeon the CPU→GPU copy is cheap, so the win here is efficiency and 5K 60 frame rate, not latency. The rest of the latency is capture cadence plus 5K HEVC encode and decode. Port, measurements and write-up done with Claude Opus 5.5 (Anthropic), credited in the commit trailers. |
…mental) [skip ci] Inspired by upstream PR swellweb#174, built into our own Metal renderer and the virtual display instead of a second renderer. Sender: - New per-session setting "Colour space (experimental)": Automatic, sRGB, Display P3. Automatic picks Display P3 when the Receiver reports a P3 panel, otherwise sRGB. - The chosen colour space sets the virtual display's primaries, the ScreenCaptureKit / CGDisplayStream colour space (BT.709 matrix), the encoder's colour tags, and is announced in the session ack ("colorSpace": "srgb" / "displayP3") before the first frame. - Receivers without colour management (older versions, SDL renderers) get the previous behaviour: wide-gamut virtual display, unlabelled video. Receiver: - Display profile reports supportsColorSpaceTags (TargetBridge Metal renderer) and panelColorSpace (NSScreen P3 gamut). - Tags its Metal layer from the ack; untagged when nothing is announced. - Expert setting "Zero-copy H.264/HEVC frames": decoded IOSurface frames become Metal textures via CVMetalTextureCache, kept for 4 frames; other frames are copied as before. - Stats overlay shows zero-copy/copy and the colour space. Tests: color_space.h (Receiver), TBVideoColorSpaceTests (Sender). Docs: changelog, Performance. Translations in all five languages. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_015AiywzXyRsfrH6x9nyNXRQ
Summary
Add an optional native CAMetalLayer renderer for VideoToolbox NV12 frames, while retaining the existing SDL/OpenGL renderer as the default and immediate fallback.
The native path wraps the decoder CVPixelBuffer planes through CVMetalTextureCache, avoiding the full-frame CPU upload performed by SDL_UpdateNVTexture. It also renders the remote cursor in the same Metal pass, preserves the display's Display P3 color space and accounts for Retina backing scale.
Safety
Structure
Verification
This is intentionally a Draft PR because the production change is larger than the maintenance fixes and benefits from maintainer review before enabling it outside an opt-in setting.