mirror of
https://github.com/ChuckBuilds/LEDMatrix.git
synced 2026-10-04 14:25:08 +00:00
Scrolling ran at 44-46 fps on a 2x128x64 chain and 14-17% of frames took 41-53ms, which reads as judder. Four independent causes, each measured on the hardware; details and the diagnostic recipe are in docs/SCROLL_PERFORMANCE.md. The high-FPS loop slept a flat 8ms after every render. display() has already blocked on the panel's vsync by then, so that sleep was added to a wait that had happened: ~4ms of render plus 8ms put each iteration at ~12ms against a 10ms refresh grid, so every swap missed a refresh and the loop settled at 50fps while asking for 125 -- with no headroom, so a further 14% of frames slipped again. It now sleeps only the remainder, with a 1ms floor so plugin threads still get the GIL. ScrollHelper stepped position on a wall clock at 1/scroll_delay steps per second. Plugins set scroll_delay to the frame period, so that comparison sat exactly on its own threshold: a frame arriving a hair early moved zero pixels and rendered an identical frame, dirty-tracking skipped the swap, it returned in ~2ms, and the beat repeated. No scroll_delay value tunes that out -- a shorter delay trades stalled frames for periodic double-steps. Both modes now accumulate elapsed time at the same configured speed, so position stays proportional to real time. Sub-pixel blending goes back to off by default. It renders a half-step by mixing two adjacent columns, which on a coarse panel showing pixel-font text alternates crisp and smeared frames and reads as shimmer -- visibly worse than integer stepping on the hardware. Vegas mode still opts in. disk_cache uses orjson when importable, falling back to the stdlib. Encoding a ~1MB record drops from 14.8ms to 5.4ms end-to-end, and that work holds the GIL while a marquee is on screen. display_manager also checksummed the whole framebuffer twice per frame (dirty tracking, then the preview snapshot); the snapshot now takes the checksum the caller already computed. New src/common/scroll_config.py resolves scroll settings in one place. Five ticker plugins each hand-rolled this and disagreed: odds-ticker ranked the deprecated scroll_pixels_per_second above the documented scroll_speed/delay pair, and because that key carries a schema default the documented settings were dead for every user (ChuckBuilds/ledmatrix-plugins#408), while ledmatrix-leaderboard read the same key only as a fallback. The resolver also warns when a speed will not advance a whole number of pixels per refresh, which is the property that actually determines whether a scroll looks smooth. scripts/build_rgbmatrix_nogil.sh rebuilds the rgbmatrix binding so it releases the GIL. Upstream declares SwapOnVSync without nogil, unlike SetPixel/Clear/Fill beside it, so the render thread held the GIL for the whole vsync wait and starved background threads into long uninterruptible bursts. The script patches, builds and self-verifies into a scratch tree; --install backs up the original and rolls back if the service does not come back healthy. Measured after: 100 fps locked, no stalls observed, render thread down from 51% to 19% of one core. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
71 lines
3.2 KiB
Plaintext
71 lines
3.2 KiB
Plaintext
# LEDMatrix Core Dependencies
|
|
# Compatible with Python 3.10, 3.11, 3.12, and 3.13
|
|
# Tested on Raspbian OS 12 (Bookworm) and 13 (Trixie)
|
|
|
|
# Image processing
|
|
Pillow>=12.2.0,<13.0.0
|
|
numpy>=1.24.0 # For fast array operations in ScrollHelper (compatible with 2.x)
|
|
|
|
# Timezone handling
|
|
pytz>=2024.2,<2025.0 # Updated for latest timezone data
|
|
|
|
# HTTP requests
|
|
requests>=2.33.0,<3.0.0
|
|
urllib3>=2.7.0,<3.0.0 # requests transitive, but imported directly (urllib3.util.retry.Retry); floor is a security floor, not the API floor — 1.26.x carries ~10 CVEs
|
|
|
|
# Google API integration
|
|
|
|
# Font rendering
|
|
freetype-py>=2.5.1,<3.0.0
|
|
|
|
# Spotify integration (used by web_interface/blueprints/api_v3.py OAuth endpoints)
|
|
spotipy>=2.25.2,<3.0.0
|
|
|
|
# Flask web framework
|
|
Flask>=3.1.3,<4.0.0
|
|
|
|
# WebSocket support: intentionally NOT declared here. Plugins that need
|
|
# it (e.g. ledmatrix-music's Socket.IO client) declare it in their own
|
|
# requirements.txt, which the plugin store installs.
|
|
|
|
# JSON Schema validation
|
|
jsonschema>=4.20.0,<5.0.0
|
|
|
|
# Requirement specifier parsing (plugin dependency satisfaction checks)
|
|
packaging>=23.0,<27.0
|
|
|
|
# Testing dependencies live in requirements-test.txt:
|
|
# pip install -r requirements.txt -r requirements-test.txt
|
|
|
|
# ───────────────────────────────────────────────────────────────────────
|
|
# Optional dependencies — the code imports these inside try/except
|
|
# blocks and gracefully degrades when missing. Install them for the
|
|
# full feature set, or skip them for a minimal install.
|
|
# ───────────────────────────────────────────────────────────────────────
|
|
#
|
|
# scipy — sub-pixel interpolation in
|
|
# src/common/scroll_helper.py for smoother
|
|
# scrolling. Falls back to a simpler shift algorithm.
|
|
# pip install 'scipy>=1.10.0,<2.0.0'
|
|
#
|
|
# psutil — per-plugin resource monitoring in
|
|
# src/plugin_system/resource_monitor.py. The monitor
|
|
# silently no-ops when missing (PSUTIL_AVAILABLE = False).
|
|
# Note: web_interface/requirements.txt requires this
|
|
# range as a hard dependency — keep the two in sync.
|
|
# pip install 'psutil>=6.0.0,<7.0.0'
|
|
#
|
|
# orjson — faster JSON for the disk cache
|
|
# (src/cache/disk_cache.py). Encoding a ~1MB cache
|
|
# record drops from ~12ms to ~1.6ms on a Pi 4, which
|
|
# matters because that work holds the GIL and stalls
|
|
# the render thread mid-scroll. Falls back to the
|
|
# stdlib json when missing — see docs/SCROLL_PERFORMANCE.md.
|
|
# pip install 'orjson>=3.9,<4.0'
|
|
#
|
|
# Flask-Limiter — request rate limiting in web_interface/app.py
|
|
# (accidental-abuse protection, not security). The
|
|
# web interface starts without rate limiting when
|
|
# this is missing.
|
|
# pip install 'Flask-Limiter>=3.5.0,<4.0.0'
|