Three root causes, all fixed and verified on the Pixel 9 Pro: 1. Present phase (backend + renderer): VSYNC_LOCKED_RENDER defers the render to the vsync wake; RENDER_AHEAD presents the previous frame at the start of render() (phase = wake + ~1.1 ms) and holds the new frame one slot. Crash fix: a held wgpu frame must be PRESENTED, never merely dropped, before the next acquire (AlreadyAcquired panic at launch otherwise); discard_pending_frame presents too. 2. Full-res prefetch churn (src/lib.rs): the 8-slot full cache cycled through a ~20-cell viewport forever (137 decodes/20 s) and each eviction free()'d a 50 MB Vec on the UI thread (20-52 ms CPU spikes, ~7/s = the residual SLOWEV NonMain jank). Fix: 60 s tombstone cooldown on evicted paths (idle prefetch skips, urgent tap bypasses) + off-thread reaper for the freed blobs (insert: 21 ms -> 4 us). 3. (earlier) Skia final flush + Mailbox present mode (vendor, M3). Instrumentation (all behind --features perf): OTHR/INVK/INVK_TAG/FLCK lines for cross-thread closure timing and push-site tagging. Warm measured swipe, 8580-file grid: cadence median 8.33 ms (exact 120 Hz), p99 15.5 ms, 5/552 gaps >16.7 ms (0.9%, max 28.3 ms, zero >33 ms); PRES phase median ~994 us, zero late frames. Docs updated (docs/BUGS/scroll-jank-120hz.md, full scorecard + line reference). Also: vendored i-slint-core + wgpu-hal (vkshim interposition patch), vkshim profiling tooling, backend made a non-optional dep, debuggable flag for simpleperf (REMOVE before shipping).
41 lines
1.3 KiB
Rust
41 lines
1.3 KiB
Rust
use alloc::{string::String, vec::Vec};
|
|
|
|
use parking_lot::Mutex;
|
|
|
|
/// Stores the text of any validation errors that have occurred since
|
|
/// the last call to `get_and_reset`.
|
|
///
|
|
/// Each value is a validation error and a message associated with it,
|
|
/// or `None` if the error has no message from the api.
|
|
///
|
|
/// This is used for internal wgpu testing only and _must not_ be used
|
|
/// as a way to check for errors.
|
|
///
|
|
/// This works as a static because `cargo nextest` runs all of our
|
|
/// tests in separate processes, so each test gets its own canary.
|
|
///
|
|
/// This prevents the issue of one validation error terminating the
|
|
/// entire process.
|
|
pub static VALIDATION_CANARY: ValidationCanary = ValidationCanary {
|
|
inner: Mutex::new(Vec::new()),
|
|
};
|
|
|
|
/// Flag for internal testing.
|
|
#[derive(Debug)]
|
|
pub struct ValidationCanary {
|
|
inner: Mutex<Vec<String>>,
|
|
}
|
|
|
|
impl ValidationCanary {
|
|
#[allow(dead_code, reason = "in some configurations this function is dead")]
|
|
pub(crate) fn add(&self, msg: String) {
|
|
self.inner.lock().push(msg);
|
|
}
|
|
|
|
/// Returns any API validation errors that have occurred in this process
|
|
/// since the last call to this function.
|
|
pub fn get_and_reset(&self) -> Vec<String> {
|
|
self.inner.lock().drain(..).collect()
|
|
}
|
|
}
|