From c8ee4b99023bd99592c5e476eba5461fc7f3b7ca Mon Sep 17 00:00:00 2001 From: enricobuehler Date: Fri, 17 Jul 2026 16:13:15 +0200 Subject: [PATCH] fix(pf-vdisplay,pf-capture,pf-win-display): pre-split paths in the auto-merged v4 code MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The rename-followed perf hunks still said crate::win_display:: (the pre-W6 layout) — point them at pf_win_display::win_display:: and widen the four helpers they call cross-crate. Co-Authored-By: Claude Opus 4.8 (1M context) --- crates/pf-capture/src/windows/idd_push.rs | 4 +++- .../pf-vdisplay/src/vdisplay/windows/manager.rs | 12 ++++++++---- crates/pf-win-display/src/win_display.rs | 16 ++++------------ 3 files changed, 15 insertions(+), 17 deletions(-) diff --git a/crates/pf-capture/src/windows/idd_push.rs b/crates/pf-capture/src/windows/idd_push.rs index f4f57452..6626fcc6 100644 --- a/crates/pf-capture/src/windows/idd_push.rs +++ b/crates/pf-capture/src/windows/idd_push.rs @@ -706,7 +706,9 @@ impl IddPushCapturer { // stash/format-guard machinery absorbs). let hdr_settle = Instant::now(); while hdr_settle.elapsed() < Duration::from_millis(250) { - if crate::win_display::advanced_color_enabled(target.target_id) == Some(true) { + if pf_win_display::win_display::advanced_color_enabled(target.target_id) + == Some(true) + { break; } std::thread::sleep(Duration::from_millis(25)); diff --git a/crates/pf-vdisplay/src/vdisplay/windows/manager.rs b/crates/pf-vdisplay/src/vdisplay/windows/manager.rs index 9fdeaeac..bc62ac21 100644 --- a/crates/pf-vdisplay/src/vdisplay/windows/manager.rs +++ b/crates/pf-vdisplay/src/vdisplay/windows/manager.rs @@ -1085,7 +1085,7 @@ impl VirtualDisplayManager { // FAST PATH (driver-independent): the OS already offers this resolution — the monitor's // arrival list, which since the driver's mode-history union contains every size this // identity ever served — so a plain CCD mode set reaches it with no driver round-trip. - let already = crate::win_display::wait_mode_advertised(&gdi, mode, Duration::ZERO); + let already = pf_win_display::win_display::wait_mode_advertised(&gdi, mode, Duration::ZERO); if !already { // Out-of-arrival-list mode. On-glass (build 26200) the OS re-parses our description // AND re-queries target modes after UpdateModes2 — our callbacks served the fresh @@ -1124,8 +1124,12 @@ impl VirtualDisplayManager { // forwards it to a synchronous IOCTL with owned/borrowed locals only. unsafe { self.driver.update_modes(dev, &mon.key, mode) }?; // SAFETY: CCD query/apply FFI under the held `state` lock (this fn's contract). - unsafe { crate::win_display::force_mode_reenumeration() }; - if !crate::win_display::wait_mode_advertised(&gdi, mode, Duration::from_millis(800)) { + unsafe { pf_win_display::win_display::force_mode_reenumeration() }; + if !pf_win_display::win_display::wait_mode_advertised( + &gdi, + mode, + Duration::from_millis(800), + ) { self.update_modes_futile.store(true, Ordering::Relaxed); anyhow::bail!( "OS did not advertise {}x{} within {}ms of the driver mode-list update \ @@ -1133,7 +1137,7 @@ impl VirtualDisplayManager { mode.width, mode.height, t0.elapsed().as_millis(), - crate::win_display::advertised_resolutions(&gdi) + pf_win_display::win_display::advertised_resolutions(&gdi) ); } } diff --git a/crates/pf-win-display/src/win_display.rs b/crates/pf-win-display/src/win_display.rs index 523477cd..39b44174 100644 --- a/crates/pf-win-display/src/win_display.rs +++ b/crates/pf-win-display/src/win_display.rs @@ -243,11 +243,7 @@ pub unsafe fn active_resolution(target_id: u32) -> Option<(u32, u32)> { /// /// # Safety /// Runs the CCD/GDI query FFI; call under the manager `state` lock like the callers it serves. -pub(crate) unsafe fn wait_mode_settled( - target_id: u32, - mode: Mode, - ceiling: std::time::Duration, -) -> bool { +pub unsafe fn wait_mode_settled(target_id: u32, mode: Mode, ceiling: std::time::Duration) -> bool { let deadline = std::time::Instant::now() + ceiling; loop { // SAFETY (both calls): CCD/GDI FFI over a `Copy` target id, owned returns — the callers' @@ -272,7 +268,7 @@ pub(crate) unsafe fn wait_mode_settled( /// /// # Safety /// Runs the CCD query/apply FFI; call under the manager `state` lock (sole topology mutator). -pub(crate) unsafe fn force_mode_reenumeration() -> bool { +pub unsafe fn force_mode_reenumeration() -> bool { let Some((paths, modes)) = query_active_config() else { return false; }; @@ -292,7 +288,7 @@ pub(crate) unsafe fn force_mode_reenumeration() -> bool { /// The distinct resolutions `gdi_name` currently advertises (diagnostics for the in-place-resize /// path: what the OS actually offers when a requested mode never shows up). -pub(crate) fn advertised_resolutions(gdi_name: &str) -> Vec<(u32, u32)> { +pub fn advertised_resolutions(gdi_name: &str) -> Vec<(u32, u32)> { let wname: Vec = gdi_name.encode_utf16().chain(std::iter::once(0)).collect(); let mut set = std::collections::BTreeSet::new(); let mut i = 0u32; @@ -325,11 +321,7 @@ pub(crate) fn advertised_resolutions(gdi_name: &str) -> Vec<(u32, u32)> { /// CCD/GDI force-set: the OS re-evaluates an indirect display's settable modes asynchronously after /// `IddCxMonitorUpdateModes2`, so an immediate `set_active_mode` could race the re-enumeration and /// silently leave the old mode. Returns `true` once any refresh at the requested WxH is enumerable. -pub(crate) fn wait_mode_advertised( - gdi_name: &str, - mode: Mode, - ceiling: std::time::Duration, -) -> bool { +pub fn wait_mode_advertised(gdi_name: &str, mode: Mode, ceiling: std::time::Duration) -> bool { let wname: Vec = gdi_name.encode_utf16().chain(std::iter::once(0)).collect(); let deadline = std::time::Instant::now() + ceiling; loop {