Skip to content

Commit a8a75f4

Browse files
docs: describe live memory budgets without retired RAM caps
1 parent f18a3f4 commit a8a75f4

3 files changed

Lines changed: 11 additions & 9 deletions

File tree

‎AGENTS.md‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,7 @@ Avoid blocking work on latency-sensitive threads, unnecessary polling, duplicate
107107

108108
- **Threads** ([ARCHITECTURE §5 *Threads*](docs/ARCHITECTURE.md)): GL thread (`THREAD_PRIORITY_DISPLAY`) owns the projectM handle (create, render, load, settings) and output measurement; `AudioCapture` HandlerThread (`THREAD_PRIORITY_AUDIO`); a native worker for preset indexing and prefetch; a background shader-compile `std::thread` started from the GL thread (`preset_prewarm`); the UI polls status every 500 ms. Other entry points only write atomics or mutex-protected buffers; keep it that way.
109109
- **Visibility and cleanup:** `MainActivity.onPause` stops the track watcher, UI refresh, updater and audio, then calls `visualizerView.onPause()`; `onResume` restarts them and re-checks notification access. `onDestroy` releases projectM on the GL thread (`queueEvent(renderer::release)`); after context loss the next `onSurfaceCreated` cleans up.
110-
- **Frame pacing/quality:** half-refresh-rate pacing uses Choreographer. QualityController always uses Auto up to the detected panel, with FPS hysteresis/CPU-bound probe checks and a live ActivityManager memory budget initialized from application context in ProjectMCore.init. Standard is the Native trails default; Medium/High add the same passes with different gain. No user-facing fixed-resolution/static-RAM controls remain. Managed clients publish dimensions/trails/transition as one generation-tagged rendering configuration; GL holds allocation settings until surface-size acknowledgement. Revalidate preserved/context-recreated resumes, reject stale generations, and base FPS on completed frames tagged with context/size. When an applied size change has `wasLastChangeForMemoryPressure()`, call the existing native pressure hook to flush pooled textures and pause prewarming. Do not claim a universal music-process survival guarantee from heuristic headroom.
110+
- **Frame pacing/quality:** half-refresh-rate pacing uses Choreographer. QualityController always uses Auto up to the detected panel, with FPS hysteresis/CPU-bound probe checks and a live ActivityManager memory budget initialized from application context in ProjectMCore.init. Standard is the Native trails default; Medium/High add the same passes with different gain. No user-facing fixed-resolution/static-RAM controls remain. Use `QualityController.setRenderAllocationSettings(trails, transitionSeconds)` to review the final tuple atomically. Reductions retain resident credit, while net growth and pending/context-recreated allocations require a full review. Managed clients publish dimensions/trails/transition as one generation-tagged rendering configuration; GL holds allocation settings until surface-size acknowledgement. Revalidate preserved/context-recreated resumes, reject stale generations, and base FPS on completed frames tagged with context/size. When an applied size change has `wasLastChangeForMemoryPressure()`, call the existing native pressure hook to flush pooled textures and pause prewarming. Do not claim a universal music-process survival guarantee from heuristic headroom.
111111
- **No measured universal frame-time or memory bound is defined. Automatic memory uses documented conservative footprint/reserve estimates; see `docs/superpowers/specs/2026-10-05-native-trails.md`.** Compare before/after on the same TV, preset, render height and audio (PR template).
112112
- **Measurement tools:** profile build + simpleperf ([docs/PROFILING.md](docs/PROFILING.md)); pin a preset with `adb shell setprop debug.projectmtv.preset '<name prefix>'` and clear it afterwards (`debug.projectmtv.update_from` also exists); `tools/tv-diagnostics.sh <tv-ip>:5555 --no-install --duration 180` ([docs/DIAGNOSTICS.md](docs/DIAGNOSTICS.md); profile builds require `--package nl.neerdael.projectmtv.profile` with a matching `--apk` or `--no-install`; build/`--release` modes reject alternate package IDs before connecting); Record actual Auto render sizes and compare target-FPS/trails workloads rather than forcing a resolution sweep. Preset Lab provides offline rendering comparisons (desktop timings do not establish TV performance).
113113
- **Documented device coverage:** NVIDIA SHIELD TV 2019 (`sif`, 2 GB, 32-bit) and SHIELD TV Pro 2019 (`mdarcy`, 3 GB), Android 11; Ugoos AM6 (Amlogic S922X, Mali-G52 MP6, Android 9). No emulator configuration is committed.

