fix(host/windows): WGC relay — set SudoVDA color to match session bit depth at build (kill persisted HDR)
Re-test still broken: the WGC helper captured HDR FP16 BT.2020 PQ from the FIRST frame (before any switch), feeding the 8-bit SDR encoder → broken normal-desktop image. Root cause: the SudoVDA's advanced-color (HDR) state PERSISTS on the monitor across sessions, so the 8-bit session inherited HDR left enabled by the earlier broken toggle — and gating the per-switch toggles can't undo a state that's already on at start. Fix: in build() (runs on initial create + every mode-switch/return-from-secure rebuild), force set_advanced_color(target, bit_depth>=10) BEFORE spawning the WGC helper, with a 250ms settle if it changed. An 8-bit session now always captures SDR via WGC (matching the encoder); 10-bit keeps HDR. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
@@ -2344,6 +2344,20 @@ fn virtual_stream_relay(
|
||||
let target = vout.win_capture.clone().ok_or_else(|| {
|
||||
anyhow!("SudoVDA target not yet an active display (needs a WDDM GPU to activate it)")
|
||||
})?;
|
||||
// Force the SudoVDA's advanced-color (HDR) state to MATCH the session bit depth BEFORE the WGC
|
||||
// helper captures it. The advanced-color state PERSISTS on the monitor across sessions, so an
|
||||
// 8-bit (SDR) session could otherwise inherit HDR left on by a prior 10-bit run (or our own
|
||||
// earlier toggle) → the helper captures HDR FP16 while the encoder is 8-bit SDR → broken image.
|
||||
// Runs on every build (initial + mode-switch + return-from-secure rebuild), keeping WGC's format
|
||||
// consistent with the encoder. (HDR independent-flip on the secure desktop is handled separately
|
||||
// by dropping to SDR for the DDA leg.)
|
||||
#[cfg(target_os = "windows")]
|
||||
unsafe {
|
||||
if crate::vdisplay::sudovda::set_advanced_color(target.target_id, bit_depth >= 10) {
|
||||
// Let the colorspace change settle before WGC creates its capture item / detects HDR.
|
||||
std::thread::sleep(std::time::Duration::from_millis(250));
|
||||
}
|
||||
}
|
||||
let relay = HelperRelay::spawn(
|
||||
&target,
|
||||
(mode.width, mode.height, effective_hz),
|
||||
|
||||
Reference in New Issue
Block a user