e2f004589c
apple / swift (push) Failing after 1s
windows-drivers / driver-build (push) Successful in 1m9s
ci / rust (push) Successful in 1m31s
ci / web (push) Successful in 42s
apple / screenshots (push) Has been skipped
windows-drivers / probe-and-proto (push) Successful in 19s
ci / docs-site (push) Successful in 1m2s
android / android (push) Successful in 3m50s
deb / build-publish (push) Successful in 2m37s
decky / build-publish (push) Successful in 12s
docker / build-push (--build-arg FEDORA_VERSION=44, ci, ci/fedora-rpm.Dockerfile, punktfunk-fedora44-rpm) (push) Successful in 4s
docker / build-push (., web/Dockerfile, punktfunk-web) (push) Successful in 4s
windows-host / package (push) Successful in 5m20s
docker / build-push (ci, ci/fedora-rpm.Dockerfile, punktfunk-fedora-rpm) (push) Successful in 4s
docker / build-push (ci, ci/rust-ci.Dockerfile, punktfunk-rust-ci) (push) Successful in 4s
docker / build-push (docs-site, docs-site/Dockerfile, punktfunk-docs) (push) Successful in 4s
ci / bench (push) Successful in 4m37s
rpm / build-publish (bazzite, punktfunk-fedora-rpm) (push) Successful in 8m32s
rpm / build-publish (fedora-44, punktfunk-fedora44-rpm) (push) Successful in 8m19s
docker / deploy-docs (push) Successful in 16s
The driver now publishes each acquired swap-chain surface into the host-created shared ring (the IDD-push path) — the full glass-to-glass transport is code-complete. Both sides use the canonical pf_vdisplay_proto::frame layout (lockstep by compile-error, not "must match" comments). Driver compiles + LOADS on-glass (adapter inits, Status=OK; no regression — the publisher is dormant until a frame is acquired); host cargo check green; adversarially reviewed (no blockers — token layout, keyed-mutex key 0, names by target_id, and the format guard all match the host consumer). - new driver frame_transport.rs: FramePublisher OPENS the host ring by target_id (OpenFileMapping header + magic Acquire readiness gate + OpenEvent + OpenSharedResourceByName RING_LEN keyed-mutex textures), writes its render LUID + DRV_STATUS back into the header; publish() is NON-BLOCKING (round-robin 0ms try-acquire -> CopyResource -> ReleaseSync -> FrameToken::pack store Release -> SetEvent; drops the frame if every slot is busy or the surface format != the ring format). Manual handle/view cleanup on every try_open early return; RAII Drop (slots -> unmap -> CloseHandle). Layout/consts/names/token all from pf_vdisplay_proto::frame. - swap_chain_processor.rs run_core: lazy rate-limited attach (every ~30 frames) + is_stale re-attach (mid-session HDR ring recreate); publishes buffer.MetaData.pSurface via IDXGIResource::from_raw_borrowed (preserves IddCx's refcount) BEFORE IddCxSwapChainFinishedProcessingFrame. run/run_core gain the render LUID; callbacks.rs assign_swap_chain passes it. - host idd_push.rs migrated onto pf_vdisplay_proto::frame (deleted the hand-rolled SharedHeader / MAGIC / VERSION / RING_LEN / DRV_STATUS_* / name fns / token packing) — pure refactor, byte-identical, no behavior or gating change. DebugBlock + DXGI_SHARED_RESOURCE_RW kept local (not in the proto). - driver windows crate gains Win32_System_Memory (MapViewOfFile/OpenFileMappingW/...); rustfmt'd the whole driver workspace (incl. wdk-probe — fmt-only). Built via the ultracode flow: STEP-6 map workflow -> agent-implement -> box build (driver + host both green; caught nothing this time) -> adversarial-verify-agent (no blockers) -> FrameToken::pack hardening -> deploy (loads). Glass-to-glass frame validation awaits a composited session (per the parity finding: this headless box yields 0 frames for the proven SudoVDA path too). FOLLOW-UPs: port the optional Global\pfvd-dbg DebugBlock triage channel to the new driver; STEP 7 HDR; STEP 8 drop SudoVDA. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
77 lines
3.6 KiB
Rust
77 lines
3.6 KiB
Rust
//! Minimal IddCx table-dispatch over the wdk-sys `iddcx` bindings — the M1 proof that the generated
|
|
//! IddCx surface is *callable* and links against `IddCxStub`. IddCx DDIs dispatch through the
|
|
//! `IddFunctions` table (indexed by `_IDDFUNCENUM::<Name>TableIndex`, with `IddDriverGlobals` as the
|
|
//! implicit first argument) — the same model wdk-sys already uses for WDF. This mirrors the proven
|
|
//! `wdf-umdf` oracle, but on wdk-sys's ModuleConsts enums (`_IDDFUNCENUM::<Name>TableIndex`, an `i32`
|
|
//! const — not the oracle's NewType `.0`) and plain `i32` NTSTATUS. The full DDI surface + a proper
|
|
//! `wdk-iddcx` wrapper crate land with the driver port.
|
|
#![allow(non_snake_case)]
|
|
|
|
use wdk_sys::iddcx::{
|
|
_IDDFUNCENUM, IDARG_IN_ADAPTER_INIT, IDARG_OUT_ADAPTER_INIT, IDD_CX_CLIENT_CONFIG,
|
|
IddDriverGlobals, IddFunctions, PFN_IDD_CX, PFN_IDDCXADAPTERINITASYNC,
|
|
PFN_IDDCXDEVICEINITCONFIG, PFN_IDDCXDEVICEINITIALIZE, PIDD_DRIVER_GLOBALS,
|
|
};
|
|
use wdk_sys::{NTSTATUS, PWDFDEVICE_INIT, WDFDEVICE};
|
|
|
|
/// Read the IddCx DDI at `index` from the stub-provided `IddFunctions` table and reinterpret it as the
|
|
/// concrete `PFN_*` type. `IddFunctions` is a flexible array (`[PFN_IDD_CX; 0]`) whose real entries are
|
|
/// populated by `IddCxStub` once the driver is loaded.
|
|
///
|
|
/// # Safety
|
|
/// `index` and `T` must be the matching `_IDDFUNCENUM` index and `PFN_*` type for the same DDI, and the
|
|
/// table must be populated (true after the driver is loaded by the IddCx runtime).
|
|
#[inline]
|
|
unsafe fn ddi<T: Copy>(index: i32) -> T {
|
|
let table = (&raw const IddFunctions).cast::<PFN_IDD_CX>();
|
|
// SAFETY: `index` is a valid IddCx table slot; the slot holds a `PFN_*` whose layout is `T`.
|
|
let slot = unsafe { table.add(index as usize) };
|
|
unsafe { slot.cast::<T>().read() }
|
|
}
|
|
|
|
/// The IddCx driver globals (set by `IddCxStub`), passed as the implicit first arg to every DDI.
|
|
///
|
|
/// # Safety
|
|
/// Only valid once the driver is loaded by the IddCx runtime.
|
|
#[inline]
|
|
unsafe fn globals() -> PIDD_DRIVER_GLOBALS {
|
|
// SAFETY: we only read the pointer value of the stub-provided global.
|
|
unsafe { (&raw const IddDriverGlobals).read() }
|
|
}
|
|
|
|
/// # Safety
|
|
/// `device_init`/`config` must be valid per the IddCx contract; call only during `EvtDriverDeviceAdd`.
|
|
pub unsafe fn IddCxDeviceInitConfig(
|
|
device_init: PWDFDEVICE_INIT,
|
|
config: *const IDD_CX_CLIENT_CONFIG,
|
|
) -> NTSTATUS {
|
|
let f: PFN_IDDCXDEVICEINITCONFIG =
|
|
unsafe { ddi(_IDDFUNCENUM::IddCxDeviceInitConfigTableIndex) };
|
|
let g = unsafe { globals() };
|
|
// SAFETY: dispatching a populated DDI with the stub globals and caller-valid args.
|
|
unsafe { (f.unwrap())(g, device_init, config) }
|
|
}
|
|
|
|
/// # Safety
|
|
/// `device` must be a valid `WDFDEVICE` previously configured via [`IddCxDeviceInitConfig`].
|
|
pub unsafe fn IddCxDeviceInitialize(device: WDFDEVICE) -> NTSTATUS {
|
|
let f: PFN_IDDCXDEVICEINITIALIZE =
|
|
unsafe { ddi(_IDDFUNCENUM::IddCxDeviceInitializeTableIndex) };
|
|
let g = unsafe { globals() };
|
|
// SAFETY: dispatching a populated DDI with the stub globals and a caller-valid device.
|
|
unsafe { (f.unwrap())(g, device) }
|
|
}
|
|
|
|
/// # Safety
|
|
/// `in_args`/`out_args` must be valid per the IddCx contract.
|
|
pub unsafe fn IddCxAdapterInitAsync(
|
|
in_args: *const IDARG_IN_ADAPTER_INIT,
|
|
out_args: *mut IDARG_OUT_ADAPTER_INIT,
|
|
) -> NTSTATUS {
|
|
let f: PFN_IDDCXADAPTERINITASYNC =
|
|
unsafe { ddi(_IDDFUNCENUM::IddCxAdapterInitAsyncTableIndex) };
|
|
let g = unsafe { globals() };
|
|
// SAFETY: dispatching a populated DDI with the stub globals and caller-valid args.
|
|
unsafe { (f.unwrap())(g, in_args, out_args) }
|
|
}
|