Derive video buffer sizing from screen dimensions#60
Conversation
…udio overrides. Replace manually-configured PAGE_SCALE with VIDEO_BUFFER_* constants derived from screen dimensions (1.5x aspect correction factor). Saves ~75% memory on ION platforms. Add bounds checking in minarch to prevent buffer overflow. Remove PAGE_* backwards compatibility aliases - all internal code now uses VIDEO_BUFFER_* consistently. Remove SAMPLES=400 overrides from 5 platforms (rg35xxplus, my355, rgb30, zero28, magicmini). These were workarounds for fceumm underruns before the audio rate control.
7e090f3 to
84dbd82
Compare
There was a problem hiding this comment.
Pull request overview
This PR modernizes video buffer management by replacing manually-configured PAGE_SCALE constants with dynamically-calculated VIDEO_BUFFER_* sizing derived from screen dimensions. The new system uses a 1.5x aspect correction factor (vs the previous 3x or 2x overscaling), achieving ~75% memory savings on ION platforms (rg35xx, trimuismart) while maintaining compatibility for all scaling scenarios. Additionally, it adds bounds checking in minarch to prevent buffer overflow, and removes SAMPLES=400 audio buffer overrides from 5 platforms that were workarounds for fceumm audio underruns before audio rate control improvements.
- Replaces
PAGE_WIDTH/HEIGHT/SIZE/COUNT/SCALEwithVIDEO_BUFFER_WIDTH/HEIGHT/SIZE/COUNTconstants - Introduces
VIDEO_ASPECT_CORRECTION=1.5ffactor for automatic buffer sizing based on screen dimensions - Adds bounds checking in minarch's
selectScaler()to cap output dimensions when they exceed buffer capacity
Reviewed changes
Copilot reviewed 14 out of 14 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
workspace/all/common/api.h |
Defines new VIDEO_BUFFER_* constants with comprehensive documentation explaining the 1.5x aspect correction factor and automatic sizing system |
workspace/all/common/api.c |
Updates comment to reference SAMPLES definition in defines.h (no functional change) |
workspace/all/minarch/minarch.c |
Adds bounds checking (lines 4557-4575) to prevent scaler output from exceeding buffer dimensions, with proportional dimension and offset capping |
workspace/miyoomini/platform/platform.h |
Removes manual PAGE_SCALE override that was previously used for 560p memory optimization |
workspace/miyoomini/platform/platform.c |
Replaces PAGE_SIZE/PAGE_COUNT with VIDEO_BUFFER_SIZE/VIDEO_BUFFER_COUNT in buffer allocation, munmap, and memory operations |
workspace/miyoomini/README.md |
Updates variant comparison table to remove PAGE_SCALE row and adjusts description |
workspace/rg35xx/platform/platform.c |
Replaces PAGE_SIZE/PAGE_COUNT with VIDEO_BUFFER_SIZE/VIDEO_BUFFER_COUNT in ION allocations and buffer pointer calculations |
workspace/trimuismart/platform/platform.c |
Replaces PAGE_* constants with VIDEO_BUFFER_* equivalents throughout ION allocations, surface creation, and flip operations |
workspace/rg35xxplus/platform/platform.h |
Removes SAMPLES=400 audio buffer override (no longer needed with audio rate control) |
workspace/my355/platform/platform.h |
Removes SAMPLES=400 audio buffer override |
workspace/rgb30/platform/platform.h |
Removes SAMPLES=400 audio buffer override |
workspace/zero28/platform/platform.h |
Removes SAMPLES=400 audio buffer override |
workspace/magicmini/platform/platform.h |
Removes SAMPLES=400 audio buffer override |
docs/platform-variants.md |
Updates example code to use EDGE_PADDING instead of deprecated PAGE_SCALE |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Replace manually-configured PAGE_SCALE with VIDEO_BUFFER_* constants derived from screen dimensions (1.5x aspect correction factor). Saves ~75% memory on ION platforms. Add bounds checking in minarch to prevent buffer overflow.
Remove PAGE_* backwards compatibility aliases - all internal code now uses VIDEO_BUFFER_* consistently.
Remove SAMPLES=400 overrides from 5 platforms (rg35xxplus, my355, rgb30, zero28, magicmini). These were workarounds for fceumm underruns before the audio rate control.
Fixes #52