Skip to content

feat(video): add NV2A presentation and live performance statistics - #340

Draft
ReenigneArcher wants to merge 6 commits into
masterfrom
codex/feat-video-presentation-stats
Draft

ReenigneArcher wants to merge 6 commits into
masterfrom
codex/feat-video-presentation-stats

Conversation

@ReenigneArcher

Copy link
Copy Markdown
Member

Description

Add GPU-assisted video presentation and a live performance panel across every presentation path. Video decoding runs on the CPU.

  • Enable NV2A PVIDEO color conversion/scaling by default, with bounded synchronization, stable DMA bounds, safe buffer retirement, and restoration of visible software output on teardown or failure.
  • Enable FFmpeg's Pentium III MMX/SSE NASM kernels and w32threads support through private nxdk compatibility adapters. Keep one decoder worker and provide aligned, padded media buffers and allocation adapters.
  • Show measured incoming/decoded/rendered FPS, video payload bitrate, host processing time, RTT/variance, stage timings, frame drops, queues, and the active presentation path in the optional live panel.
  • Cache/rasterize the panel once per second and composite it into GPU YUY2, direct software RGB, or SDL output. Use integer-based numeric formatting supported by nxdk's C runtime.
  • Always show GPU/software frame counts after a stream, with a prominent SOFTWARE FALLBACK USED message and reason when applicable.
  • Retain opt-in PVIDEO and MPEG-2 sampling experiment builds, with native regression coverage, NASM build/CI dependencies, concise operating instructions, aligned Markdown tables, and updated contributor guidance. The sampling probe is an experiment rather than an implemented hardware video decoder.

This draft is stacked after #194 and #339 and includes their commits. Merge order: moonlight-common-c #175, #194, #339, then this PR. The base is master; the video/statistics-only diff excludes those prerequisites.

The repository uses squash merges. After prerequisite merges, merging master into this branch can refresh the comparison without rebasing. The inherited common-library pin currently conflicts with master and is intentionally retained while its upstream PR is pending.

Screenshot

Issues Fixed or Closed

Roadmap Issues

Testing

  • Windows MSYS2 MinGW64: full host/Xbox build and XBE/ISO packaging passed with MOONLIGHT_ENABLE_GPU_PRESENTATION=ON and MOONLIGHT_BUILD_VIDEO_EXPERIMENTS=ON. Both standalone probe ISOs were built.
  • Reconfigured with MOONLIGHT_ENABLE_GPU_PRESENTATION=OFF and rebuilt/packaged the software variant successfully; restored the normal release build to GPU presentation afterward.
  • ctest --test-dir cmake-build-release --output-on-failure: 292/292 passed. Coverage includes presentation registers and lifecycle, DMA-buffer bounds, fallback failures, cached panels in GPU/software pixel formats, aligned allocation, telemetry intervals/rates, unavailable values, and numeric formatting.
  • Confirmed the generated FFmpeg configuration enables MMX/SSE external assembly and w32threads, with SSE2 and inline assembly disabled.
  • Strict Dockle/Doxygen api build passed (441 HTML pages).
  • Shared clang-format run, explicit experiment formatting, aligned-table checks, and git diff --check passed.
  • CMake lint was run and is not clean: it reports formatting/naming diagnostics in the modified files, including existing findings and added CMake lines.
  • During implementation, the user confirmed GPU streaming and the live panel work in xemu after the synchronization and numeric-formatting fixes. Native shims cover both presentation paths; live software-panel visibility was not confirmed interactively.

Real Xbox hardware, hardware decoding, and real-console performance were not validated. Hosted CI results are separate from these local checks.

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

Introduce a VideoDecoderSelection setting and UI to cycle/choose preferred decoder (Auto, H.264, MPEG-2, H.263+). Persist and parse the new streaming.video_decoder setting, include it in settings initialization/persistence, and expose the choice in the settings UI and status messages. Advertise supported Moonlight video formats based on the preference and pass that to the session startup; update the FFmpeg backend to select and log the appropriate decoder (mpeg2/h263/h264), improve error messages, and expose the active decoder name to stats/overlays. Enable required FFmpeg parsers/decoders and update the ffmpeg profile signature; add/update unit tests and bump the moonlight-common-c submodule.
@sonarqubecloud

Copy link
Copy Markdown

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