‎README.md‎

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ The [ProjectM TV user guide](https://johnneerdael.github.io/ProjectM-TV/) covers
3535
- **No freezes at preset switches**: upcoming presets are prepared in the background, with cached shaders
3636
- **Adaptive resolution** that holds the frame rate, also during blends, without interrupting the picture
3737
- **Optimised projectM**: batched shape drawing (70–90% faster on shape-heavy presets), less memory traffic per frame (on a Mali-G52 10–26% more frames per second on presets with a composite shader, up to twice as many on presets without one), reused picture buffers, fewer redundant GL calls, a faster shader parser
38-
- **Memory-aware**: keeps the music app alive on TVs with little memory
38+
- **Memory-aware**: adjusts resolution to leave headroom for the music app
3939
- **Skips presets that stay black**
4040
- **Optional auto-update**: downloads new releases in the background and offers to install them (off by default)
4141
- **Private by design**: no network access unless you switch on auto-update; audio is analysed in memory only
@@ -49,7 +49,7 @@ The [ProjectM TV user guide](https://johnneerdael.github.io/ProjectM-TV/) covers
4949
- **Shows the track that is playing.** The cover, artist and title of the playing track appear in the upper left for as long as it plays (taken from the music app's media session); *Settings › Track display* shows them for 10–60 s per track instead, in the small lower-left pill, or not at all. Covers have only been verified with Spotify and [Milkbeat](https://github.com/johnneerdael/Milkbeat). SoundCloud and SmartTube have been verified to show the artist and title only, without a cover. No other music apps have been verified. This needs *notification access*, see [Track titles](#track-titles) below; without it, nothing is shown. The preset name is in the settings panel.
5050
- **Replaces presets that stay black.** If a preset shows only black for about 7 seconds while music plays, the app moves on. A preset that is black a second time is skipped from then on. Since 1.9.5, the presets that used to be black render; this rule remains as a safety net (details under *Presets* below).
5151
- **Automatic resolution up to native 4K.** The render size follows the target frame rate and live memory headroom. Standard trails keep feedback at an authored canvas while drawing new geometry and the composite at native resolution. Medium and High add more native trail detail when the current render size supports it.
52-
- **Protects the music app from being closed.** On TVs with little memory, Android closes other apps when projectM uses too much. The app caps its resolution by installed memory (with 2 GB: 1260p), and in *Auto* resolution it lowers the resolution when Android reports memory pressure.
52+
- **Budgets memory for playback.** Automatic resolution uses live available memory and estimates the rendering allocations of trails and transitions. It reserves headroom before growth and lowers resolution under memory pressure. Installed RAM does not impose a fixed 1260p cap; Android/vendor process policies can still reclaim background apps.
5353
- **Starts quickly.** The first preset appears a few seconds after launch.
5454
- **Updates itself, if you want.** With *Settings › Advanced › Auto-update* on, the app checks GitHub for a new release at every launch and every 6 hours while it is open, downloads it in the background, and offers to install it: a notice in the lower left, and an *Install* row at the top of the settings panel. Android's installer asks you to confirm. The first time, it asks you to allow installs from ProjectM TV instead; Android then restarts the app, and you select *Install* once more. Off by default; apps installed from F-Droid are updated by F-Droid.
5555
- **Shows its own measurements.** *Settings › Advanced › Diagnostics* shows the render size, frame rate, audio source and audio level.
@@ -110,7 +110,7 @@ These settings captures use an earlier isolated test installation on an Ugoos AM
110110

111111
## What it does not do, and known limits
112112

113-
**Devices.** Based on testing, at least 2 GB of RAM is highly recommended: projectM and the music app together need more than a 1 GB device has. Frame rates and memory limits differ per device; measurements from the NVIDIA SHIELD are in the [appendix](#appendix-measurements-on-the-nvidia-shield).
113+
**Devices.** Based on testing, at least 2 GB of RAM is highly recommended: projectM and the music app together need more than a 1 GB device has. Frame rates and available memory headroom differ per device; measurements from the NVIDIA SHIELD are in the [appendix](#appendix-measurements-on-the-nvidia-shield).
114114

115115
**Audio**
116116
- The app does not play music, and it has no microphone or line-in input. It can only visualize audio that another app plays on the same TV.
@@ -189,7 +189,7 @@ A version you built yourself is signed with your own debug key: uninstall it bef
189189

190190
<a id="track-titles"></a>**No track titles.** Android only shares the playing track with apps that have *notification access* (the app reads no notifications, it needs the access for the media session). Switch it on in the TV's settings under *Apps › Special app access › Notification access › ProjectM TV* (on the NVIDIA SHIELD: *Settings › Device Preferences › Apps › Special app access › Notification access*). Select **Configure** in the startup dialog to open the closest supported Android notification-access page. **Dismiss** permanently hides the automatic reminder. *Settings › Track display › Track info* always reopens setup, and *Diagnostics* shows whether access is granted. See the [screenshot walkthrough](https://johnneerdael.github.io/ProjectM-TV/getting-started/#track-titles).
191191

192-
**The music app closes while the visualizer runs.** Keep *Memory limit* on and *Resolution* on *Auto*. Only *Auto* lowers the resolution when memory runs low.
192+
**The music app closes while the visualizer runs.** Resolution and memory budgeting are always automatic. Use Standard trails and shorter transitions to reduce rendering allocations, and check actual render size and memory status in Diagnostics. Other apps and vendor process policies also affect playback; there is no manual memory-limit switch.
193193

194194
**A preset is black.** The app moves on by itself after about 7 seconds of music, as long as *Skip blank presets* is on. To bring back presets skipped earlier, reset *Skipped presets* in *Advanced*.
195195

@@ -226,8 +226,10 @@ The shared QualityController always chooses resolution automatically up to the
226226
panel, using target FPS and live memory headroom. Its legacy fixed-resolution and
227227
static-RAM inputs normalize to Auto. Standard trails is the Android core default;
228228
Medium and High add more trail detail with the same extra passes. Managed clients
229-
publish budget-approved dimensions/settings coherently and acknowledge fresh
230-
memory checks on context recreation. See [architecture](docs/ARCHITECTURE.md),
229+
review trails/transition together with `setRenderAllocationSettings`, publish
230+
budget-approved dimensions/settings coherently, and acknowledge fresh memory checks
231+
on context recreation. Reducing allocations retains resident credit; net growth
232+
and pending allocations receive a full review. See [architecture](docs/ARCHITECTURE.md),
231233
[release workflow](docs/RELEASING.md) and [profiling](docs/PROFILING.md).
232234

233235
### projectM
@@ -276,7 +278,7 @@ The bundled presets and textures are distributed under CC0 1.0 ([LICENSES/CC0-1.
276278

277279
## Appendix: measurements on the NVIDIA SHIELD
278280

279-
The figures below come from two NVIDIA SHIELD Android TVs with Android 11: the 2019 SHIELD TV (`sif`, 2 GB RAM, runs the app 32-bit) and the 2019 SHIELD TV Pro (`mdarcy`, 3 GB RAM, 64-bit). Other devices differ.
281+
These historical figures were measured before the current always-Auto/live-budget policy; they are not current resource limits. They come from two NVIDIA SHIELD Android TVs with Android 11: the 2019 SHIELD TV (`sif`, 2 GB RAM, runs the app 32-bit) and the 2019 SHIELD TV Pro (`mdarcy`, 3 GB RAM, 64-bit). Other devices differ.
280282

281283
- **Startup:** 3–6 seconds from launch to the first preset.
282284
- **Audio:** the visuals react about 1 second after launch (about 5 seconds the very first time). With Dolby or passthrough output, Android's visualizer on the TV's main output (session 0) and Android's playback capture both hear nothing; the music app's own session does. Details in [docs/ARCHITECTURE.md](docs/ARCHITECTURE.md#audio-source).

‎docs/ARCHITECTURE.md‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -219,7 +219,7 @@ Saved resolution preferences retain the numeric migration: old 1440/2160 values
219219
| Risk | Likelihood | Mitigation |
220220
|---|---|---|
221221
| Black detector skips a legitimately very dark preset | Low (off by default since 1.9) | Only when enabled, only while audio plays, 5 consecutive samples; *Reset* restores all |
222-
| Memory limit too strict on a device with plenty of free RAM, or too loose once textures are loaded | Medium | Estimates from one SHIELD run; *Memory limit › Off*; `onTrimMemory` lowers further at runtime; confirm with the next diagnostics run |
222+
| Live render-footprint/reserve estimates are too conservative or miss driver resource costs | Medium | Validate actual Auto sizes, memory headroom and trails/transition workloads. Review allocation settings atomically, preserve resident credit for reductions, and lower under pressure; no manual RAM toggle remains |
223223
| `glCopyTexImage2D` from the window is slow or unsupported on a driver | Low | Only on switch frames; any GL error falls back to classic; *Transitions › Classic* |
224224
| Two heavy presets do not fit in a frame on the CPU even with the outgoing one at half rate | Medium (preset-dependent) | Such blends still dip (the SHIELD: 15–30 fps for the heaviest pairs). Since 1.9.16 custom shapes are drawn in batches (patch 0006, +74–93% fps on shape-heavy presets); waveform-heavy presets are limited by the projectm-eval interpreter |
225225
| The texture pool keeps the discarded preset's frame buffer textures (patch 0007; up to 48 MB, typically 16 MB at 720p) | Low | Only while at least 20% of RAM is free and no pressure pause runs; emptied at the first `onTrimMemory`; reused textures are cleared first, so rendering is identical (verified on Mesa) |

0 commit comments

Comments
 (0)