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).
107 lines
4.2 KiB
TOML
107 lines
4.2 KiB
TOML
[package]
|
|
name = "gallery"
|
|
version = "0.1.0"
|
|
edition = "2021"
|
|
|
|
[lib]
|
|
crate-type = ["cdylib", "lib"]
|
|
|
|
[dependencies]
|
|
libc = "0.2"
|
|
slint = { version = "1.18.1", features = [
|
|
"backend-android-activity-06",
|
|
# Exposes `slint::wgpu_30` + `Image: TryFrom<wgpu::Texture>` +
|
|
# GraphicsAPI::WGPU30 — used by gputex to upload thumbnail textures
|
|
# off the UI thread (auto-enabled on Android already; explicit for
|
|
# host builds).
|
|
"unstable-wgpu-30",
|
|
] }
|
|
log = "0.4"
|
|
rusqlite = { version = "0.41.0", features = ["bundled"] }
|
|
sha1 = "0.11.0"
|
|
turbojpeg = { version = "1.5.1", features = ["cmake"] }
|
|
image = { version = "0.25.10", default-features = false, features = ["png"] }
|
|
kamadak-exif = "0.6.1"
|
|
# STG event-loop stage timestamps, read by the jank-hunt `perf` feature
|
|
# (docs/BUGS/scroll-jank-120hz.md); and the 120Hz scroll-fix flags
|
|
# (stg::VSYNC_LOCKED_RENDER). Already in the graph transitively via slint;
|
|
# direct so the app can set the fix flags unconditionally.
|
|
i-slint-backend-android-activity = { version = "1.18.1" }
|
|
|
|
[features]
|
|
# Jank-hunt instrumentation: per-frame frame-gap + render cost (FR),
|
|
# event-loop stage costs (STG), and per-job decode cost (DECODE), mirrored
|
|
# to a file on Android. OFF by default — dead-code-eliminated, zero runtime
|
|
# overhead. To capture, build with `--features perf` (format + analysis:
|
|
# docs/BUGS/scroll-jank-120hz.md).
|
|
# Pure code flag: gates the FR/STG/DECODE file-mirror instrumentation
|
|
# (no dependencies — the backend dep is now unconditional for the fix).
|
|
perf = []
|
|
|
|
[build-dependencies]
|
|
slint-build = "1.18.1"
|
|
|
|
[dev-dependencies]
|
|
tempfile = "3.27.0"
|
|
|
|
# --- Android packaging (cargo-apk2 1.5) ---
|
|
# NOTE: uses_permission is a TOP-LEVEL android key (ndk-build2 manifest layer),
|
|
# not under [package.metadata.android.application]. max_sdk_version supported.
|
|
[package.metadata.android]
|
|
package = "wow.gmp.gallery"
|
|
build_targets = ["x86_64-linux-android", "aarch64-linux-android"]
|
|
|
|
[package.metadata.android.sdk]
|
|
min_sdk_version = 26
|
|
target_sdk_version = 35
|
|
|
|
[package.metadata.android.application]
|
|
label = "Gallery"
|
|
# JANK-HUNT ONLY: debuggable so `adb shell simpleperf`/run-as can attach to
|
|
# the process (off-CPU profiling of the UI thread). REMOVE before shipping.
|
|
debuggable = true
|
|
|
|
[[package.metadata.android.application.activity]]
|
|
name = "android.app.NativeActivity"
|
|
|
|
[[package.metadata.android.application.activity.meta_data]]
|
|
name = "android.app.lib_name"
|
|
value = "gallery"
|
|
|
|
[[package.metadata.android.application.activity.intent_filter]]
|
|
actions = ["android.intent.action.MAIN"]
|
|
categories = ["android.intent.category.LAUNCHER"]
|
|
|
|
# --- Permissions (runtime flow: HANDOFF.md §7) ---
|
|
# NOTE: the Permission schema supports only `name` + `max_sdk_version`.
|
|
# READ_MEDIA_IMAGES is a no-op on API < 33 (unknown perms are ignored).
|
|
[[package.metadata.android.uses_permission]]
|
|
name = "android.permission.READ_MEDIA_IMAGES"
|
|
|
|
# API <= 32: legacy external storage read.
|
|
[[package.metadata.android.uses_permission]]
|
|
name = "android.permission.READ_EXTERNAL_STORAGE"
|
|
max_sdk_version = 32
|
|
|
|
# "All files access" — same special-access pattern as passgo; needed to browse
|
|
# arbitrary directories outside the media collection.
|
|
[[package.metadata.android.uses_permission]]
|
|
name = "android.permission.MANAGE_EXTERNAL_STORAGE"
|
|
|
|
[patch.crates-io]
|
|
# Vendored Slint Skia renderer: removes a redundant per-frame synchronous
|
|
# flush that caused 19-24 ms scroll stalls on Mali (see
|
|
# docs/BUGS/slint-skia-final-flush-jank.md). Pinned to the 1.18.1 source;
|
|
# re-apply the one hunk when bumping Slint.
|
|
i-slint-renderer-skia = { path = "vendor/i-slint-renderer-skia" }
|
|
# STG (jank-hunt): event-loop stage timestamps, read by the `perf` feature
|
|
# (docs/BUGS/scroll-jank-120hz.md). Pinned to the 1.18.1 source.
|
|
i-slint-backend-android-activity = { path = "vendor/i-slint-backend-android-activity-1.18.1" }
|
|
# Vendored Slint Core: for layout engine / scrolling optimization.
|
|
i-slint-core = { path = "vendor/i-slint-core" }
|
|
# Jank-hunt (VK_LIBRARY): zygote preloads the system libvulkan.so into every
|
|
# app, so dlopen-by-name can't be shadowed; an absolute path (the app's own
|
|
# shim, see shim/vkshim.c) is the only reliable intercept. One hunk in
|
|
# vulkan/instance.rs; re-apply when bumping wgpu.
|
|
wgpu-hal = { path = "vendor/wgpu-hal-30.0.1" }
|