From 81510b3d8a215134dfee08efdb06832b8bc9e87f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ahmet=20Kaan=20G=C3=BCm=C3=BC=C5=9F?= Date: Thu, 13 Aug 2026 08:12:56 +0300 Subject: [PATCH] =?UTF-8?q?=E2=9C=85=20test(export):=20the=20card's=20seat?= =?UTF-8?q?=20is=20the=20export's=20seat=20at=20every=20size=20and=20pin?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The plugin took the HEVC seat as of the GPU HEVC landing, and the sweep that pinned card against job still asserted the software intra encoder by name -- so the one test guarding "what the card says is what the job opens" failed on a machine where the card was telling the truth. The claim it was making is kept; the seat it hardcoded is not. Beside it, the same pin swept over the two things that move the seat under a user's hand: the project size (320x180, 720p, 1080p -- the plugin refuses HEVC under the driver's 384x384 floor, and both containers fall to the software intra encoder there) and the software pin, over every picture format. Thirty jobs, each started and cancelled at the encoder line it published, each compared against what `planned_video` promised the card. The hardware AV1 seat stays out of it: opening that one hung this box's GPU, which is `av1.rs`'s ignored test and not a sweep's business. --- crates/engine/tests/backends.rs | 81 +++++++++++++++++++++++++++++++-- 1 file changed, 76 insertions(+), 5 deletions(-) diff --git a/crates/engine/tests/backends.rs b/crates/engine/tests/backends.rs index 8547d6d..0e1e513 100644 --- a/crates/engine/tests/backends.rs +++ b/crates/engine/tests/backends.rs @@ -104,9 +104,9 @@ fn the_planned_encoders_are_the_ones_the_job_opens() { (Format::Mp4, "mp4"), (Format::Av1, "mkv"), (Format::Av1Mp4, "mp4"), - // Both HEVC containers, whose seat is software whatever the box has: - // the plugin encodes H.264 and AV1 and no HEVC, so a card that offered - // a hardware seat here would be promising one that cannot exist. + // Both HEVC containers, whose seat is the plugin's where the picture + // clears the driver's floor and the software intra encoder where it does + // not -- which of the two is this box's business and never this test's. (Format::Hevc, "mkv"), (Format::HevcMp4, "mp4"), ] { @@ -150,13 +150,84 @@ fn the_planned_encoders_are_the_ones_the_job_opens() { assert!(planned.contains("AAC"), "{ext}: {planned}"); if matches!(format, Format::Hevc | Format::HevcMp4) { assert!( - planned.contains("oxideav-h265 intra"), - "{ext}: an HEVC job names the intra encoder that writes it: {planned}" + planned.contains("oxideav-h265 intra") || planned.contains("HW encode"), + "{ext}: an HEVC job names one of the two HEVC seats: {planned}" ); } } } +/// The same pin, swept over the two things that *move* the seat under a user's +/// hand: the picture size (the plugin refuses HEVC below the driver's 384x384 +/// floor and the software intra encoder takes the file) and the software pin on +/// the card. The export card reads [`engine::export::planned_video`] for every +/// one of these combinations, so a size that flips the seat and a card that kept +/// the old line is the exact lie this sweep exists to catch. +/// +/// Not swept: the hardware AV1 seat. It is `VE_HW_AV1=1` opt-in because opening +/// it hung this box's GPU into a driver reset (2026-08-10), and a test suite is +/// not the place to find out whether that is fixed -- `av1.rs` keeps that one +/// `#[ignore]`d and by name. +#[test] +fn the_planned_seat_follows_the_size_and_the_pin() { + for (format, ext) in [ + (Format::Mp4, "mp4"), + (Format::Av1, "mkv"), + (Format::Av1Mp4, "mp4"), + (Format::Hevc, "mkv"), + (Format::HevcMp4, "mp4"), + ] { + for (width, height) in [(320, 180), (1280, 720), (1920, 1080)] { + for force_sw in [false, true] { + let settings = ExportSettings { + format, + force_sw, + ..ExportSettings::default() + }; + let mut session = + PlaybackSession::open(asset("test_av.mp4")).expect("open the fixture"); + // The project resolution is what an export writes, so this is + // the very size the card's probe is asked about. + session.set_resolution(width, height); + let planned = engine::export::planned_video(session.meta(), &settings) + .expect("these formats carry picture"); + // A pinned job is software by definition, whatever the machine + // has -- the one seat this file may assert outright. + if force_sw { + assert!( + planned.starts_with("SW encode"), + "{ext} {width}x{height}: a pinned job is software, got {planned}" + ); + } + let out = out_path("seat", ext); + let handle = session.export_to_with(&out, &settings); + let started = Instant::now(); + let opened = loop { + if let Some(line) = handle.encoders() { + break line; + } + assert!( + !handle.is_finished(), + "{ext} {width}x{height}: settled before an encoder opened: {:?}", + handle.result().map(|r| r.err()) + ); + assert!( + started.elapsed() < Duration::from_secs(60), + "no encoder was published" + ); + std::thread::sleep(Duration::from_millis(10)); + }; + handle.cancel(); + wind_down(&handle); + assert!( + opened.starts_with(planned), + "{ext} {width}x{height} force_sw={force_sw}: the card said {planned}, the job opened {opened}" + ); + } + } + } +} + /// A WAV job has no picture at all and still names what writes it, so an audio /// export is not a progress line with nothing to say. #[test]