Skip to content

fix(streaming): reduce NV2A frame packing overhead - #365

Merged
ReenigneArcher merged 6 commits into
masterfrom
codex/fix-720p-presentation
Nov 20, 2026
Merged

ReenigneArcher merged 6 commits into
masterfrom
codex/fix-720p-presentation

Conversation

@ReenigneArcher

@ReenigneArcher ReenigneArcher commented Nov 20, 2026 •

Copy link
Copy Markdown
Member

Description

At 720p, packing decoded YUV420 frames into the NV2A overlay's write-combined YUY2 buffers consumed most of the presentation budget and caused dropped frames at both 30 and 60 FPS.

Pack blocks of thirty-two pixels in cached storage and write them to the overlay with unaligned 16-byte SSE1 stores. Use scalar packing for tails and on other targets. SSE1 is supported by nxdk's Pentium III target.

Screenshot

Issues Fixed or Closed

Roadmap Issues

Testing

Fixed H.264 clips streamed through Sunshine in xemu with Vulkan showed these presentation rates. The 720p60 comparison ran twice with the order reversed and counts steady playback windows where the incoming rate was within 5% of the requested rate.

Stream MMX inline assembly SSE1 intrinsics
720p30 30.0 FPS 30.0 FPS
720p60 45.0–46.3 FPS 46.5–55.2 FPS

At 720p60, the median packing time was 8.1–9.8 ms with MMX and 5.6–7.5 ms with SSE1. The original scalar packer presented about 17 FPS at 720p30 and 19 FPS at 720p60 in earlier xemu measurements. A pre-SDL3 build sustained 720p30 with the same clip. The first affected commit and physical Xbox performance remain unverified.

  • Added a byte-for-byte packing test for unaligned planes, multiple wide blocks, a scalar tail, padded strides, odd height, exact last-row bounds, and a word that resembles a signaling NaN.
  • uv run --locked lb-update-clang-format and git diff --check passed.
  • The Xbox release ISO built successfully. ctest --test-dir cmake-build-release --output-on-failure passed all 501 native tests, and the strict Dockle API documentation build passed.
  • Verified 16-byte movups stores in the compiled Pentium III code and checked the packaged ISO with 720p60 GPU and 720p30 software playback in xemu.

Type of Change

  • feat: New feature (non-breaking change which adds functionality)
  • fix: Bug fix (non-breaking change which fixes an issue)
  • docs: Documentation only changes
  • style: Changes that do not affect the meaning of the code (white-space, formatting, missing semicolons, etc.)
  • refactor: Code change that neither fixes a bug nor adds a feature
  • perf: Code change that improves performance
  • test: Adding missing tests or correcting existing tests
  • build: Changes that affect the build system or external dependencies
  • ci: Changes to CI configuration files and scripts
  • chore: Other changes that don't modify src or test files
  • revert: Reverts a previous commit
  • BREAKING CHANGE: Introduces a breaking change (can be combined with any type above)

Checklist

  • Code follows the style guidelines of this project
  • Code has been self-reviewed
  • Code has been commented, particularly in hard-to-understand areas
  • Code docstring/documentation-blocks for new or existing methods/components have been added or updated
  • Tests have been added or updated for new or modified functionality, including regression tests for bug fixes

AI Usage

See our AI usage policy.

  • AI tools were used while preparing this PR

@codecov

codecov Bot commented Nov 20, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 74.44%. Comparing base (aa48be6) to head (5b17028).
✅ All tests successful. No failed tests found.

Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #365      +/-   ##
==========================================
+ Coverage   74.39%   74.44%   +0.04%     
==========================================
  Files          72       72              
  Lines        8210     8224      +14     
  Branches     3514     3517       +3     
==========================================
+ Hits         6108     6122      +14     
  Misses       1102     1102              
  Partials     1000     1000              
Flag Coverage Δ
Linux 73.68% <100.00%> (+0.04%) ⬆️
macOS 63.33% <100.00%> (+<0.01%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

Files with missing lines Coverage Δ
src/streaming/video_acceleration.cpp 82.81% <100.00%> (+4.81%) ⬆️
src/streaming/video_acceleration.h 100.00% <ø> (ø)

Continue to review full report in Codecov by Harness.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update aa48be6...5b17028. Read the comment docs.

@sonarqubecloud

Copy link
Copy Markdown

@ReenigneArcher
ReenigneArcher merged commit 22f9024 into master Nov 20, 2026
17 checks passed
@ReenigneArcher
ReenigneArcher deleted the codex/fix-720p-presentation branch November 20, 2026 23:09
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.

1 participant