From 1421e235f22b96dca783fa88e0445fa0ccf93447 Mon Sep 17 00:00:00 2001 From: enricobuehler Date: Sun, 26 Jul 2026 12:12:20 +0200 Subject: [PATCH] fix(host): hdr-p010-selftest silently ignored its size argument MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit `args` starts AT the subcommand (main builds it with `env::args().skip(1)`), so a subcommand's own optional arguments begin at index 1 — cf. `args.get(1)` in the `service` arm. This arm read `skip(2)`, swallowing the first optional argument. The documented invocation `hdr-p010-selftest 1920x1080 nvidia` therefore picked up the vendor (it is in the second slot) and ran at the 64x64 DEFAULT. A size-only `hdr-p010-selftest 1920x1080` parsed nothing whatsoever and still printed PASS. Nothing warned, because an unrecognised token is the only thing that errors and no token was ever inspected. The size is the entire point of the flag: the arm's own comment says heights like 1080 are not 16-aligned and exercise a different driver path. So the self-test has only ever validated the one geometry that exercises the least, and the sweep's W7 gate — 1920x1080 and 5120x2880 on the RTX box — could not actually run as written. Found by running that gate: both sizes printed "HDR P010 self-test (64x64 ...)" with byte-identical plane layouts (row_pitch=128, expected_total=12288 — those are 64x64's). Co-Authored-By: Claude Opus 5 (1M context) --- crates/punktfunk-host/src/main.rs | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/crates/punktfunk-host/src/main.rs b/crates/punktfunk-host/src/main.rs index f7f877ff..9d77827f 100644 --- a/crates/punktfunk-host/src/main.rs +++ b/crates/punktfunk-host/src/main.rs @@ -338,7 +338,15 @@ fn real_main() -> Result<()> { // adapter, which may not be the one that encodes). let mut size = (64u32, 64u32); let mut vendor = None; - for a in args.iter().skip(2) { + // `args` starts AT the subcommand (main builds it with `env::args().skip(1)`), so the + // optional arguments begin at index 1 — cf. `args.get(1)` in the `service` arm. This + // read `skip(2)` and so silently swallowed the first optional argument: the documented + // `hdr-p010-selftest 1920x1080 nvidia` picked up the vendor but ran at the 64x64 + // DEFAULT, and a size-only invocation parsed nothing at all and still printed PASS. + // The size is the whole point of the flag — 1080 is not 16-aligned and takes a + // different driver path — so the self-test was passing on the one geometry that + // exercises the least. + for a in args.iter().skip(1) { match a.as_str() { "intel" => vendor = Some(0x8086), "nvidia" => vendor = Some(0x10de),