The slow pop-in (warm and cold) had two root causes, both in the drain tick / scan pipeline: 1. Paint-cap drop bug: finished decodes beyond MAX_PAINT_CELLS_PER_TICK were silently dropped (out of inflight, not in painted) so FILL re-submitted them — the same cell re-decoded 3-6x per viewport and a new viewport took 500-850ms to fill after a flick. Now excess results hold in app.ready (bounded READY_CAP=48) and paint on a later tick at zero re-decode cost; FILL skips ready_paths. The cap is adaptive: 2 during grid motion (frame budget), 4 when settled (fast pop-in). 2. Cold-start scan storm: every 512-entry scan batch re-sorted the WHOLE list and set_list did a full model reset + generation bump, orphaning every queued decode (arrived marked stale, dropped, re-submitted) — a 17x re-decode storm (max observed dups = 18 = batch count) plus full row churn per batch. Streaming now appends (each 512 group mtime-sorted, groups concatenated = stable prefix), and set_list detects appends (prefix match) to extend the model in place (extend_from_slice) with NO reset/generation-bump. The final global sort is ONE reset at scan end; viewport re-fills from the disk cache (~2ms/cell). Measured: scan 7637ms -> ~4.3-4.9s, decode dups 18 -> 2-3. Window black after pause (regression found while testing): the OS can invalidate our surface (system dialog, app switch) with NO window event and no pending model change -> the window returned black and stayed black (nothing ever set pending_redraw). Fixes: - request_redraw() unconditionally in RenderingSetup - drain-tick watchdog: window visible but no frame completed for >2.5s -> one forced redraw (LAST_PRESENT_US, updated in AfterRendering; now_us/NOW_T0 no longer perf-gated) Also: debuggable=false — the system 16KB-compat dialog (debuggable apps only) is its own activity, it paused us on every cold launch, and its inconsistent lifecycle (TermWin or not) was the main black- window trigger in testing. Phone-verified (cold, 8580 files, fresh DB): clean launch, grid streams in with thumbnails, flicks render 120Hz (median 8.3-8.5ms, 0-2 late frames), viewport fully painted after flick, grid intact after an app switch (no black window).
109 lines
4.3 KiB
TOML
109 lines
4.3 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"
|
|
# Not debuggable: a debuggable app shows the system 16 KB compatibility
|
|
# dialog on EVERY cold launch — that dialog is its own activity, it pauses
|
|
# us, and its lifecycle was a source of lost surfaces / black windows.
|
|
# (Jank-hunt is over; simpleperf no longer needed.)
|
|
debuggable = false
|
|
|
|
[[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" }
|