Skip to content

Viewer: present frames through a DXGI flip-model swap chain - #92

Merged
chammoru merged 1 commit into
masterfrom
agent/issue-90-dxgi-presenter
Aug 19, 2026
Merged

Viewer: present frames through a DXGI flip-model swap chain#92
chammoru merged 1 commit into
masterfrom
agent/issue-90-dxgi-presenter

Conversation

@chammoru

Copy link
Copy Markdown
Owner

Summary

  • replace Viewer HWND GDI presentation with a D3D11/DXGI flip-model swap chain while preserving the existing GDI composition and overlays in a top-down BGRA DIB
  • retain the verified Viewer: possible horizontal tearing during video playback after back-buffer reuse #88 double-DWM-wait path as an automatic fallback and as a developer-selectable path through Q1VIEW_DISABLE_DXGI
  • decode unrotated, unprocessed OpenCV BGR video directly into playback buffers to remove an extra full-frame copy
  • add opt-in Q1VIEW_TRACE_PLAYBACK timing diagnostics for backend, displayed/dropped frames, paint time, and decoder time

Root cause

The existing playback paint path waited for DWM twice per displayed frame. On a 60 Hz desktop this limited the representative 59.94 fps video to about 26–30 displayed fps. Moving completed frames to flip-model swap-chain buffers makes presentation atomic and removes those two waits from the normal path.

Validation

  • C0610_main.mp4 (Sony ZV-1F, 1920×1080 HEVC Main, 60000/1001 fps, 11,700 frames): 11,675 displayed follow-up frames, 24 dropped (0.21%), 195.197 s playback, approximately 59.81 displayed fps; GDI fallback comparison was approximately 26.3 fps
  • exact paused-frame pixel stability, resume, one-frame right/left stepping, synchronized playback between two Viewer processes, EOF, resize, minimize/restore, and full-screen transitions verified through actual Viewer UI automation
  • generated 642×360 59.94 fps H.264 long-GOP video: all 179 follow-up frames displayed with zero drops, including a non-DWORD-aligned source width
  • Core regression tests passed
  • Viewer Release x64 full rebuild: 0 warnings, 0 errors
  • Comparator Release x64 build: 0 warnings, 0 errors

Outstanding manual acceptance

The original #88 tall/portrait seam must still be checked on the affected company 4K display before this PR is marked ready or merged. The Actions artifact from this draft PR is intended for that test.

Closes #90 only after the outstanding 4K acceptance test passes.

@chammoru
chammoru marked this pull request as ready for review August 19, 2026 06:28
@chammoru
chammoru merged commit 1b01fa6 into master Aug 19, 2026
6 of 7 checks passed
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.

Viewer: replace GDI window presentation with a DXGI flip-model swap chain

1 participant