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).
46 lines
1.7 KiB
Rust
46 lines
1.7 KiB
Rust
// Copyright © SixtyFPS GmbH <info@slint.dev>
|
|
// SPDX-License-Identifier: GPL-3.0-only OR LicenseRef-Slint-Royalty-free-2.0 OR LicenseRef-Slint-Software-3.0
|
|
|
|
use crate::items::BuiltInMouseCursor;
|
|
|
|
/// This enum represents different types of mouse cursors. It's a subset of the mouse cursors available in CSS.
|
|
/// For details and pictograms see the [MDN Documentation for cursor](https://developer.mozilla.org/en-US/docs/Web/CSS/cursor#values).
|
|
/// Depending on the backend and used OS unidirectional resize cursors may be replaced with bidirectional ones.
|
|
#[repr(C, u32)]
|
|
#[non_exhaustive]
|
|
#[derive(Debug, Clone, PartialEq)]
|
|
pub enum MouseCursorInner {
|
|
/// One of the built-in mouse cursors.
|
|
BuiltIn(BuiltInMouseCursor),
|
|
/// Custom cursor from an `Image`.
|
|
CustomMouseCursor {
|
|
/// Image backing for this cursor.
|
|
image: crate::graphics::Image,
|
|
/// X pixel coordinate of the hotspot from the left edge of the image.
|
|
///
|
|
/// The value is clamped to the image bounds.
|
|
hotspot_x: i32,
|
|
/// Y pixel coordinate of the hotspot from the top edge of the image.
|
|
///
|
|
/// The value is clamped to the image bounds.
|
|
hotspot_y: i32,
|
|
},
|
|
}
|
|
|
|
impl Default for MouseCursorInner {
|
|
fn default() -> Self {
|
|
Self::BuiltIn(BuiltInMouseCursor::Default)
|
|
}
|
|
}
|
|
|
|
/// Maps a custom cursor's hotspot from the source image into a buffer rendered at
|
|
/// `rendered_size` pixels, clamped to stay inside it.
|
|
pub fn scaled_hotspot(hotspot: i32, source_size: u32, rendered_size: u32) -> u32 {
|
|
let scaled = if source_size == 0 {
|
|
0
|
|
} else {
|
|
hotspot as i64 * rendered_size as i64 / source_size as i64
|
|
};
|
|
scaled.clamp(0, rendered_size.saturating_sub(1) as i64) as u32
|
|
}
|