Skip to content

perf(windows): record 1440p and 4K30 on the D3D11 texture path (#173) - #1610

Open
petercr wants to merge 4 commits into
mainfrom
perf/windows-d3d11-173
Open

petercr wants to merge 4 commits into
mainfrom
perf/windows-d3d11-173

Conversation

@petercr

@petercr petercr commented Nov 20, 2026 •

Copy link
Copy Markdown
Collaborator

Refs #173. This doesn't close it: livestream, split record/stream and captions/highlights are still open.

What changed

  • Selector envelope. Since Fix Windows support bundle redaction and idle scene switching #202, select_windows_d3d11_session refused every output past 1920×1080 (windows-d3d11-media-primary-output-unqualified). So 1440p30/60, 4K30 and the 1440p/4K portrait twins recorded through the CPU compositor, with system-memory NV12 uploads to Media Foundation. It now takes every output inside H.264 level 5.1: at most 36,864 macroblocks a frame and 983,040 a second, with no side past 4096. 4K60 needs level 5.2 and keeps its named fallback (the backend also refuses implicit 4K60 earlier, as experimental). An encoder that refuses a size still fails the pump's startup into the named windows-d3d11-media-startup-failed fallback.
  • Encoded-bridge smoke. The smoke now requires direct D3D11 for the portrait profiles too. On main, vertical 1080p already ran on D3D11 and failed the smoke's leftover CPU-compositor check.
  • Acceptance record. Before/after numbers are in docs/acceptance/2026-11-20-windows-d3d11-1440p-4k.md.

Evidence (win11-x64-i5-8400-gtx1650-super, packaged app; base and branch differ only in videorc-backend.exe)

Encoded-bridge, 10 screen profiles + 2 screen-camera profiles, D3D11 required. On main, 1440p30, 1440p60, 4K30 and vertical-4K30 fail directD3D11Media=NV12, and vertical-1080p30/60 fail the smoke bug. On the branch, all 12 pass. Every profile has GPU encoder samples equal to recorded frames and zero capture readbacks, CPU compositor frames, system-memory encoder samples and raw-FIFO copies. 1440p60, 4K30 and the portrait twins are H.264 High at level 5.1, BT.709, video range.

20 s takes with per-process telemetry (the sampler also loads the host):

main (CPU path) branch (D3D11)
1440p60 fps 54.59 (bar 57) 59.95
1440p60 backend CPU avg / p95 252% / 305% 45% / 60%
1440p60 backend RSS 227 MB 185 MB
4K30 frames / duration 683 / 22.77 s (12% stretch; an earlier run: 27.52 fps) 608 / 20.27 s
4K30 backend CPU avg / p95 286% / 320% 28% / 49%
4K30 backend RSS 291 MB 218 MB

Main was measured with the artifact tolerance widened locally (not committed) so it would write its report.

Clips → Record at 1440p30 (smoke:record-latency -- --real-screen --profile tutorial-1440p30, Clips on): 3/3 cycles on D3D11 with valid artifacts. Warm click→recording is 1.48–1.51 s against 1.37–1.43 s at 1080p. Both runs miss the report-only budget because the dev app has no capture worker.

Evidence, second host: Intel UHD 620 laptop (the #1042 host)

i5-8365U, UHD 620 driver 31.0.101.2135, on AC. The control is the installed 0.36.0, which has the same D3D11/compositor/bridge/session code as this branch's base. The branch arm is the same install with only videorc-backend.exe swapped.

  • Encoded-bridge, all 12 profiles: all pass on D3D11 on the branch. 0.36.0 falls back to the CPU compositor at every 1440p and 4K size, landscape and portrait. No profile hit the encoder's in-flight cap, and GPU compose p95 stayed between 3.3 and 15.5 ms at every size.
  • 20 s telemetry takes on the branch: 1440p60 ran 1,247 frames in 20.82 s (59.90 fps), backend CPU 51% avg / 73% p95. 4K30 ran 607 frames in 20.27 s (29.95 fps), 30% / 45%. Both are H.264 High at level 5.1, BT.709, video range.
  • No control telemetry: 0.36.0's CPU-path takes stop at the smoke's recording-authority wait before the report is written. At that point its 1440p30 compositor ran 29.7 fps with a 36.3 ms frame-time p95, over the 33.3 ms budget.

Gates: cargo ftest windows_d3d11_session 40/40, cargo clippy --all-targets -D warnings and --release -D warnings clean, cargo fmt --check, check-text-files, and the related node --test suites 49/49.

Risk

The larger sizes have now run on a discrete NVIDIA GPU and on the weakest supported iGPU class (UHD 620). Neither composed too slowly or dropped frames. An encoder refusal still falls back with a named reason. Untested: an unsupported device (natural fallback) and AMD hardware.

🤖 Generated with Claude Code

Summary by CodeRabbit

  • New Features
    • Windows D3D11 recording supports additional high-resolution profiles within its expanded limits, including 1440p at 60 fps, 4K at 30 fps, and portrait formats.
  • Bug Fixes
    • Outputs beyond supported limits, including 4K at 60 fps, use the fallback recording path in automatic mode. In required mode, unsupported outputs fail instead of falling back.

The D3D11 session selector refused every output past 1920x1080, so 1440p30/60,
4K30 and the 1440p/4K portrait twins recorded through the CPU compositor and
uploaded system-memory NV12 to Media Foundation. It now takes every output
inside H.264 level 5.1 (36,864 macroblocks a frame, 983,040 a second, no side
past 4096). 4K60 needs level 5.2 and keeps its named fallback; an encoder
that refuses a size still fails the pump's startup into the named fallback.

On the GTX 1650 SUPER host, 20 s takes under process telemetry: 1440p60 goes
from 54.6 fps at 252% backend CPU to 59.95 fps at 45%; 4K30 from a 12%
duration stretch at 286% to 30.00 fps at 28%. Every profile reports zero
capture readbacks, CPU compositor frames, system-memory encoder samples and
raw-FIFO copies. Record keeps the Clips hand-over at 1440p.

The encoded-bridge smoke now requires direct D3D11 recording for the portrait
profiles too; vertical 1080p already ran on D3D11 and failed the smoke's
CPU-compositor check.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@coderabbitai

coderabbitai Bot commented Nov 20, 2026 •

Copy link
Copy Markdown

Explain Change →

Important

Review skipped

Review was skipped as selected files did not have any reviewable changes.

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: defaults
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 8ceff662-e54a-4572-8c4d-b20cd5c64bc3
Commits

Reviewing files that changed from the base of the PR and between 04588e0 and 252cc81.

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • Trigger review

No actionable comments were generated in the recent review.

Walkthrough

The D3D11 selector now evaluates output dimensions and frame rate against H.264 level 5.1 limits. It admits qualifying 1440p and 4K30 profiles and routes outputs such as 4K60 or oversized profiles to fallback behavior. Rust tests, smoke requirements, and the acceptance report are updated.

Changes: D3D11 Output Qualification

Layer / File(s) Summary
Level 5.1 eligibility and fallback details
crates/videorc-backend/src/windows_d3d11_session.rs
The selector now checks maximum side length, macroblocks per frame, and macroblocks per second. Primary and auxiliary fallback details report the output dimensions and frame rate.
Profile validation and acceptance coverage
crates/videorc-backend/src/windows_d3d11_session.rs, scripts/lib/windows-d3d11-media.mjs, scripts/smoke-windows-encoded-bridge.mjs, docs/acceptance/2026-11-20-windows-d3d11-1440p-4k.md
Rust tests cover qualifying profiles and fallback cases. The smoke requirement now includes portrait profiles. The acceptance report records profile results and performance measurements.

Estimated code review effort: 3 (Moderate) | ~25 minutes

Change: Refactor

Suggested reviewers: theorcdev

Merge Risk: Minimal · previous review 04588

This change lets 1440p and 4K30 recordings on Windows use the D3D11 path, and 4K60 keeps its existing fallback. Measurements on two hosts are reported to pass. No concrete merge-blocking risk was found.

Pre-merge checks: Passed 4

Check name Status Explanation
Title check Passed The title names the main change: recording 1440p and 4K30 on the D3D11 texture path for Windows. The raw summary shows the selector now accepts outputs up to H.264 level 5.1 limits, which covers 1440p…
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.
Description Check Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Full details: Title check

Explanation

The title names the main change: recording 1440p and 4K30 on the D3D11 texture path for Windows. The raw summary shows the selector now accepts outputs up to H.264 level 5.1 limits, which covers 1440p and 4K30, and the objectives describe the same widening. The title does not mention the encoded-bridge smoke changes or the new acceptance report, but it does not need to cover every detail. The reference to #173 is an issue number and does not affect relevance.

Finishing Touches

Generate unit tests (beta)

  • Commit to this branch
  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

Recent review info

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: defaults
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: f558d70d-b6f1-49a5-b110-7bbf7584a9b6
Commits

Reviewing files that changed from the base of the PR and between 31777e1 and 04588e0.

Files selected for processing: 1

  • docs/acceptance/2026-11-20-windows-d3d11-1440p-4k.md
Files skipped from review as they are similar to previous changes: 1

  • docs/acceptance/2026-11-20-windows-d3d11-1440p-4k.md

Included review availability: This review used your included allowance. Your plan provides up to 4 included reviews per hour; 3 remain after this review.

… required list (#173)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…173)

The second host for the widened selector: on the weakest supported class all
12 encoded-bridge profiles record on D3D11 with this branch, where 0.36.0
falls back to the CPU compositor at every 1440p and 4K size. 20 s takes hold
59.90 fps at 1440p60 and 29.95 fps at 4K30, H.264 level 5.1, BT.709.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

This branch has not been deployed

No deployments
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