Skip to content

perf(streaming): overlap 720p frame packing with scanout - #366

Merged
ReenigneArcher merged 2 commits into
masterfrom
codex/overlap-720p-frame-packing
Nov 21, 2026
Merged

ReenigneArcher merged 2 commits into
masterfrom
codex/overlap-720p-frame-packing

Conversation

@ReenigneArcher

Copy link
Copy Markdown
Member

Description

At 720p60, waiting for a reusable YUY2 buffer before packing the next frame can cause the presenter to miss a refresh. An optional third buffer lets the client pack the next frame and compose the overlay while the previous submission waits for vertical blank. The presenter still waits for that latch before submitting to the same NV2A overlay bank.

The spare uses up to 1.76 MiB of contiguous memory and is available in 720p output mode. If its allocation fails, the presenter uses two buffers.

Screenshot

Issues Fixed or Closed

Roadmap Issues

Testing

Ran the same six streaming modes against 22f9024 and the proposed change using fixed H.264 clips replayed by a local Sunshine host. Each result covers about 10 seconds after warmup in xemu with Vulkan, 64 MiB of guest memory, and GPU presentation enabled.

Stream mode Before FPS After FPS
480p30 30.0 30.0
480p60 59.9 60.0
720p30 30.0 30.0
720p60 45.7 58.2
1080i30 30.0 30.0
1080i60 45.7 47.1

At 720p60, client drops fell from 143 to 17. A repeat in reverse order improved from 49.6 to 57.1 FPS. Mean client presentation preparation and submission time was 15.02 to 14.85 ms in the first comparison and 13.01 to 12.67 ms in the repeat. Physical Xbox throughput and end-to-end latency still need validation.

  • cmake --build cmake-build-release --parallel 8 built the Xbox release ISO.
  • ctest --test-dir cmake-build-release --output-on-failure passed all 504 native tests. New tests cover packing before the prior latch, buffer rotation, spare allocation failure, and recovering software output after a scanout timeout.
  • cmake --build cmake-build-release --target docs passed the strict API documentation build.
  • uv run --locked lb-update-clang-format and git diff --check passed.
  • A separate 720p60 xemu smoke test exercised software presentation and returned to the shell.

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 21, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 74.49%. Comparing base (22f9024) to head (aab5ab3).
✅ All tests successful. No failed tests found.

Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #366      +/-   ##
==========================================
+ Coverage   74.44%   74.49%   +0.05%     
==========================================
  Files          72       72              
  Lines        8224     8237      +13     
  Branches     3517     3532      +15     
==========================================
+ Hits         6122     6136      +14     
+ Misses       1102     1101       -1     
  Partials     1000     1000              
Flag Coverage Δ
Linux 73.73% <94.73%> (+0.04%) ⬆️
macOS 63.39% <100.00%> (+0.06%) ⬆️

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

Files with missing lines Coverage Δ
src/streaming/pvideo_presenter.cpp 78.53% <100.00%> (+2.12%) ⬆️
src/streaming/pvideo_presenter.h 100.00% <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 22f9024...aab5ab3. Read the comment docs.

@sonarqubecloud

Copy link
Copy Markdown

@ReenigneArcher
ReenigneArcher merged commit 7655ca2 into master Nov 21, 2026
17 checks passed
@ReenigneArcher
ReenigneArcher deleted the codex/overlap-720p-frame-packing branch November 21, 2026 01:19
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