From c63ac48c9c28670da4d378a745f2faeb5e183c94 Mon Sep 17 00:00:00 2001 From: enricobuehler Date: Wed, 22 Jul 2026 14:52:57 +0200 Subject: [PATCH] =?UTF-8?q?fix(windows/capture):=20actually=20QUERY=20the?= =?UTF-8?q?=20HDR=20SDR-white=20scale=20=E2=80=94=20the=20refresh=20block?= =?UTF-8?q?=20was=20silently=20dropped?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit faad4b57 shipped the field, shader scale, and plumbing but the scripted edit inserting the sdr_white_level_scale() refresh in the scratch-rebuild arm matched nothing and silently no-op'd (no assert) — sdr_white_scale stayed at its 1.0 init, i.e. 80 nits, i.e. exactly the old dark cursor. Now queried on every scratch rebuild, with an info log of queried/applied so an HDR session shows what it uses. Co-Authored-By: Claude Opus 4.8 (1M context) --- crates/pf-capture/src/windows/idd_push.rs | 22 +++++++++++++++++++++- 1 file changed, 21 insertions(+), 1 deletion(-) diff --git a/crates/pf-capture/src/windows/idd_push.rs b/crates/pf-capture/src/windows/idd_push.rs index 8de80498..cd35fd85 100644 --- a/crates/pf-capture/src/windows/idd_push.rs +++ b/crates/pf-capture/src/windows/idd_push.rs @@ -1791,7 +1791,27 @@ impl IddPushCapturer { .map(|v| (t, v)) }); match built { - Some((t, v)) => self.blend_scratch = Some((t, v, self.width, self.height, fmt)), + Some((t, v)) => { + self.blend_scratch = Some((t, v, self.width, self.height, fmt)); + if self.display_hdr { + // Where DWM places SDR white on this HDR desktop — the composited + // cursor must match or it reads dark (~2.5x at the Windows default). + // Queried only here: scratch rebuilds are rare, and the CCD query + // contends on the display-config lock, which must stay OFF the + // per-frame path. + // Safety: read-only CCD query over owned locals (within unsafe fn). + let queried = + pf_win_display::win_display::sdr_white_level_scale(self.target_id); + self.sdr_white_scale = queried.unwrap_or(self.sdr_white_scale); + tracing::info!( + target_id = self.target_id, + queried = ?queried, + applied = self.sdr_white_scale, + "cursor composite: HDR SDR-white scale (1.0 = 80 nits; None = \ + query failed — keeping the prior value)" + ); + } + } None => { if !self.cursor_blend_failed { self.cursor_blend_failed = true;