From da134ad045412c538758b9a266e364c4a38165fa Mon Sep 17 00:00:00 2001 From: enricobuehler Date: Tue, 21 Jul 2026 12:43:51 +0200 Subject: [PATCH] feat(presenter): PUNKTFUNK_HDR10=0 refuses the HDR10 swapchain (SDR tonemap pin) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit GNOME 48 / Plasma 6 with Mesa >= 25.1 now offer HDR10_ST2084 surfaces even on SDR desktops, silently flipping PQ streams into the mode-0 passthrough lane — previously unreachable on desktop compositors and never validated there. The hatch pins the shader tonemap for diagnosis and as the field escape. Co-Authored-By: Claude Fable 5 --- crates/pf-presenter/src/vk/setup.rs | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/crates/pf-presenter/src/vk/setup.rs b/crates/pf-presenter/src/vk/setup.rs index 487b62f3..32adea7c 100644 --- a/crates/pf-presenter/src/vk/setup.rs +++ b/crates/pf-presenter/src/vk/setup.rs @@ -617,6 +617,15 @@ pub(super) fn pick_formats( surface: vk::SurfaceKHR, colorspace_ext: bool, ) -> Result<(vk::SurfaceFormatKHR, Option)> { + // `PUNKTFUNK_HDR10=0` (explicit-off grammar) refuses the HDR10/ST.2084 swapchain outright, + // pinning PQ streams to the shader tonemap on an SDR surface. Two reasons this exists: + // desktop compositors newly offer HDR10 even on SDR desktops (GNOME 48 / Plasma 6 with + // Mesa ≥ 25.1 — a lane that otherwise engages silently), and it is the A/B lever that + // splits "HDR10 passthrough composes wrong" from "the decoded planes are wrong" in the + // field without rebuilding anything. + let colorspace_ext = colorspace_ext + && !std::env::var("PUNKTFUNK_HDR10") + .is_ok_and(|v| matches!(v.as_str(), "0" | "false" | "off" | "no")); let formats = unsafe { surface_i.get_physical_device_surface_formats(pdev, surface) }?; let mut sdr = None; for want in [vk::Format::B8G8R8A8_UNORM, vk::Format::R8G8B8A8_UNORM] {