Repository navigation
fix(win32): gate resize-sync DComp detach on two DWM compositions and tick modal drag animations - #2753
Merged
Conversation
… tick animations during modal drag
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Addresses #2113
Root cause
DXGI_SWAP_EFFECT_DISCARDPresent(0, 0)submits its redirection-surface update to DWM asynchronously outside the D3D11 queue, so waiting on a post-present D3D11 fence does not guarantee DWM has ingested and composed the new bitmap beforeIDCompositionTarget::SetRoot(None)commits. For one refresh, DWM exposes the previous drag's stale redirection surface.about_to_waitnever runs, soRedraw::Wantsstays parked after the first paint and animations pause until the nextWM_SIZE.Changes
machine.rs,frame.rs,resize_sync.rs,present.rs,platform/win32.rs):DcompPhase::{Priming { presented_at }, Detached},DETACH_DWM_FRAMES = 2,Event::DragFramePresented, andEffect::DetachDcomp.BeginDragrenders and presents the first drag frame (waiting on the D3D11 post-present fence withWM_ERASEBKGNDsuppression active), samplesDWM_TIMING_INFO::cFrameviaDwmGetCompositionTimingInfo(NULL, ...), and keeps DirectComposition attached.PriminguntilcFrameadvances by at least 2 compositions (re-baselining on a counter reset, and falling back cleanly to normal DirectComposition resize if DWM timing is unavailable so the window never freezes attached). Once detached, steady-state frames skip DWM timing queries.platform/win32/dpi_drag.rs,resize_sync.rs):WM_TIMERonly on state edges while insideWM_ENTERSIZEMOVE..WM_EXITSIZEMOVEand eitheris_priming()oroutcome.animatingis true.bErase = 0so a paused first-step drag finishes detaching after 2 DWM compositions and live animations keep running while holding a border still, then kills the timer immediately once detached and idle (or onWM_EXITSIZEMOVE/ cleanup /WM_NCDESTROY).entry_tests.rs,tests.rs):Verification
cargo check -p rune --libpasses with zero warnings in touched files.cargo test -p rune --lib resize_syncpasses (22 passed, 0 failed).