gallery/Cargo.toml
Greg Pomerantz d5bbb41bbd Jank-hunt perf feature: FR/STG/DECODE instrumentation, off by default
Residual scroll jank at 120 Hz (suspected Slint event-loop bug) needs
per-frame + per-stage timing the logcat ring buffer can't hold. New
cargo feature `perf` (default OFF — all sites are cfg-gated, zero
overhead when off):

- FR: per-frame app-side render cost + frame gap, from the rendering
  notifier (BeforeRendering/AfterRendering).
- STG: event-loop stage costs (wake/timers/events/poll/lastrender) from
  timestamps instrumented into the pinned vendor copy of
  i-slint-backend-android-activity (stg.rs; Cargo.toml now depends on
  it directly + optional under `perf`).
- DECODE: per-thumbnail-job cost on the workers.
- All lines mirrored to /sdcard/Download/.gallery_perf.log (logcat
  rotates too fast at ~120 lines/s).

Format + reading guide: docs/BUGS/scroll-jank-120hz.md.
2026-10-29 08:11:51 -04:00

94 lines
3.5 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). Already in the graph transitively via
# slint; direct + optional so `perf` can read its `stg` module.
i-slint-backend-android-activity = { version = "1.18.1", optional = true }
[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).
perf = ["dep:i-slint-backend-android-activity"]
[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"
[[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" }