From 11974152167762f60cc564c34750919111a95ba2 Mon Sep 17 00:00:00 2001 From: enricobuehler Date: Fri, 17 Jul 2026 16:11:34 +0200 Subject: [PATCH] fix(pf-vdisplay,pf-win-display): v4 trait surface on the extracted driver.rs + cross-crate visibility MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The W-refactor extracted VdisplayDriver into manager/driver.rs (the merge resolution assumed it deleted) — carry the v4 changes there: open() returns the driver's protocol version, update_modes() default-errs to the re-arrival fallback. wait_target_departed goes pub for the manager's cross-crate call. Co-Authored-By: Claude Opus 4.8 (1M context) --- .../src/vdisplay/windows/manager/driver.rs | 16 ++++++++++++++-- crates/pf-win-display/src/win_display.rs | 2 +- 2 files changed, 15 insertions(+), 3 deletions(-) diff --git a/crates/pf-vdisplay/src/vdisplay/windows/manager/driver.rs b/crates/pf-vdisplay/src/vdisplay/windows/manager/driver.rs index 9d208ef6..ccc8f40d 100644 --- a/crates/pf-vdisplay/src/vdisplay/windows/manager/driver.rs +++ b/crates/pf-vdisplay/src/vdisplay/windows/manager/driver.rs @@ -34,11 +34,12 @@ pub(crate) trait VdisplayDriver: Send + Sync { /// timeout. `reap_orphans` (the FIRST open of the process only) additionally `CLEAR_ALL`s /// monitors orphaned by a crashed previous host — a REOPEN (after a dead handle was retired) /// must NOT, since sessions this process still considers live may be racing it. Returns the - /// owned handle + watchdog seconds. + /// owned handle + watchdog seconds + the driver's reported protocol version (the in-place + /// resize gates on it). /// /// # Safety /// Issues setup-API + `DeviceIoControl` calls; runs in the caller's apartment. - unsafe fn open(&self, reap_orphans: bool) -> Result<(OwnedHandle, u32)>; + unsafe fn open(&self, reap_orphans: bool) -> Result<(OwnedHandle, u32, u32)>; /// ADD a virtual monitor at `mode`, pinning the IDD render GPU to `render_luid` first if `Some`, and /// requesting `preferred_monitor_id` (the host's per-client stable id; `0` = auto). `client_hdr` /// is the CLIENT display's HDR volume for the monitor's EDID CTA HDR block (`None` = the @@ -56,6 +57,17 @@ pub(crate) trait VdisplayDriver: Send + Sync { preferred_monitor_id: u32, client_hdr: Option, ) -> Result; + /// Refresh the LIVE monitor `key`'s advertised mode list to lead with `mode` (the in-place + /// mid-stream resize, latency plan P2 — pf-vdisplay `IOCTL_UPDATE_MODES`, driver protocol v4). + /// The monitor is NOT departed; the caller CCD-forces the freshly-advertised mode afterwards. + /// The default errs so a backend without support routes to the re-arrival fallback. + /// + /// # Safety + /// `dev` must be the live control handle. + unsafe fn update_modes(&self, dev: HANDLE, key: &MonitorKey, mode: Mode) -> Result<()> { + let _ = (dev, key, mode); + anyhow::bail!("backend does not support in-place mode updates") + } /// REMOVE the monitor identified by `key`. /// /// # Safety diff --git a/crates/pf-win-display/src/win_display.rs b/crates/pf-win-display/src/win_display.rs index e2b6fac7..523477cd 100644 --- a/crates/pf-win-display/src/win_display.rs +++ b/crates/pf-win-display/src/win_display.rs @@ -375,7 +375,7 @@ pub(crate) fn wait_mode_advertised( /// /// # Safety /// Runs the CCD query FFI; call under the manager `state` lock like the callers it serves. -pub(crate) unsafe fn wait_target_departed(target_id: u32, ceiling: std::time::Duration) -> bool { +pub unsafe fn wait_target_departed(target_id: u32, ceiling: std::time::Duration) -> bool { let deadline = std::time::Instant::now() + ceiling; let mut absent_streak = 0u32; loop {