Skip to content

Commit 3ba0685

Browse files
committed
Fix frames marked as discarded incorrectly
The way FrameView/PresentMon marks the completion of frames is to first just mark frames as 'Presented' when it receives MMIO MPO flip call and then once Win32k providers’ (running within DWM process) TokenStateChange(TokenState::Discarded) event is received it is marked as completed. In certain cases like when there are short bursts of presents, we get multiple back to back flips and token tracking thread ends up marking the second frame in the burst as dropped. To fix this issue, we mark the frame as discarded only if the frame already doesn’t have valid ScreenTime.
1 parent ffbb9ce commit 3ba0685

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

PresentData/PresentMonTraceConsumer.cpp

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
// Copyright (C) 2017-2024 Intel Corporation
2+
// Copyright (c) 2025 NVIDIA CORPORATION & AFFILIATES. All rights reserved
23
// SPDX-License-Identifier: MIT
34

45
#include "PresentMonTraceConsumer.hpp"
@@ -1568,7 +1569,16 @@ void PMTraceConsumer::HandleWin32kEvent(EVENT_RECORD* pEventRecord)
15681569
// collisions during lookup for events that don't reference
15691570
// a context.
15701571
VerboseTraceBeforeModifyingPresent(prevPresent.get());
1571-
prevPresent->FinalState = PresentResult::Discarded;
1572+
1573+
// In certain cases like when there are short bursts of presents,
1574+
// we get multiple back to back flips and token tracking thread
1575+
// ends up marking the first frame in the burst as dropped.
1576+
// To fix this issue, we mark the frame as discarded only if
1577+
// the frame already doesn’t have valid ScreenTime.
1578+
if (!HasScreenTime(prevPresent)) {
1579+
prevPresent->FinalState = PresentResult::Discarded;
1580+
}
1581+
15721582
RemovePresentFromSubmitSequenceIdTracking(prevPresent);
15731583
}
15741584
}

0 commit comments

Comments
 (0)