diff --git a/docs/CLEAN_ROOM.md b/docs/CLEAN_ROOM.md index dc7db2c..6fd44e6 100644 --- a/docs/CLEAN_ROOM.md +++ b/docs/CLEAN_ROOM.md @@ -88,3 +88,6 @@ All entries by the DomiStream protocol engineer. Pinned commits are the ones rea | S-20 | 2026-11-25 | ArenaTV `docs/research/sunshine-api.md` and `docs/research/this-pc.md` (Domi's own research from LizardByte's docs) | Sunshine's API calls, `--creds`, `bind_address`, port offsets, first-run behaviour, this PC's adapters and old install. | | S-21 | 2026-11-30 | [Moonshine](https://github.com/hgaiser/moonshine) at `f184d5e` (same pin as S-9): `src/session/stream/control/mod.rs` again (client message parsing and the control loop), `src/session/stream/mod.rs` (`StreamConfig`), `src/session/stream/video/mod.rs` (PING handling), `src/config.rs` (nothing relevant); the repository tree listing | BSD-2. U10, as facts only: the host reads **no body** from START_B (0x0307), Ping (0x0200), LOSS_STATS, FRAME_STATS or the IDR request; START_A (0x0305) is not a type it knows; inside the encrypted frame an unknown type or a failed decryption is skipped, outside it an unknown type or a bad length ends the session; INVALIDATE_REF_FRAMES `first`/`last` at message bytes 4..8 and 12..16 (LE), short bodies mean "from 0"; each Ping resets a stop deadline, `StreamConfig.timeout` default 60 s; the client-to-host IV is `seq LE ‖ 6 zero ‖ 'C' 'C'`; host messages go reliable on channel 0; the video receiver waits for START_B and takes exactly the 4 bytes `PING`, each PING updating the client address. No value in these parts cites Sunshine or moonlight-common-c (the HDR payload's Sunshine note is the known S-9 case). Used for the probe's default bodies (all empty) and the PROTOCOL.md 3.3 facts. | | S-22 | 2026-12-04 | Microsoft Learn: [DXGI 1.5 improvements](https://learn.microsoft.com/windows/win32/direct3ddxgi/dxgi-1-5-improvements), [IDXGIOutput5::DuplicateOutput1](https://learn.microsoft.com/windows/win32/api/dxgi1_5/nf-dxgi1_5-idxgioutput5-duplicateoutput1), [IDXGIOutput1::DuplicateOutput](https://learn.microsoft.com/windows/win32/api/dxgi1_2/nf-dxgi1_2-idxgioutput1-duplicateoutput), [Desktop duplication](https://learn.microsoft.com/windows-hardware/drivers/display/desktop-duplication-api), [HDR and advanced colour](https://learn.microsoft.com/windows/win32/direct3darticles/high-dynamic-range), [GraphicsCaptureSession](https://learn.microsoft.com/uwp/api/windows.graphics.capture.graphicscapturesession) (`IsBorderRequired`, `IsCursorCaptureEnabled`), [SendInput](https://learn.microsoft.com/windows/win32/api/winuser/nf-winuser-sendinput), [MOUSEINPUT](https://learn.microsoft.com/windows/win32/api/winuser/ns-winuser-mouseinput), [Security considerations for assistive technologies](https://learn.microsoft.com/windows/win32/winauto/uiauto-securityoverview), [UAC policy for UIAccess in secure locations](https://learn.microsoft.com/windows/client-management/mdm/policy-csp-localpoliciessecurityoptions), [CreateSyntheticPointerDevice](https://learn.microsoft.com/windows/win32/api/winuser/nf-winuser-createsyntheticpointerdevice), [InjectSyntheticPointerInput](https://learn.microsoft.com/windows/win32/api/winuser/nf-winuser-injectsyntheticpointerinput), [Loopback recording](https://learn.microsoft.com/windows/win32/coreaudio/loopback-recording), [AUDIOCLIENT_PROCESS_LOOPBACK_PARAMS](https://learn.microsoft.com/windows/win32/api/audioclientactivationparams/ns-audioclientactivationparams-audioclient_process_loopback_params) | For [LUMEN-HOST-PLAN.md](LUMEN-HOST-PLAN.md): `DuplicateOutput1` takes a list of formats and can deliver HDR/WCG surfaces unconverted, the list should always hold `B8G8R8A8_UNORM`; E_ACCESSDENIED on the secure desktop unless LocalSystem; four duplicating processes per session by default; re-create after desktop switches and mode changes. WGC draws a border, removable only from build 20348 after user consent; cursor capture from 19041. `SendInput` is subject to UIPI and fails silently; absolute moves are 0..65535, `MOUSEEVENTF_VIRTUALDESK` maps to the whole virtual desktop; relative moves get pointer speed applied. UIAccess needs Authenticode signing, a secure install location and is meant for assistive technology. Synthetic touch/pen injection from Windows 10 1809. WASAPI loopback captures the render mix in shared mode; per-process loopback from build 20348. | +| S-23 | 2026-12-04 | NVIDIA [video-sdk-samples](https://github.com/NVIDIA/video-sdk-samples) at `aa3544d`: `Samples/NvCodec/NvEncoder/nvEncodeAPI.h` (API 8.1, sha256 `4d061c34…6042a`); NVIDIA [VideoProcessingFramework](https://github.com/NVIDIA/VideoProcessingFramework) at `e82364f`: `src/TC/third_party/nvEncodeAPI.h` (API 12.0, sha256 `067c5159…b4ad`); GitHub repository metadata of both | Both headers carry NVIDIA's MIT notice for the header file; the repositories are Apache-2.0 / unlicensed samples and the second is archived. Declarations used for the L0 spike shim (struct versions, preset and tuning enums, `NvEncGetEncodePresetConfigEx`, resource registration). No sample `.cpp` file was opened. | +| S-24 | 2026-12-04 | [NVENC Video Encoder API Programming Guide](https://docs.nvidia.com/video-technologies/video-codec-sdk/13.0/nvenc-video-encoder-api-prog-guide/index.html) (SDK 13.0) | Loading `nvEncodeAPI` at run time and `NvEncodeAPICreateInstance`; `NV_ENC_DEVICE_TYPE_DIRECTX` sessions; registering, mapping and unmapping D3D11 textures; tuning info (low latency, ultra low latency), presets P1-P7, CBR filler, forcing IDR, `NvEncInvalidateRefFrames`, intra refresh, look-ahead latency; lock/unlock of the bitstream; async mode only on Windows 10+ WDDM, recommended there; Main10 settings. | +| S-25 | 2026-12-04 | Licences via the GitHub and crates.io APIs and `COPYING` files: nefarius/ViGEmClient (MIT, archived), nefarius/ViGEmBus (BSD-3-Clause, archived), xiph/opus `COPYING` (BSD-style), crates `opus`, `audiopus_sys`, `vigem-client`, `nvidia-video-codec-sdk`, `nvenc`, `windows` | Licence and status only; no source files of these projects were opened. | diff --git a/docs/LUMEN-HOST-PLAN.md b/docs/LUMEN-HOST-PLAN.md index 2b24e0b..a797962 100644 --- a/docs/LUMEN-HOST-PLAN.md +++ b/docs/LUMEN-HOST-PLAN.md @@ -90,6 +90,8 @@ Windows 11, where the border can be turned off. Reasons: the reference PC runs W WGC would draw a yellow border over the game; duplication captures exclusive-fullscreen games; and it hands us FP16 directly. Sources: S-22 (section 9). +- **DPI awareness**: lumen-host is per-monitor DPI aware (v2). Measured in L0: without it `DuplicateOutput1` + fails with `DXGI_ERROR_UNSUPPORTED` and output sizes are DPI-virtualised. - **Formats asked for**: `R16G16B16A16_FLOAT`, `R10G10B10A2_UNORM`, `B8G8R8A8_UNORM` (the last one always, as Microsoft asks). The format that arrives decides the colour path (1.3). - **Frames only on change**: duplication delivers a frame only when something changed. The pacer repeats the last @@ -153,7 +155,8 @@ explicit at every step and tested with patterns (7.5). - **Bitrate**: from the client's request (`configuredBitrateKbps`), capped by what the encoder supports; adaptive bitrate belongs to Lumen's own transport (roadmap Day 4). - **Interface to NVENC**: NVIDIA's public API header and the driver's `nvEncodeAPI64.dll`, loaded at run time, so - nothing of NVIDIA ships in Arena Domi. The header's licence is checked and logged in L0 (risk R12). We do not read + nothing of NVIDIA ships in Arena Domi. The header is MIT-licensed by its own notice; L0 settled which one (section + 10: API 12.0, because current drivers refuse the older API's presets). We do not read the source of GPL or LGPL projects that wrap NVENC (FFmpeg, OBS Studio and the like); see 6.1. ### 1.5 Audio @@ -520,3 +523,46 @@ Desktop Duplication, HDR and advanced colour, `GraphicsCaptureSession` (`IsBorde for UIAccess, `CreateSyntheticPointerDevice` / `InjectSyntheticPointerInput`, and WASAPI loopback recording with process loopback activation. Everything else here comes from this repository's own documents and the 2026-12-04 live evidence (the phone's input packets). + +--- + +## 10. L0 results (2026-12-04) + +**Done:** the licence reading and the GPU spike. The spike is a throwaway Rust program with a small C shim over the +NVENC header, kept outside git. It showed no window, injected nothing and opened no socket. The desktop bitstreams +never left memory (nothing of the screen was written to disk); only two synthetic-pattern encodes were written, and +they stay outside git. + +**Licences** (logged as S-23 to S-25 in [CLEAN_ROOM.md](CLEAN_ROOM.md)): + +| Piece | Licence | Note | +| :-- | :-- | :-- | +| `nvEncodeAPI.h`, API **12.0**, from NVIDIA's own public repository (VideoProcessingFramework, Apache-2.0 repository, archived) | MIT (the header's own notice) | used. No account and no licence acceptance needed | +| `nvEncodeAPI.h`, API 8.1, NVIDIA's video-sdk-samples | MIT | **not usable**: the driver refuses its presets (below) | +| NVENC API 12.1 or newer headers | NVIDIA's SDK download (account and terms) | not needed for anything planned; if a later feature needs it, that download is Mark's decision | +| libopus | BSD-3-Clause style (Xiph COPYING) | for L2 | +| `opus` crate / `audiopus_sys` | Apache-2.0 or MIT / ISC | candidates for L2, chosen then | +| ViGEmClient | MIT (repository archived) | the client library for ViGEmBus | +| ViGEmBus | BSD-3-Clause (repository archived) | Mark installs it himself; never shipped | +| `vigem-client` crate | MIT | candidate binding for L3 | +| `windows` crate | MIT or Apache-2.0 | used by the spike | + +**Measured on the reference PC** (RTX 3090, driver NVENC API maximum 13.1; primary 2560x1440 HDR; one run, +idle desktop): + +| What | Result | +| :-- | :-- | +| Display state | both outputs report colour space `RGB_FULL_G2084_NONE_P2020` (HDR on); primary 10 bits per colour; peak 1499 nits, full frame 799; SDR white level 240 nits | +| Desktop Duplication | the HDR desktop arrives as `R16G16B16A16_FLOAT` (FP16 scRGB), as planned. **Needs per-monitor DPI awareness**: without it `DuplicateOutput1` returned `DXGI_ERROR_UNSUPPORTED` and the 4K output showed as 2560x1440 | +| NVENC with the API 8.1 header | `nvEncGetEncodePresetConfig` refuses the legacy low-latency preset (`NV_ENC_ERR_UNSUPPORTED_PARAM`) and initialisation without a preset fails (`NV_ENC_ERR_INVALID_PARAM`) | +| NVENC with the API 12.0 header | preset P1, tuning "ultra low latency", CBR 20 Mbit/s, VBV one frame, infinite GOP: works, 8-bit and 10-bit HEVC; the first access unit is VPS, SPS, PPS, IDR | +| Copy of the captured frame (GPU, waited) | 1.6 ms (one sample: the desktop was idle, so only one new frame arrived) | +| Colour pass FP16 → NV12 / P010, 2560x1440 (one compute dispatch, waited) | median 0.57 / 0.50 ms, p95 1.01 / 0.93 ms | +| NVENC HEVC 2560x1440, synchronous | 8-bit median 2.56 ms, p95 2.70 ms; 10-bit median 2.56 ms, p95 2.80 ms | +| NVENC HEVC 1920x1080 (pattern) | median 1.4 to 1.5 ms, p95 1.7 to 2.5 ms | +| Capture to bitstream, sum of medians, 1440p | about **4.7 ms** on the host | + +What L0 did not settle (and where it is settled): capture timing under motion and at a game's frame rate (L2, +with the harness); whether the colour pass matches what a decoder shows (L4, the pattern files are the start); +the asynchronous NVENC mode, which NVIDIA recommends on Windows (L2). +