Skip to content

Phase 4: shared-texture ring transport#8

Merged
NorthernLights merged 1 commit into
mainfrom
feat/phase4-ring-transport
Jul 19, 2026
Merged

Phase 4: shared-texture ring transport#8
NorthernLights merged 1 commit into
mainfrom
feat/phase4-ring-transport

Conversation

@NorthernLights

Copy link
Copy Markdown
Member

Summary

  • Frame worker GPU-copies each acquired frame into named NT-handle keyed-mutex shared textures and publishes through the shared ring section (DESIGN.md §3.1); core::ring::RingPolicy makes every slot decision (drop-oldest, writer never blocks).
  • shell/ring.rs: ring section with volatile/atomic header+slot writers (SYSTEM+Admins SDDL), generation-stamped texture names via proto::names, raw-HRESULT AcquireSync so WAIT_TIMEOUT stays visible.
  • Ring state lives in MonitorRt — sequences and generation survive swap-chain reassignment; section created at plug, DEAD at unplug; lazy texture (re)creation with generation bump on mode-size change; ≤250 ms heartbeat.
  • Recovery per §3.3: on real acquire/publish failure the worker marks REBUILDING, retires textures, and exits — the OS's unassign→assign cycle drives recovery (never retry SetDevice on a dead swapchain).
  • core/ring.rs: writer_abort (revert without publishing, no sequence consumed) + test.
  • vgd-probe: live ring watch during the hold (gen/state/seq/published/dropped/heartbeat + milestone verdict); --ephemeral flag for a fresh Windows display identity.

Bring-up lessons (documented in CLAUDE.md)

  • IddCx returns COM E_PENDING (0x8000000A) for "no frame yet" — not STATUS_PENDING; misreading it stalls the compositor until WUDFHost is killed.
  • Target-mode RequiredBandwidth must be 0 alongside MaxDisplayPipelineRate=0, else no mode can ever activate (Extend reverts, Scale/Resolution grayed).
  • Windows persists per-identity "Disconnect this display" topology — hence --ephemeral for testing.

Milestone verification

ring milestone: sequences advanced by 2108 during the hold ✔ — 30 s at 4K120, generation stable, heartbeat continuous, no compositor stalls. Drops ≈ published − slots as specified (no reader until phase 5). 89/89 workspace tests green; clippy silent.

🤖 Generated with Claude Code

…desktop animates

The frame worker now GPU-copies each acquired frame into named
keyed-mutex shared textures and publishes through the shared ring
section (DESIGN.md §3.1); core::ring::RingPolicy makes every slot
decision. Milestone verified: 2,108 frames published over a 30 s hold at
4K120 with no compositor stalls; with no reader attached, drop-oldest
accounts published−slots as dropped, as specified.

- shell/ring.rs: Global\ ring section (RingHeader/SlotMetadata volatile+
  atomic writers, SYSTEM+Admins SDDL), named NT-handle keyed-mutex
  shared textures via proto::names, raw-HRESULT AcquireSync wrapper so
  WAIT_TIMEOUT stays visible (bounded-wait contract).
- swapchain.rs: FrameRing lives in MonitorRt (sequences/generation
  survive reassignment); lazy texture creation from frame desc with
  generation bump on size change; 250 ms heartbeat; E_PENDING
  (0x8000000A) recognized as "no frame yet" (COM-style, not
  STATUS_PENDING — misreading it abandoned the swapchain mid-activation
  and stalled the compositor); on real failure: REBUILDING + retire +
  worker exit, letting the OS's unassign→assign cycle drive recovery.
- monitors.rs: ring created at plug, marked DEAD at unplug;
  RequiredBandwidth=0 in both target-mode callbacks (nonzero vs
  MaxDisplayPipelineRate=0 made every mode unactivatable).
- core/ring.rs: writer_abort (revert without publishing; aborts consume
  no sequence numbers) + test.
- vgd-probe: maps the ring during the hold, prints gen/state/seq/
  published/dropped/heartbeat per second with a milestone verdict;
  --ephemeral mints a throwaway identity (Windows persists per-identity
  "Disconnect this display" topology).
- CLAUDE.md: phase-4 status, bring-up lessons, phase-5 notes.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@NorthernLights
NorthernLights merged commit 19ebd39 into main Jul 19, 2026
@CLAassistant

Copy link
Copy Markdown

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution.
You have signed the CLA already but the status is still pending? Let us recheck it.

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