feat(windows-drivers): pf-vdisplay STEP 2 — IddCx device skeleton
apple / swift (push) Failing after 2s
apple / screenshots (push) Has been skipped
windows-drivers / probe-and-proto (push) Successful in 21s
windows-drivers / driver-build (push) Successful in 1m5s
windows-host / package (push) Successful in 5m16s
android / android (push) Successful in 3m40s
ci / web (push) Successful in 59s
ci / docs-site (push) Successful in 1m2s
ci / rust (push) Successful in 4m32s
deb / build-publish (push) Successful in 2m14s
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 5s
docker / build-push (., web/Dockerfile, punktfunk-web) (push) Successful in 4s
docker / build-push (ci, ci/fedora-rpm.Dockerfile, punktfunk-fedora-rpm) (push) Successful in 3s
docker / build-push (ci, ci/rust-ci.Dockerfile, punktfunk-rust-ci) (push) Successful in 5s
docker / build-push (docs-site, docs-site/Dockerfile, punktfunk-docs) (push) Successful in 6s
ci / bench (push) Successful in 4m44s
rpm / build-publish (bazzite, punktfunk-fedora-rpm) (push) Successful in 8m31s
rpm / build-publish (fedora-44, punktfunk-fedora44-rpm) (push) Successful in 8m22s
docker / deploy-docs (push) Successful in 18s
apple / swift (push) Failing after 2s
apple / screenshots (push) Has been skipped
windows-drivers / probe-and-proto (push) Successful in 21s
windows-drivers / driver-build (push) Successful in 1m5s
windows-host / package (push) Successful in 5m16s
android / android (push) Successful in 3m40s
ci / web (push) Successful in 59s
ci / docs-site (push) Successful in 1m2s
ci / rust (push) Successful in 4m32s
deb / build-publish (push) Successful in 2m14s
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 5s
docker / build-push (., web/Dockerfile, punktfunk-web) (push) Successful in 4s
docker / build-push (ci, ci/fedora-rpm.Dockerfile, punktfunk-fedora-rpm) (push) Successful in 3s
docker / build-push (ci, ci/rust-ci.Dockerfile, punktfunk-rust-ci) (push) Successful in 5s
docker / build-push (docs-site, docs-site/Dockerfile, punktfunk-docs) (push) Successful in 6s
ci / bench (push) Successful in 4m44s
rpm / build-publish (bazzite, punktfunk-fedora-rpm) (push) Successful in 8m31s
rpm / build-publish (fedora-44, punktfunk-fedora44-rpm) (push) Successful in 8m22s
docker / deploy-docs (push) Successful in 18s
DriverEntry -> driver_add builds the full IDD_CX_CLIENT_CONFIG (14 IddCx callbacks + PnP EvtDeviceD0Entry, all stubs with correct PFN signatures) sized via the ported IDD_STRUCTURE_SIZE! (size.rs), runs IddCxDeviceInitConfig -> WdfDeviceCreate -> WdfDeviceCreateDeviceInterface(the owned pf-vdisplay GUID, not SudoVDA) -> IddCxDeviceInitialize. callbacks.rs has all 14 + device_d0_entry; query_target_info implements HIGH_COLOR_SPACE. edid.rs salvaged verbatim from the oracle. proto gains interface_guid_fields() (u128 -> Windows GUID fields). Links IddCxStub (the CI gate); adapter/monitor/swapchain/IDD-push fill the stubs in STEP 3-6. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -0,0 +1,148 @@
|
||||
//! The IddCx client-config callbacks + the PnP `EvtDeviceD0Entry`.
|
||||
//!
|
||||
//! STEP 2: stubs with the correct PFN signatures (so the config wires up + the driver loads); the real
|
||||
//! mode/EDID logic (STEP 4), adapter init (STEP 3), and swap-chain handoff (STEP 5) fill them in. Every
|
||||
//! callback is `unsafe extern "C"` to match the wdk-sys `PFN_IDD_CX_*` types; with `panic = "abort"`
|
||||
//! (workspace profile) a panic across the FFI boundary aborts rather than being UB. `query_target_info`
|
||||
//! is implemented now because it gates HDR (`HIGH_COLOR_SPACE`) and the adapter (STEP 3) sets FP16.
|
||||
|
||||
use wdk_sys::iddcx;
|
||||
use wdk_sys::{call_unsafe_wdf_function_binding, NTSTATUS, WDFDEVICE, WDFREQUEST};
|
||||
|
||||
use crate::{STATUS_NOT_IMPLEMENTED, STATUS_SUCCESS};
|
||||
|
||||
/// PnP `EvtDeviceD0Entry` (not an IddCx config callback). STEP 3 calls `DeviceContext::init_adapter`
|
||||
/// here (adapter creation is deferred to first D0, not driver_add).
|
||||
pub unsafe extern "C" fn device_d0_entry(
|
||||
_device: WDFDEVICE,
|
||||
_previous_state: wdk_sys::WDF_POWER_DEVICE_STATE,
|
||||
) -> NTSTATUS {
|
||||
STATUS_SUCCESS
|
||||
}
|
||||
|
||||
/// Async completion of `IddCxAdapterInitAsync`. STEP 3: stash the adapter + start the watchdog.
|
||||
pub unsafe extern "C" fn adapter_init_finished(
|
||||
_adapter: iddcx::IDDCX_ADAPTER,
|
||||
_p_in: *const iddcx::IDARG_IN_ADAPTER_INIT_FINISHED,
|
||||
) -> NTSTATUS {
|
||||
STATUS_SUCCESS
|
||||
}
|
||||
|
||||
/// SDR mode list for an EDID monitor. STEP 4: EDID-serial lookup + count-then-fill `IDDCX_MONITOR_MODE`.
|
||||
pub unsafe extern "C" fn parse_monitor_description(
|
||||
_p_in: *const iddcx::IDARG_IN_PARSEMONITORDESCRIPTION,
|
||||
_p_out: *mut iddcx::IDARG_OUT_PARSEMONITORDESCRIPTION,
|
||||
) -> NTSTATUS {
|
||||
STATUS_SUCCESS
|
||||
}
|
||||
|
||||
/// HDR (`*2`) mode list — writes `IDDCX_MONITOR_MODE2` (+BitsPerComponent). Mandatory under FP16.
|
||||
pub unsafe extern "C" fn parse_monitor_description2(
|
||||
_p_in: *const iddcx::IDARG_IN_PARSEMONITORDESCRIPTION2,
|
||||
_p_out: *mut iddcx::IDARG_OUT_PARSEMONITORDESCRIPTION,
|
||||
) -> NTSTATUS {
|
||||
STATUS_SUCCESS
|
||||
}
|
||||
|
||||
/// Only called for EDID-less monitors; ours always carry an EDID, so this stays NOT_IMPLEMENTED.
|
||||
pub unsafe extern "C" fn monitor_get_default_modes(
|
||||
_monitor: iddcx::IDDCX_MONITOR,
|
||||
_p_in: *const iddcx::IDARG_IN_GETDEFAULTDESCRIPTIONMODES,
|
||||
_p_out: *mut iddcx::IDARG_OUT_GETDEFAULTDESCRIPTIONMODES,
|
||||
) -> NTSTATUS {
|
||||
STATUS_NOT_IMPLEMENTED
|
||||
}
|
||||
|
||||
/// SDR target (scan-out) modes. STEP 4: pointer-match the monitor + fill `IDDCX_TARGET_MODE`.
|
||||
pub unsafe extern "C" fn monitor_query_modes(
|
||||
_monitor: iddcx::IDDCX_MONITOR,
|
||||
_p_in: *const iddcx::IDARG_IN_QUERYTARGETMODES,
|
||||
_p_out: *mut iddcx::IDARG_OUT_QUERYTARGETMODES,
|
||||
) -> NTSTATUS {
|
||||
STATUS_SUCCESS
|
||||
}
|
||||
|
||||
/// HDR (`*2`) target modes — writes `IDDCX_TARGET_MODE2`. Mandatory under FP16.
|
||||
pub unsafe extern "C" fn monitor_query_modes2(
|
||||
_monitor: iddcx::IDDCX_MONITOR,
|
||||
_p_in: *const iddcx::IDARG_IN_QUERYTARGETMODES2,
|
||||
_p_out: *mut iddcx::IDARG_OUT_QUERYTARGETMODES,
|
||||
) -> NTSTATUS {
|
||||
STATUS_SUCCESS
|
||||
}
|
||||
|
||||
/// Diagnostic only — assign drives everything. STEP 4 logs the committed paths.
|
||||
pub unsafe extern "C" fn adapter_commit_modes(
|
||||
_adapter: iddcx::IDDCX_ADAPTER,
|
||||
_p_in: *const iddcx::IDARG_IN_COMMITMODES,
|
||||
) -> NTSTATUS {
|
||||
STATUS_SUCCESS
|
||||
}
|
||||
|
||||
/// HDR (`*2`) commit over `IDDCX_PATH2`. Mandatory under FP16.
|
||||
pub unsafe extern "C" fn adapter_commit_modes2(
|
||||
_adapter: iddcx::IDDCX_ADAPTER,
|
||||
_p_in: *const iddcx::IDARG_IN_COMMITMODES2,
|
||||
) -> NTSTATUS {
|
||||
STATUS_SUCCESS
|
||||
}
|
||||
|
||||
/// Report `HIGH_COLOR_SPACE` so the OS enables the HDR10 wide-gamut/PQ target. Mandatory under FP16.
|
||||
pub unsafe extern "C" fn query_target_info(
|
||||
_adapter: iddcx::IDDCX_ADAPTER,
|
||||
_p_in: *mut iddcx::IDARG_IN_QUERYTARGET_INFO,
|
||||
p_out: *mut iddcx::IDARG_OUT_QUERYTARGET_INFO,
|
||||
) -> NTSTATUS {
|
||||
// SAFETY: p_out is the framework's (uninitialised) out buffer; zero then set the one field we report.
|
||||
unsafe {
|
||||
core::ptr::write(p_out, core::mem::zeroed());
|
||||
(*p_out).TargetCaps = iddcx::IDDCX_TARGET_CAPS::IDDCX_TARGET_CAPS_HIGH_COLOR_SPACE;
|
||||
}
|
||||
STATUS_SUCCESS
|
||||
}
|
||||
|
||||
/// Accept the OS's default HDR10 static metadata (the host/client own the stream's final metadata).
|
||||
/// Mandatory under FP16.
|
||||
pub unsafe extern "C" fn set_default_hdr_metadata(
|
||||
_monitor: iddcx::IDDCX_MONITOR,
|
||||
_p_in: *const iddcx::IDARG_IN_MONITOR_SET_DEFAULT_HDR_METADATA,
|
||||
) -> NTSTATUS {
|
||||
STATUS_SUCCESS
|
||||
}
|
||||
|
||||
/// Accept (do not apply) the gamma ramp — the client display applies its own transform. MANDATORY once
|
||||
/// FP16 is set, or the OS rejects the adapter at init ("Failed to get adapter").
|
||||
pub unsafe extern "C" fn set_gamma_ramp(
|
||||
_monitor: iddcx::IDDCX_MONITOR,
|
||||
_p_in: *const iddcx::IDARG_IN_SET_GAMMARAMP,
|
||||
) -> NTSTATUS {
|
||||
STATUS_SUCCESS
|
||||
}
|
||||
|
||||
/// A swap-chain was assigned to the monitor. STEP 5: spawn the `SwapChainProcessor`.
|
||||
pub unsafe extern "C" fn assign_swap_chain(
|
||||
_monitor: iddcx::IDDCX_MONITOR,
|
||||
_p_in: *const iddcx::IDARG_IN_SETSWAPCHAIN,
|
||||
) -> NTSTATUS {
|
||||
STATUS_SUCCESS
|
||||
}
|
||||
|
||||
/// The monitor went inactive. STEP 5: drop the processor (RAII joins the worker thread).
|
||||
pub unsafe extern "C" fn unassign_swap_chain(_monitor: iddcx::IDDCX_MONITOR) -> NTSTATUS {
|
||||
STATUS_SUCCESS
|
||||
}
|
||||
|
||||
/// The pf-vdisplay-proto control plane. Returns `()` and completes the request itself (matches the C
|
||||
/// `EVT_IDD_CX_DEVICE_IO_CONTROL` shape). STEP 4: dispatch the proto IOCTLs; for now just complete.
|
||||
pub unsafe extern "C" fn device_io_control(
|
||||
_device: WDFDEVICE,
|
||||
request: WDFREQUEST,
|
||||
_output_len: usize,
|
||||
_input_len: usize,
|
||||
_ioctl_code: u32,
|
||||
) {
|
||||
// SAFETY: `request` is the framework-provided WDFREQUEST; completing it hands it back to the OS.
|
||||
unsafe {
|
||||
call_unsafe_wdf_function_binding!(WdfRequestComplete, request, STATUS_SUCCESS);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user