The card's seat is the export's seat at every size and pin
Browse files at this commit81510b3d8a215134dfee08efdb06832b8bc9e87fParent: 57f6721- test
- the card's seat is the export's seat at every size and pin
1 changed file +76 -5
crates/engine/tests/backends.rsmodified+76 -5
| @@ -104,9 +104,9 @@ fn the_planned_encoders_are_the_ones_the_job_opens() { | ||
| 104 | 104 | (Format::Mp4, "mp4"), |
| 105 | 105 | (Format::Av1, "mkv"), |
| 106 | 106 | (Format::Av1Mp4, "mp4"), |
| 107 | - // Both HEVC containers, whose seat is software whatever the box has: | |
| 108 | - // the plugin encodes H.264 and AV1 and no HEVC, so a card that offered | |
| 109 | - // a hardware seat here would be promising one that cannot exist. | |
| 107 | + // Both HEVC containers, whose seat is the plugin's where the picture | |
| 108 | + // clears the driver's floor and the software intra encoder where it does | |
| 109 | + // not -- which of the two is this box's business and never this test's. | |
| 110 | 110 | (Format::Hevc, "mkv"), |
| 111 | 111 | (Format::HevcMp4, "mp4"), |
| 112 | 112 | ] { |
| @@ -150,13 +150,84 @@ fn the_planned_encoders_are_the_ones_the_job_opens() { | ||
| 150 | 150 | assert!(planned.contains("AAC"), "{ext}: {planned}"); |
| 151 | 151 | if matches!(format, Format::Hevc | Format::HevcMp4) { |
| 152 | 152 | assert!( |
| 153 | - planned.contains("oxideav-h265 intra"), | |
| 154 | - "{ext}: an HEVC job names the intra encoder that writes it: {planned}" | |
| 153 | + planned.contains("oxideav-h265 intra") || planned.contains("HW encode"), | |
| 154 | + "{ext}: an HEVC job names one of the two HEVC seats: {planned}" | |
| 155 | 155 | ); |
| 156 | 156 | } |
| 157 | 157 | } |
| 158 | 158 | } |
| 159 | 159 | |
| 160 | +/// The same pin, swept over the two things that *move* the seat under a user's | |
| 161 | +/// hand: the picture size (the plugin refuses HEVC below the driver's 384x384 | |
| 162 | +/// floor and the software intra encoder takes the file) and the software pin on | |
| 163 | +/// the card. The export card reads [`engine::export::planned_video`] for every | |
| 164 | +/// one of these combinations, so a size that flips the seat and a card that kept | |
| 165 | +/// the old line is the exact lie this sweep exists to catch. | |
| 166 | +/// | |
| 167 | +/// Not swept: the hardware AV1 seat. It is `VE_HW_AV1=1` opt-in because opening | |
| 168 | +/// it hung this box's GPU into a driver reset (2026-08-10), and a test suite is | |
| 169 | +/// not the place to find out whether that is fixed -- `av1.rs` keeps that one | |
| 170 | +/// `#[ignore]`d and by name. | |
| 171 | +#[test] | |
| 172 | +fn the_planned_seat_follows_the_size_and_the_pin() { | |
| 173 | + for (format, ext) in [ | |
| 174 | + (Format::Mp4, "mp4"), | |
| 175 | + (Format::Av1, "mkv"), | |
| 176 | + (Format::Av1Mp4, "mp4"), | |
| 177 | + (Format::Hevc, "mkv"), | |
| 178 | + (Format::HevcMp4, "mp4"), | |
| 179 | + ] { | |
| 180 | + for (width, height) in [(320, 180), (1280, 720), (1920, 1080)] { | |
| 181 | + for force_sw in [false, true] { | |
| 182 | + let settings = ExportSettings { | |
| 183 | + format, | |
| 184 | + force_sw, | |
| 185 | + ..ExportSettings::default() | |
| 186 | + }; | |
| 187 | + let mut session = | |
| 188 | + PlaybackSession::open(asset("test_av.mp4")).expect("open the fixture"); | |
| 189 | + // The project resolution is what an export writes, so this is | |
| 190 | + // the very size the card's probe is asked about. | |
| 191 | + session.set_resolution(width, height); | |
| 192 | + let planned = engine::export::planned_video(session.meta(), &settings) | |
| 193 | + .expect("these formats carry picture"); | |
| 194 | + // A pinned job is software by definition, whatever the machine | |
| 195 | + // has -- the one seat this file may assert outright. | |
| 196 | + if force_sw { | |
| 197 | + assert!( | |
| 198 | + planned.starts_with("SW encode"), | |
| 199 | + "{ext} {width}x{height}: a pinned job is software, got {planned}" | |
| 200 | + ); | |
| 201 | + } | |
| 202 | + let out = out_path("seat", ext); | |
| 203 | + let handle = session.export_to_with(&out, &settings); | |
| 204 | + let started = Instant::now(); | |
| 205 | + let opened = loop { | |
| 206 | + if let Some(line) = handle.encoders() { | |
| 207 | + break line; | |
| 208 | + } | |
| 209 | + assert!( | |
| 210 | + !handle.is_finished(), | |
| 211 | + "{ext} {width}x{height}: settled before an encoder opened: {:?}", | |
| 212 | + handle.result().map(|r| r.err()) | |
| 213 | + ); | |
| 214 | + assert!( | |
| 215 | + started.elapsed() < Duration::from_secs(60), | |
| 216 | + "no encoder was published" | |
| 217 | + ); | |
| 218 | + std::thread::sleep(Duration::from_millis(10)); | |
| 219 | + }; | |
| 220 | + handle.cancel(); | |
| 221 | + wind_down(&handle); | |
| 222 | + assert!( | |
| 223 | + opened.starts_with(planned), | |
| 224 | + "{ext} {width}x{height} force_sw={force_sw}: the card said {planned}, the job opened {opened}" | |
| 225 | + ); | |
| 226 | + } | |
| 227 | + } | |
| 228 | + } | |
| 229 | +} | |
| 230 | + | |
| 160 | 231 | /// A WAV job has no picture at all and still names what writes it, so an audio |
| 161 | 232 | /// export is not a progress line with nothing to say. |
| 162 | 233 | #[test] |