Skip to content

Commit 1b7bf69

Browse files
fix: update fence values when residency list passed to switch ring buffer
Signed-off-by: Maciej Plewka <[email protected]>
1 parent 8a85a96 commit 1b7bf69

File tree

2 files changed

+19
-5
lines changed

2 files changed

+19
-5
lines changed

shared/source/direct_submission/windows/wddm_direct_submission.inl

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -128,9 +128,13 @@ void WddmDirectSubmission<GfxFamily, Dispatcher>::handleStopRingBuffer() {
128128
template <typename GfxFamily, typename Dispatcher>
129129
void WddmDirectSubmission<GfxFamily, Dispatcher>::handleSwitchRingBuffers(ResidencyContainer *allocationsForResidency) {
130130
if (this->disableMonitorFence) {
131-
auto lock = osContextWin->getResidencyController().acquireLock();
132-
updateTagValueImpl(this->previousRingBuffer);
133-
updateMonitorFenceValueForResidencyList(allocationsForResidency);
131+
if (allocationsForResidency) {
132+
auto lock = osContextWin->getResidencyController().acquireLock();
133+
updateTagValueImpl(this->previousRingBuffer);
134+
updateMonitorFenceValueForResidencyList(allocationsForResidency);
135+
} else {
136+
updateTagValueImpl(this->previousRingBuffer);
137+
}
134138
}
135139
}
136140

shared/test/unit_test/direct_submission/windows/wddm_direct_submission_tests.cpp

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1131,11 +1131,20 @@ HWTEST_F(WddmDirectSubmissionTest, givenResidencyControllerWhenUpdatingResidency
11311131
EXPECT_EQ(mockGa.updateCompletionDataForAllocationAndFragmentsCalledtimes, 1u);
11321132
}
11331133

1134-
HWTEST_F(WddmDirectSubmissionTest, givenDirectSubmissionWhenSwitchingRingBuffersThenUpdateResidencyCalled) {
1134+
HWTEST_F(WddmDirectSubmissionTest, givenDirectSubmissionWhenSwitchingRingBuffersAndResidencyContainerIsNullThenUpdateResidencyNotCalled) {
11351135
using Dispatcher = RenderDispatcher<FamilyType>;
11361136

11371137
MockWddmDirectSubmission<FamilyType, Dispatcher> wddmDirectSubmission(*device->getDefaultEngine().commandStreamReceiver);
11381138
wddmDirectSubmission.handleSwitchRingBuffers(nullptr);
1139+
EXPECT_EQ(wddmDirectSubmission.updateMonitorFenceValueForResidencyListCalled, 0u);
1140+
}
1141+
1142+
HWTEST_F(WddmDirectSubmissionTest, givenDirectSubmissionWhenSwitchingRingBuffersThenUpdateResidencyCalled) {
1143+
using Dispatcher = RenderDispatcher<FamilyType>;
1144+
1145+
MockWddmDirectSubmission<FamilyType, Dispatcher> wddmDirectSubmission(*device->getDefaultEngine().commandStreamReceiver);
1146+
ResidencyContainer container;
1147+
wddmDirectSubmission.handleSwitchRingBuffers(&container);
11391148
EXPECT_EQ(wddmDirectSubmission.updateMonitorFenceValueForResidencyListCalled, 1u);
11401149
}
11411150

@@ -1157,7 +1166,8 @@ HWTEST_F(WddmDirectSubmissionTest, givenDirectSubmissionWhenSwitchingRingBuffers
11571166

11581167
MyMockWddmDirectSubmission<FamilyType, Dispatcher> wddmDirectSubmission(*device->getDefaultEngine().commandStreamReceiver);
11591168
std::thread th([&]() {
1160-
wddmDirectSubmission.handleSwitchRingBuffers(nullptr);
1169+
ResidencyContainer container;
1170+
wddmDirectSubmission.handleSwitchRingBuffers(&container);
11611171
});
11621172
while (!wddmDirectSubmission.lockInTesting)
11631173
;

0 commit comments

Comments
 (0)