From d55cde61d3cbc3ad16cc6ac318be00494e0adf23 Mon Sep 17 00:00:00 2001 From: enricobuehler Date: Fri, 10 Jul 2026 17:11:27 +0200 Subject: [PATCH] =?UTF-8?q?style:=20cargo=20fmt=20=E2=80=94=20settle=20the?= =?UTF-8?q?=20CSC/tvOS=20changes'=20layout=20(CI=20Format=20gate)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Formatting only, no code change: the signaled-CSC and tvOS commits (1fcf9e11, 3ba19f28) left six files unformatted and the rust job's Format step rejects main. cargo fmt --all --check is clean after this. Co-Authored-By: Claude Fable 5 --- clients/windows/src/present.rs | 8 ++++++- crates/pf-presenter/src/csc.rs | 1 - crates/punktfunk-host/src/encode/linux/mod.rs | 4 ++-- crates/punktfunk-host/src/encode/sw.rs | 6 ++++- .../src/encode/windows/nvenc.rs | 24 +++++++++++-------- crates/punktfunk-host/src/gamestream/rtsp.rs | 13 ++++++++-- 6 files changed, 39 insertions(+), 17 deletions(-) diff --git a/clients/windows/src/present.rs b/clients/windows/src/present.rs index e843df50..5f5e55f1 100644 --- a/clients/windows/src/present.rs +++ b/clients/windows/src/present.rs @@ -492,7 +492,13 @@ impl Presenter { unsafe { let mut mapped = D3D11_MAPPED_SUBRESOURCE::default(); self.context - .Map(&self.csc_buf, 0, D3D11_MAP_WRITE_DISCARD, 0, Some(&mut mapped)) + .Map( + &self.csc_buf, + 0, + D3D11_MAP_WRITE_DISCARD, + 0, + Some(&mut mapped), + ) .context("Map CSC constant buffer")?; std::ptr::copy_nonoverlapping( rows.as_ptr() as *const u8, diff --git a/crates/pf-presenter/src/csc.rs b/crates/pf-presenter/src/csc.rs index 8c6f2de9..adcb15ef 100644 --- a/crates/pf-presenter/src/csc.rs +++ b/crates/pf-presenter/src/csc.rs @@ -292,4 +292,3 @@ pub(crate) fn build_fullscreen_pipeline( } Ok(pipeline?[0]) } - diff --git a/crates/punktfunk-host/src/encode/linux/mod.rs b/crates/punktfunk-host/src/encode/linux/mod.rs index 34a7c960..53c5e2bb 100644 --- a/crates/punktfunk-host/src/encode/linux/mod.rs +++ b/crates/punktfunk-host/src/encode/linux/mod.rs @@ -337,8 +337,8 @@ impl NvencEncoder { // text/UI chroma 4:4:4 exists for. Every punktfunk client honors the signaled range // (csc_rows / the Apple rows port); ship as default only if the on-glass A/B shows a // visible win. Linux-only: the Windows path's NVENC-internal CSC range is unmeasured. - let full_range_444 = want_444 - && std::env::var("PUNKTFUNK_444_FULLRANGE").is_ok_and(|v| v.trim() == "1"); + let full_range_444 = + want_444 && std::env::var("PUNKTFUNK_444_FULLRANGE").is_ok_and(|v| v.trim() == "1"); if matches!(format, PixelFormat::Nv12) || want_444 { // SAFETY: same `video` builder — `raw = video.as_mut_ptr()` is the non-null, properly- // aligned, sole-owned, not-yet-opened `AVCodecContext`. We set its four VUI colour enum diff --git a/crates/punktfunk-host/src/encode/sw.rs b/crates/punktfunk-host/src/encode/sw.rs index 23daa1d8..c5db79e1 100644 --- a/crates/punktfunk-host/src/encode/sw.rs +++ b/crates/punktfunk-host/src/encode/sw.rs @@ -290,7 +290,11 @@ mod tests { let bytes = vec![0x80u8; (w * h * 4) as usize]; enc.convert_bt709(&bytes, 4, 2, 1, 0); // 16 + 128·(219/255) = 125.9 → 126. - assert!(enc.y_plane.iter().all(|&y| y == 126), "{:?}", &enc.y_plane[..4]); + assert!( + enc.y_plane.iter().all(|&y| y == 126), + "{:?}", + &enc.y_plane[..4] + ); assert!(enc.u_plane.iter().all(|&u| u == 128)); assert!(enc.v_plane.iter().all(|&v| v == 128)); } diff --git a/crates/punktfunk-host/src/encode/windows/nvenc.rs b/crates/punktfunk-host/src/encode/windows/nvenc.rs index 6f2343bb..a1c251b9 100644 --- a/crates/punktfunk-host/src/encode/windows/nvenc.rs +++ b/crates/punktfunk-host/src/encode/windows/nvenc.rs @@ -1611,12 +1611,9 @@ mod tests { use super::*; use crate::capture::{dxgi::D3d11Frame, CapturedFrame, FramePayload}; use windows::Win32::Graphics::Direct3D11::{ - D3D11_BIND_RENDER_TARGET, D3D11_SUBRESOURCE_DATA, D3D11_TEXTURE2D_DESC, - D3D11_USAGE_DEFAULT, - }; - use windows::Win32::Graphics::Dxgi::Common::{ - DXGI_FORMAT_B8G8R8A8_UNORM, DXGI_SAMPLE_DESC, + D3D11_BIND_RENDER_TARGET, D3D11_SUBRESOURCE_DATA, D3D11_TEXTURE2D_DESC, D3D11_USAGE_DEFAULT, }; + use windows::Win32::Graphics::Dxgi::Common::{DXGI_FORMAT_B8G8R8A8_UNORM, DXGI_SAMPLE_DESC}; use windows::Win32::Graphics::Dxgi::{ CreateDXGIFactory1, IDXGIFactory1, DXGI_ADAPTER_FLAG_SOFTWARE, }; @@ -1670,7 +1667,9 @@ mod tests { let factory: IDXGIFactory1 = CreateDXGIFactory1().expect("DXGI factory"); let mut adapter = None; for i in 0.. { - let Ok(a) = factory.EnumAdapters1(i) else { break }; + let Ok(a) = factory.EnumAdapters1(i) else { + break; + }; let desc = a.GetDesc1().expect("adapter desc"); if desc.Flags & DXGI_ADAPTER_FLAG_SOFTWARE.0 as u32 == 0 { adapter = Some(a); @@ -1678,8 +1677,7 @@ mod tests { } } let adapter = adapter.expect("no hardware DXGI adapter"); - let (device, _ctx) = - crate::capture::dxgi::make_device(&adapter).expect("make_device"); + let (device, _ctx) = crate::capture::dxgi::make_device(&adapter).expect("make_device"); let bytes = probe_pattern(W as usize, H as usize); let init = D3D11_SUBRESOURCE_DATA { @@ -1760,7 +1758,13 @@ mod tests { #[test] #[ignore = "requires an NVIDIA GPU + driver — run manually on the RTX box"] fn nvenc_444_on_glass_probe() { - encode_pattern(ChromaFormat::Yuv444, "C:\\Users\\Public\\nvenc444_probe.h265"); - encode_pattern(ChromaFormat::Yuv420, "C:\\Users\\Public\\nvenc420_probe.h265"); + encode_pattern( + ChromaFormat::Yuv444, + "C:\\Users\\Public\\nvenc444_probe.h265", + ); + encode_pattern( + ChromaFormat::Yuv420, + "C:\\Users\\Public\\nvenc420_probe.h265", + ); } } diff --git a/crates/punktfunk-host/src/gamestream/rtsp.rs b/crates/punktfunk-host/src/gamestream/rtsp.rs index 490c3df8..d0ec589d 100644 --- a/crates/punktfunk-host/src/gamestream/rtsp.rs +++ b/crates/punktfunk-host/src/gamestream/rtsp.rs @@ -397,10 +397,19 @@ fn stream_config(map: &HashMap) -> Option { }, if csc & 1 != 0 { "full" } else { "limited" }, ); - let ours = if hdr { "Rec2020 limited (PQ)" } else { "Rec709 limited" }; + let ours = if hdr { + "Rec2020 limited (PQ)" + } else { + "Rec709 limited" + }; let matches_ours = (hdr && csc >> 1 == 2 || !hdr && csc >> 1 == 1) && csc & 1 == 0; if matches_ours { - tracing::info!(csc, space, range, "GameStream client requested CSC — matches ours"); + tracing::info!( + csc, + space, + range, + "GameStream client requested CSC — matches ours" + ); } else { tracing::warn!( csc,