Skip to content

Conversation

@nchapman
Copy link
Collaborator

@nchapman nchapman commented Dec 7, 2025

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

Copilot AI review requested due to automatic review settings December 7, 2025 22:28
…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.
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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/SCALE with VIDEO_BUFFER_WIDTH/HEIGHT/SIZE/COUNT constants
  • Introduces VIDEO_ASPECT_CORRECTION=1.5f factor 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.

@nchapman nchapman merged commit 3dd9a0d into develop Dec 7, 2025
4 checks passed
@nchapman nchapman deleted the feature/page-scale branch December 7, 2025 22:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Investigate PAGE_SCALE usage and over-allocation

2 participants