feat(graphics): migrate native target to 640x360
Intrepid/Prometeu/Runtime/pipeline/head This commit looks good
Intrepid/Prometeu/Runtime/pipeline/head This commit looks good
Centralize the fixed 640x360 RGBA8888/60 Hz contract in the existing HAL. Preserve 8/16/32 tiles and composition, cover partial edges and mixed-size camera movement, and adapt firmware, fixtures, hosts and native tests. Share nearest-neighbor presentation geometry with pointer input. Measure actual framebuffer publications and successful host presentations separately from VM ticks, with bounded opt-in diagnostics and release harnesses. Validated with the complete tooling verify gate, native rendering tests, GPU readback, headless/process integration, formatting and strict clippy. The existing synchronous session path is documented; no worker/session architecture replacement or format compatibility layer is introduced. Work: WRK-0016 / DEC-0001 / PLN-0001 Commit and push explicitly authorized by the user after completion.
This commit is contained in:
@@ -0,0 +1,56 @@
|
||||
//! Unpaced logical-frame and capture timing through the real headless host.
|
||||
use prometeu_host_headless::{AdvanceFrameOutcome, HeadlessHost};
|
||||
use std::time::Instant;
|
||||
|
||||
fn stats(mut times: Vec<u64>) -> serde_json::Value {
|
||||
times.sort_unstable();
|
||||
let n = times.len();
|
||||
serde_json::json!({"mean_us":times.iter().sum::<u64>() as f64/n as f64/1000.0,
|
||||
"p95_us":times[(n*95).div_ceil(100)-1] as f64/1000.0,
|
||||
"p99_us":times[(n*99).div_ceil(100)-1] as f64/1000.0,
|
||||
"max_us":times[n-1] as f64/1000.0,
|
||||
"over_60hz_budget":times.iter().filter(|&&t|t>1_000_000_000/60).count()})
|
||||
}
|
||||
fn main() {
|
||||
let mut args = std::env::args().skip(1);
|
||||
let cartridge = args.next().expect("cartridge directory");
|
||||
let count: usize = args.next().map(|s| s.parse().expect("frame count")).unwrap_or(600);
|
||||
assert!(count > 0);
|
||||
let mut host = HeadlessHost::new();
|
||||
host.boot(cartridge).expect("boot");
|
||||
let mut advance = Vec::with_capacity(count);
|
||||
let mut capture = Vec::with_capacity(count);
|
||||
let mut previous = None;
|
||||
let mut published = 0;
|
||||
let mut checksum = 0;
|
||||
for i in 0..count + 120 {
|
||||
let start = Instant::now();
|
||||
assert!(matches!(
|
||||
host.advance_frame().expect("advance"),
|
||||
AdvanceFrameOutcome::FrameCompleted { .. }
|
||||
));
|
||||
let elapsed = start.elapsed().as_nanos() as u64;
|
||||
let start = Instant::now();
|
||||
let frame = host.capture_frame().expect("published frame").frame;
|
||||
let capture_ns = start.elapsed().as_nanos() as u64;
|
||||
assert_eq!((frame.width, frame.height, frame.stride_pixels), (640, 360, 640));
|
||||
assert_ne!(previous, Some((frame.ownership, frame.frame_id)));
|
||||
previous = Some((frame.ownership, frame.frame_id));
|
||||
checksum ^= frame.pixels[(i * 173) % frame.pixels.len()];
|
||||
if i >= 120 {
|
||||
advance.push(elapsed);
|
||||
capture.push(capture_ns);
|
||||
published += 1;
|
||||
}
|
||||
}
|
||||
let state = host.get_state();
|
||||
println!(
|
||||
"{}",
|
||||
serde_json::json!({"schema":1,"width":640,"height":360,"frames":count,"warmup_frames":120,
|
||||
"completed_logical_frames_total":state.frame_index,"host_ticks_total":state.tick_index,
|
||||
"published_frames_measured":published,"repeated_publications_measured":0,
|
||||
"advance_including_vm_render_publish":stats(advance),"owned_capture":stats(capture),"checksum":checksum,
|
||||
"vm_hz":null,"physical_display_hz":null,
|
||||
"limitations":"unpaced real VM/headless; capture copies owned pixels; no GPU, realtime cadence or physical display"})
|
||||
);
|
||||
}
|
||||
@@ -171,7 +171,7 @@ fn one_frame_returns_and_captures_the_exact_published_frame() {
|
||||
assert_eq!(captured.frame.ownership.app_mode, AppMode::Game);
|
||||
assert_eq!(captured.frame.ownership.app_id, 41);
|
||||
assert_eq!(captured.frame.stride_pixels, captured.frame.width);
|
||||
assert_eq!(captured.frame.pixels.len(), 480 * 270);
|
||||
assert_eq!(captured.frame.pixels.len(), 640 * 360);
|
||||
assert_eq!(host.capture_frame().expect("repeat capture"), captured);
|
||||
|
||||
let mut mutated_clone = captured.clone();
|
||||
@@ -477,8 +477,8 @@ fn assert_completed(outcome: prometeu_host_headless::AdvanceFramesOutcome, expec
|
||||
}
|
||||
|
||||
fn assert_color(captured: &CapturedFrame, color: u32) {
|
||||
assert_eq!(captured.frame.width, 480);
|
||||
assert_eq!(captured.frame.height, 270);
|
||||
assert_eq!(captured.frame.width, 640);
|
||||
assert_eq!(captured.frame.height, 360);
|
||||
assert!(captured.frame.pixels.iter().all(|pixel| *pixel == color));
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user