Skip to content

fix(windows): handle rotated displays with software capture - #6097

Merged
ReenigneArcher merged 2 commits into
masterfrom
codex/fix-dda-software-rotation
Nov 14, 2026
Merged

ReenigneArcher merged 2 commits into
masterfrom
codex/fix-dda-software-rotation

Conversation

@ReenigneArcher

Copy link
Copy Markdown
Member

Description

Rotated displays can remain black with software encoding because the RAM capture path compares the rotated desktop dimensions against Desktop Duplication's unrotated texture, repeatedly reinitializing capture.

Stage and validate the texture using its unrotated dimensions, then rotate the pixels into desktop orientation before composing the cursor. Allocate RAM images using the desktop width and copy rows independently of GPU padding; Windows Graphics Capture uses the same row-copy helper with identity rotation because its frames already have desktop orientation. Existing mode-change recovery keeps the client-requested stream resolution.

Screenshot

Issues Fixed or Closed

Roadmap Issues

Testing

  • Added six regression tests using real D3D11 WARP textures and controlled Desktop Duplication events. They cover all DXGI orientations, both supported BGRA formats, independent row padding, cursor placement, image reuse, unexpected dimensions, and access-loss recovery.
  • The landscape capture regression fails with the original size checks and passes with this fix.
  • Windows x64/UCRT64 test build passed; all 46 selected capture and video tests passed:
& C:\msys64\msys2_shell.cmd -defterm -here -no-start -ucrt64 -c 'cmake --build cmake-build-issue-5207 --target test_sunshine -j 6'
& C:\msys64\msys2_shell.cmd -defterm -here -no-start -ucrt64 -c './cmake-build-issue-5207/tests/test_sunshine.exe --gtest_filter=WindowsRamCaptureTest.*:WindowsCursorTest.*:D3dkmtAbiTests.*:*Fp16TransferTest.*:*Video*'
  • gcovr reports 27/27 executable lines covered in the new rotation helper.
  • uv sync --locked, uv run --locked lb-update-clang-format, and git diff --check passed.
  • Installer packaging was disabled for the local test build. The full test suite, physical ARM64 hardware, and rotation during a live Moonlight stream were not tested.

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

Codex assisted with the investigation, implementation, regression tests, and PR preparation.

This pull request was generated by Codex using GPT-6.1 Sol, extra high thinking level.

Copy link
Copy Markdown
Member Author

This pull request was generated by Codex using GPT-6.1 Sol, extra high thinking level.

@codecov

codecov Bot commented Nov 14, 2026 •

Copy link
Copy Markdown

Bundle Report

Bundle size has no change ✅

@codecov

codecov Bot commented Nov 14, 2026 •

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 94.87179% with 2 lines in your changes missing coverage. Please review.
✅ Project coverage is 50.80%. Comparing base (657f9b6) to head (61caea5).
✅ All tests successful. No failed tests found.

Files with missing lines Patch % Lines
src/platform/windows/display_ram.cpp 97.36% 0 Missing and 1 partial ⚠️
src/platform/windows/display_wgc.cpp 0.00% 0 Missing and 1 partial ⚠️
Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #6097      +/-   ##
==========================================
+ Coverage   50.33%   50.80%   +0.47%     
==========================================
  Files         148      148              
  Lines       32366    32413      +47     
  Branches    13698    13703       +5     
==========================================
+ Hits        16290    16467     +177     
+ Misses      14402    13077    -1325     
- Partials     1674     2869    +1195     
Flag Coverage Δ
Alpine-aarch64 34.15% <ø> (+<0.01%) ⬆️
Alpine-x86_64 34.27% <ø> (ø)
Archlinux 34.87% <ø> (ø)
FreeBSD-amd64 34.83% <ø> (ø)
Homebrew-macos-15 48.81% <ø> (ø)
Homebrew-macos-26 49.18% <ø> (+0.01%) ⬆️
Homebrew-ubuntu-24.04 37.40% <ø> (-0.01%) ⬇️
Linux-AppImage-aarch64 40.02% <ø> (ø)
Linux-AppImage-x86_64 40.27% <ø> (ø)
PowerShell 100.00% <ø> (ø)
Web-UI 57.74% <ø> (ø)
Windows-AMD64 41.35% <94.59%> (+0.86%) ⬆️
Windows-ARM64 35.35% <91.42%> (+0.90%) ⬆️
macOS-arm64 41.70% <ø> (+<0.01%) ⬆️
macOS-x86_64 40.58% <ø> (-0.01%) ⬇️

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

Files with missing lines Coverage Δ
src/platform/windows/display.h 44.56% <ø> (+10.49%) ⬆️
src/platform/windows/display_ram.cpp 60.22% <97.36%> (+47.22%) ⬆️
src/platform/windows/display_wgc.cpp 4.70% <0.00%> (+4.70%) ⬆️

... and 47 files with indirect coverage changes


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 657f9b6...61caea5. Read the comment docs.

@github-actions

github-actions Bot commented Nov 14, 2026 •

Copy link
Copy Markdown
Last Updated 2026-11-14 13:23:37 UTC
Source Run CI Run #6759
Commit 61caea506cdc2ac3f99fb00138e2337acddcf277

Screenshot Comparison

PR #6097 screenshots vs screenshots baseline.

Matrix: AppImage-aarch64

Image Baseline PR
sunshine_tray_initial.png
sunshine_tray_menu.png
sunshine_tray_pairing_request.png
sunshine_tray_paused.png
sunshine_tray_stopped.png
sunshine_tray_streaming.png
sunshine_tray_tooltip.png

Matrix: AppImage-x86_64

Image Baseline PR
sunshine_tray_initial.png
sunshine_tray_menu.png
sunshine_tray_pairing_request.png
sunshine_tray_paused.png
sunshine_tray_stopped.png
sunshine_tray_streaming.png
sunshine_tray_tooltip.png

Matrix: Windows-AMD64

Image Baseline PR
sunshine_tray_initial.png
sunshine_tray_menu.png
sunshine_tray_pairing_request.png
sunshine_tray_paused.png
sunshine_tray_stopped.png
sunshine_tray_streaming.png
sunshine_tray_tooltip.png

Matrix: Windows-ARM64

Image Baseline PR
sunshine_tray_initial.png
sunshine_tray_menu.png
sunshine_tray_pairing_request.png
sunshine_tray_paused.png
sunshine_tray_stopped.png
sunshine_tray_streaming.png
sunshine_tray_tooltip.png

Matrix: macOS-arm64

Image Baseline PR
sunshine_tray_initial.png
sunshine_tray_menu.png
sunshine_tray_pairing_request.png
sunshine_tray_paused.png
sunshine_tray_stopped.png
sunshine_tray_streaming.png
sunshine_tray_tooltip.png

Matrix: macOS-x86_64

Image Baseline PR
sunshine_tray_initial.png
sunshine_tray_menu.png
sunshine_tray_pairing_request.png
sunshine_tray_paused.png
sunshine_tray_stopped.png
sunshine_tray_streaming.png
sunshine_tray_tooltip.png

@sonarqubecloud

Copy link
Copy Markdown

@ReenigneArcher
ReenigneArcher merged commit 48f63b4 into master Nov 14, 2026
83 checks passed
@ReenigneArcher
ReenigneArcher deleted the codex/fix-dda-software-rotation branch November 14, 2026 15:53
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.

Screen Rotation on Windows 11 ARM64 Devices

1 participant