From cc39882296a1820c79bc312d62042f46496850fe Mon Sep 17 00:00:00 2001 From: Meta Vens Date: Thu, 28 May 2026 00:09:39 +0100 Subject: [PATCH] Record dedicated program output fence --- docs/eve-program-output.md | 4 ++-- docs/implementation-plan.md | 15 ++++++++------- docs/obs-stem-plugin.md | 15 ++++++++------- notes/current-system-map.md | 9 +++++---- state/evidence.jsonl | 1 + state/map.yaml | 19 ++++++++++--------- 6 files changed, 34 insertions(+), 29 deletions(-) diff --git a/docs/eve-program-output.md b/docs/eve-program-output.md index 9c30413..27b14a9 100644 --- a/docs/eve-program-output.md +++ b/docs/eve-program-output.md @@ -29,8 +29,8 @@ dotnet run --project .\src\Mimir.App\Mimir.App.csproj ``` Fensalir creates a shareable D3D12 texture with that name, publishes a named -producer fence, and copies the finished backbuffer into the texture during the -present pass. `Mimir.EveRelay` opens that named texture, reads the completed +program-output fence, and copies the finished backbuffer into the texture during +the present pass. `Mimir.EveRelay` opens that named texture, reads the completed program frame, feeds a low-latency H.264 encoder, and sends complete Annex-B access units to EveCanvas over the existing `/stream` WebSocket. EveCanvas treats JPEG frames as the old VoidBot dashboard fallback only; Mimir dashboard diff --git a/docs/implementation-plan.md b/docs/implementation-plan.md index 1054821..1ca5404 100644 --- a/docs/implementation-plan.md +++ b/docs/implementation-plan.md @@ -163,13 +163,14 @@ a named invariant that the native runtime cannot protect yet. `Mimir Audio Stem`, which reads one named stem and submits it to OBS as an audio source, and `Mimir Program Texture`, which opens Fensalir's named D3D12 program-output texture and feeds OBS through a GPU-to-GPU D3D12-to-D3D11 - bridge texture. Fensalir also publishes a named D3D12 producer fence, and the - OBS source opens it before copying so the consumer is not reading blindly. - This avoids CPU readback and removes Spout2 as a required program-video - dependency, while preserving the explicit boundary cost that libobs is D3D11 - on Windows. Fensalir and the OBS source can optionally agree on a bounded - publication ring using `FENSALIR_PROGRAM_OUTPUT_RING_COUNT`; OBS selects the - latest completed slot from the producer fence value. A later consumer + bridge texture. Fensalir also publishes a named D3D12 program-output fence, + and the OBS source opens it before copying so the consumer is not reading + blindly or depending on Fensalir's private frame fence. This avoids CPU + readback and removes Spout2 as a required program-video dependency, while + preserving the explicit boundary cost that libobs is D3D11 on Windows. + Fensalir and the OBS source can optionally agree on a bounded publication + ring using `FENSALIR_PROGRAM_OUTPUT_RING_COUNT`; OBS selects the latest + completed slot from the program-output fence value. A later consumer acknowledgement fence is still required to make producer/consumer overwrite races structurally impossible. `scripts/build-obs-stem-plugin.ps1` stages the upstream OBS plugin template diff --git a/docs/obs-stem-plugin.md b/docs/obs-stem-plugin.md index d3edc99..957147f 100644 --- a/docs/obs-stem-plugin.md +++ b/docs/obs-stem-plugin.md @@ -38,11 +38,12 @@ texture, creates an OBS-readable legacy shared D3D11 texture, opens that same bridge texture from D3D12, and performs a GPU-to-GPU copy during OBS render before drawing the source. This avoids CPU readback and does not require Spout2. It is not pure zero-copy yet; the remaining copy is the -D3D12-to-libobs-D3D11 boundary. Fensalir also publishes a named D3D12 fence; -the OBS source opens it and observes the producer completion value before -copying. This prevents blind read-before-producer-completion behavior. A later -consumer acknowledgement fence is still required to make overwrite races -structurally impossible when producer and consumer cadence diverge. +D3D12-to-libobs-D3D11 boundary. Fensalir also publishes a named D3D12 +program-output fence; the OBS source opens it and observes publication +completion before copying. This prevents blind read-before-producer-completion +behavior without coupling OBS to Fensalir's private frame fence. A later consumer +acknowledgement fence is still required to make overwrite races structurally +impossible when producer and consumer cadence diverge. For OBS-only stress testing, Fensalir and the OBS source can agree on a bounded texture ring: @@ -54,8 +55,8 @@ Texture ring slots: 3 With a ring count above one, Fensalir publishes textures named `Global\MimirFensalirProgramTexture.0`, `.1`, and so on. The OBS source uses the -producer fence value to copy the latest completed slot. Leave the ring count at -`1` for EVE until the EVE relay speaks the same ring contract. +program-output fence value to copy the latest completed slot. Leave the ring +count at `1` for EVE until the EVE relay speaks the same ring contract. For a visible interop witness while the real Mimir scene is sparse, launch Mimir with: diff --git a/notes/current-system-map.md b/notes/current-system-map.md index f46fca9..6a74492 100644 --- a/notes/current-system-map.md +++ b/notes/current-system-map.md @@ -325,11 +325,12 @@ and submits it through libobs audio, while `Mimir Program Texture` opens Fensalir's named shared D3D12 program-output texture and draws it through an OBS-readable shared D3D11 bridge texture. The video path is GPU-to-GPU and does not require Spout2 or CPU readback; the remaining copy is the explicit D3D12 to -libobs-D3D11 boundary. Fensalir publishes `Global\MimirFensalirProgramFence`, -and the OBS source opens that producer fence before copying. This prevents -blind read-before-producer-completion. An optional texture ring is available +libobs-D3D11 boundary. Fensalir publishes `Global\MimirFensalirProgramFence` as +a program-output publication fence, and the OBS source opens that fence before +copying. This prevents blind read-before-producer-completion without coupling +OBS to Fensalir's private frame fence. An optional texture ring is available when Fensalir and OBS agree on `FENSALIR_PROGRAM_OUTPUT_RING_COUNT`; OBS selects -the latest completed slot from the producer fence value. A later consumer +the latest completed slot from the program-output fence value. A later consumer acknowledgement fence is still needed to make overwrite races structurally impossible. `scripts/build-obs-stem-plugin.ps1` stages the upstream OBS plugin-template SDK under `artifacts/obs-sdk/` and builds the plugin DLL diff --git a/state/evidence.jsonl b/state/evidence.jsonl index a8ab1ed..dbb09ab 100644 --- a/state/evidence.jsonl +++ b/state/evidence.jsonl @@ -198,3 +198,4 @@ {"ts": "2026-05-27T23:34:13+01:00", "type": "verification", "status": "ok", "note": "Live OBS program texture proof succeeded. With Mimir/Fensalir publishing Global\\\\MimirFensalirProgramTexture at 1264x681 and MIMIR_OBS_PROOF_VISUAL=1, OBS 32.1.2 loaded mimir_obs_stem_source.dll, the Mimir Program Texture source opened the shared texture, and the user visually confirmed the Fensalir debug/proof scene in OBS. The working bridge uses a legacy shared D3D11 texture because libobs accepts that handle path; D3D12 opens the same bridge texture and copies GPU-to-GPU from the Fensalir D3D12 program texture. This removes Spout2 and CPU readback from the program-video proof path while retaining the explicit D3D12-to-D3D11 boundary copy."} {"ts": "2026-05-27T23:55:25+01:00", "type": "verification", "status": "ok", "note": "OBS program texture bridge now opens Fensalir's named D3D12 producer fence Global\\\\MimirFensalirProgramFence and the shared program texture Global\\\\MimirFensalirProgramTexture; live OBS 32.1.2 log showed producer fence value 1061 and texture 1264x681 while the proof visual appeared in OBS."} {"ts": "2026-05-28T00:03:43+01:00", "type": "verification", "status": "ok", "note": "Optional OBS program texture ring proof passed: with FENSALIR_PROGRAM_OUTPUT_RING_COUNT=3, Fensalir published Global\\\\MimirFensalirProgramTexture.0/.1/.2 plus Global\\\\MimirFensalirProgramFence, and OBS 32.1.2 opened Mimir Program Texture at 1264x681 ring=3 with producer fence value 1149."} +{"ts": "2026-05-28T00:08:37+01:00", "type": "verification", "status": "ok", "note": "Fensalir program output now uses a dedicated shared publication fence instead of the private frame fence. Ring proof reran with FENSALIR_PROGRAM_OUTPUT_RING_COUNT=3; OBS opened Global\\\\MimirFensalirProgramFence at value 1252 and Global\\\\MimirFensalirProgramTexture ring=3 at 1264x681."} diff --git a/state/map.yaml b/state/map.yaml index 12dba79..c4d61f3 100644 --- a/state/map.yaml +++ b/state/map.yaml @@ -201,15 +201,16 @@ accepted_design: from that map and submits it as libobs audio, and `Mimir Program Texture`, which opens Fensalir's named shared D3D12 program-output texture and draws it through an OBS-readable shared D3D11 bridge texture. Fensalir also - publishes `Global\MimirFensalirProgramFence`; the OBS source opens that - producer fence and observes completion before copying. The video path is - GPU-to-GPU and does not require Spout2 or CPU readback; the remaining copy - is the explicit D3D12 to libobs-D3D11 boundary. Fensalir and the OBS source - can optionally agree on `FENSALIR_PROGRAM_OUTPUT_RING_COUNT>1`; Fensalir - publishes `Global\MimirFensalirProgramTexture.0`, `.1`, and so on, and OBS - chooses the latest completed slot from the producer fence value. A later - consumer acknowledgement fence is still required to make producer/consumer - overwrite races structurally impossible. + publishes `Global\MimirFensalirProgramFence` as a program-output + publication fence; the OBS source opens that fence and observes completion + before copying. The video path is GPU-to-GPU and does not require Spout2 or + CPU readback; the remaining copy is the explicit D3D12 to libobs-D3D11 + boundary. Fensalir and the OBS source can optionally agree on + `FENSALIR_PROGRAM_OUTPUT_RING_COUNT>1`; Fensalir publishes + `Global\MimirFensalirProgramTexture.0`, `.1`, and so on, and OBS chooses the + latest completed slot from the program-output fence value. A later consumer + acknowledgement fence is still required to make producer/consumer overwrite + races structurally impossible. `scripts/build-obs-stem-plugin.ps1` stages the upstream OBS plugin template SDK under `artifacts/obs-sdk/` and builds the plugin DLL locally. The synthetic