fix: signal notify field before KMD wait

Related-To: NEO-13870

Currently all monitor fences are triggering
interrupt due to Notify Enable field.
With this change, such field is programmed
right before KMD wait.

Signed-off-by: Szymon Morek <szymon.morek@intel.com>
This commit is contained in:
Szymon Morek
2025-03-04 13:29:33 +00:00
committed by Compute-Runtime-Automation
parent fffe8f8027
commit ff4da67979
21 changed files with 130 additions and 51 deletions

View File

@@ -311,7 +311,7 @@ class CommandStreamReceiver : NEO::NonCopyableAndNonMovableClass {
virtual SubmissionStatus flushTagUpdate() = 0;
virtual void updateTagFromWait() = 0;
virtual bool isUpdateTagFromWaitEnabled() = 0;
virtual void flushMonitorFence(){};
virtual void flushMonitorFence(bool notifyKmd){};
virtual bool isTlbFlushRequiredForStateCacheFlush();
ScratchSpaceController *getScratchSpaceController() const {

View File

@@ -96,7 +96,7 @@ class DirectSubmissionHw {
return relaxedOrderingEnabled;
}
virtual void flushMonitorFence(){};
virtual void flushMonitorFence(bool notifyKmd){};
QueueThrottle getLastSubmittedThrottle() {
return this->lastSubmittedThrottle;
@@ -263,5 +263,6 @@ class DirectSubmissionHw {
bool relaxedOrderingInitialized = false;
bool relaxedOrderingSchedulerRequired = false;
bool inputMonitorFenceDispatchRequirement = true;
bool notifyKmdDuringMonitorFence = false;
};
} // namespace NEO

View File

@@ -531,7 +531,7 @@ bool DirectSubmissionHw<GfxFamily, Dispatcher>::stopRingBuffer(bool blocking) {
if (disableMonitorFence) {
TagData currentTagData = {};
getTagAddressValue(currentTagData);
Dispatcher::dispatchMonitorFence(ringCommandStream, currentTagData.tagAddress, currentTagData.tagValue, this->rootDeviceEnvironment, this->partitionedMode, this->dcFlushRequired);
Dispatcher::dispatchMonitorFence(ringCommandStream, currentTagData.tagAddress, currentTagData.tagValue, this->rootDeviceEnvironment, this->partitionedMode, this->dcFlushRequired, this->notifyKmdDuringMonitorFence);
}
Dispatcher::dispatchStopCommandBuffer(ringCommandStream);
@@ -618,7 +618,7 @@ inline void DirectSubmissionHw<GfxFamily, Dispatcher>::dispatchSwitchRingBufferS
if (disableMonitorFence) {
TagData currentTagData = {};
getTagAddressValue(currentTagData);
Dispatcher::dispatchMonitorFence(ringCommandStream, currentTagData.tagAddress, currentTagData.tagValue, this->rootDeviceEnvironment, this->partitionedMode, this->dcFlushRequired);
Dispatcher::dispatchMonitorFence(ringCommandStream, currentTagData.tagAddress, currentTagData.tagValue, this->rootDeviceEnvironment, this->partitionedMode, this->dcFlushRequired, this->notifyKmdDuringMonitorFence);
}
Dispatcher::dispatchStartCommandBuffer(ringCommandStream, nextBufferGpuAddress);
}
@@ -767,7 +767,7 @@ void *DirectSubmissionHw<GfxFamily, Dispatcher>::dispatchWorkloadSection(BatchBu
if (dispatchMonitorFence) {
TagData currentTagData = {};
getTagAddressValue(currentTagData);
Dispatcher::dispatchMonitorFence(ringCommandStream, currentTagData.tagAddress, currentTagData.tagValue, this->rootDeviceEnvironment, this->partitionedMode, this->dcFlushRequired);
Dispatcher::dispatchMonitorFence(ringCommandStream, currentTagData.tagAddress, currentTagData.tagValue, this->rootDeviceEnvironment, this->partitionedMode, this->dcFlushRequired, this->notifyKmdDuringMonitorFence);
}
dispatchSemaphoreSection(currentQueueWorkCount + 1);

View File

@@ -24,7 +24,8 @@ class BlitterDispatcher : public Dispatcher<GfxFamily> {
uint64_t immediateData,
const RootDeviceEnvironment &rootDeviceEnvironment,
bool partitionedWorkload,
bool dcFlushRequired);
bool dcFlushRequired,
bool notifyKmd);
static size_t getSizeMonitorFence(const RootDeviceEnvironment &rootDeviceEnvironment);
static void dispatchCacheFlush(LinearStream &cmdBuffer, const RootDeviceEnvironment &rootDeviceEnvironment, uint64_t address);

View File

@@ -29,11 +29,12 @@ inline void BlitterDispatcher<GfxFamily>::dispatchMonitorFence(LinearStream &cmd
uint64_t immediateData,
const RootDeviceEnvironment &rootDeviceEnvironment,
bool partitionedWorkload,
bool dcFlushRequired) {
bool dcFlushRequired,
bool notifyKmd) {
NEO::EncodeDummyBlitWaArgs waArgs{false, const_cast<RootDeviceEnvironment *>(&rootDeviceEnvironment)};
MiFlushArgs args{waArgs};
args.commandWithPostSync = true;
args.notifyEnable = true;
args.notifyEnable = notifyKmd;
EncodeMiFlushDW<GfxFamily>::programWithWa(cmdBuffer, gpuAddress, immediateData, args);
}

View File

@@ -24,7 +24,8 @@ class RenderDispatcher : public Dispatcher<GfxFamily> {
uint64_t immediateData,
const RootDeviceEnvironment &rootDeviceEnvironment,
bool partitionedWorkload,
bool dcFlushRequired);
bool dcFlushRequired,
bool notifyKmd);
static size_t getSizeMonitorFence(const RootDeviceEnvironment &rootDeviceEnvironment);
static void dispatchCacheFlush(LinearStream &cmdBuffer, const RootDeviceEnvironment &rootDeviceEnvironment, uint64_t address);

View File

@@ -30,11 +30,12 @@ inline void RenderDispatcher<GfxFamily>::dispatchMonitorFence(LinearStream &cmdB
uint64_t immediateData,
const RootDeviceEnvironment &rootDeviceEnvironment,
bool partitionedWorkload,
bool dcFlushRequired) {
bool dcFlushRequired,
bool notifyKmd) {
PipeControlArgs args;
args.dcFlushEnable = dcFlushRequired;
args.workloadPartitionOffset = partitionedWorkload;
args.notifyEnable = true;
args.notifyEnable = notifyKmd;
args.textureCacheInvalidationEnable = true;
MemorySynchronizationCommands<GfxFamily>::addBarrierWithPostSyncOperation(

View File

@@ -90,6 +90,7 @@ DrmDirectSubmission<GfxFamily, Dispatcher>::DrmDirectSubmission(const DirectSubm
}
}
}
this->notifyKmdDuringMonitorFence = true;
}
template <typename GfxFamily, typename Dispatcher>

View File

@@ -24,7 +24,7 @@ class WddmDirectSubmission : public DirectSubmissionHw<GfxFamily, Dispatcher> {
~WddmDirectSubmission() override;
void flushMonitorFence() override;
void flushMonitorFence(bool notifyKmd) override;
void unblockPagingFenceSemaphore(uint64_t pagingFenceValue) override;
protected:

View File

@@ -54,7 +54,7 @@ WddmDirectSubmission<GfxFamily, Dispatcher>::~WddmDirectSubmission() {
}
template <typename GfxFamily, typename Dispatcher>
inline void WddmDirectSubmission<GfxFamily, Dispatcher>::flushMonitorFence() {
inline void WddmDirectSubmission<GfxFamily, Dispatcher>::flushMonitorFence(bool notifyKmd) {
auto needStart = !this->ringStart;
size_t requiredMinimalSize = this->getSizeSemaphoreSection(false) +
@@ -70,7 +70,7 @@ inline void WddmDirectSubmission<GfxFamily, Dispatcher>::flushMonitorFence() {
TagData currentTagData = {};
this->getTagAddressValue(currentTagData);
Dispatcher::dispatchMonitorFence(this->ringCommandStream, currentTagData.tagAddress, currentTagData.tagValue, this->rootDeviceEnvironment, this->partitionedMode, this->dcFlushRequired);
Dispatcher::dispatchMonitorFence(this->ringCommandStream, currentTagData.tagAddress, currentTagData.tagValue, this->rootDeviceEnvironment, this->partitionedMode, this->dcFlushRequired, notifyKmd);
this->dispatchSemaphoreSection(this->currentQueueWorkCount + 1);
this->submitCommandBufferToGpu(needStart, startVA, requiredMinimalSize, true, nullptr);

View File

@@ -1185,14 +1185,17 @@ bool Wddm::waitFromCpu(uint64_t lastFenceValue, const MonitoredFence &monitoredF
NTSTATUS status = STATUS_SUCCESS;
if (!skipResourceCleanup() && lastFenceValue > *monitoredFence.cpuAddress) {
if (lastFenceValue > monitoredFence.lastSubmittedFence) {
this->forEachContextWithinWddm([&monitoredFence](const EngineControl &engine) {
auto &contextMonitoredFence = static_cast<OsContextWin *>(engine.osContext)->getResidencyController().getMonitoredFence();
if (contextMonitoredFence.cpuAddress == monitoredFence.cpuAddress) {
auto lock = engine.commandStreamReceiver->obtainUniqueOwnership();
engine.commandStreamReceiver->flushMonitorFence();
}
});
CommandStreamReceiver *csr = nullptr;
this->forEachContextWithinWddm([&monitoredFence, &csr](const EngineControl &engine) {
auto &contextMonitoredFence = static_cast<OsContextWin *>(engine.osContext)->getResidencyController().getMonitoredFence();
if (contextMonitoredFence.cpuAddress == monitoredFence.cpuAddress) {
csr = engine.commandStreamReceiver;
}
});
if (csr != nullptr && lastFenceValue > monitoredFence.lastSubmittedFence) {
auto lock = csr->obtainUniqueOwnership();
csr->flushMonitorFence(false);
}
if (busyWait) {
@@ -1206,6 +1209,11 @@ bool Wddm::waitFromCpu(uint64_t lastFenceValue, const MonitoredFence &monitoredF
}
if (lastFenceValue > *monitoredFence.cpuAddress) {
if (csr != nullptr) {
// Flush monitor fence to emit KMD interrupt.
auto lock = csr->obtainUniqueOwnership();
csr->flushMonitorFence(true);
}
D3DKMT_WAITFORSYNCHRONIZATIONOBJECTFROMCPU waitFromCpu = {};
waitFromCpu.ObjectCount = 1;
waitFromCpu.ObjectHandleArray = &monitoredFence.fenceHandle;
@@ -1216,7 +1224,6 @@ bool Wddm::waitFromCpu(uint64_t lastFenceValue, const MonitoredFence &monitoredF
DEBUG_BREAK_IF(status != STATUS_SUCCESS);
}
}
return status == STATUS_SUCCESS;
}

View File

@@ -1,5 +1,5 @@
/*
* Copyright (C) 2018-2024 Intel Corporation
* Copyright (C) 2018-2025 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
@@ -36,7 +36,7 @@ class WddmCommandStreamReceiver : public DeviceCommandStreamReceiver<GfxFamily>
return wddm;
}
GmmPageTableMngr *createPageTableManager() override;
void flushMonitorFence() override;
void flushMonitorFence(bool notifyKmd) override;
void setupContext(OsContext &osContext) override;
using CommandStreamReceiver::pageTableManager;

View File

@@ -1,5 +1,5 @@
/*
* Copyright (C) 2018-2024 Intel Corporation
* Copyright (C) 2018-2025 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
@@ -186,11 +186,11 @@ GmmPageTableMngr *WddmCommandStreamReceiver<GfxFamily>::createPageTableManager()
}
template <typename GfxFamily>
void WddmCommandStreamReceiver<GfxFamily>::flushMonitorFence() {
void WddmCommandStreamReceiver<GfxFamily>::flushMonitorFence(bool notifyKmd) {
if (this->directSubmission.get()) {
this->directSubmission->flushMonitorFence();
this->directSubmission->flushMonitorFence(notifyKmd);
} else if (this->blitterDirectSubmission.get()) {
this->blitterDirectSubmission->flushMonitorFence();
this->blitterDirectSubmission->flushMonitorFence(notifyKmd);
}
}
template <typename GfxFamily>

View File

@@ -61,6 +61,7 @@ struct MockDirectSubmissionHw : public DirectSubmissionHw<GfxFamily, Dispatcher>
using BaseClass::isDisablePrefetcherRequired;
using BaseClass::lastSubmittedThrottle;
using BaseClass::miMemFenceRequired;
using BaseClass::notifyKmdDuringMonitorFence;
using BaseClass::osContext;
using BaseClass::partitionConfigSet;
using BaseClass::partitionedMode;

View File

@@ -560,7 +560,7 @@ HWTEST_F(DirectSubmissionTest, givenDirectSubmissionWhenDispatchTagUpdateSection
bool ret = directSubmission.initialize(false);
EXPECT_TRUE(ret);
Dispatcher::dispatchMonitorFence(directSubmission.ringCommandStream, 0ull, 0ull, directSubmission.rootDeviceEnvironment, false, directSubmission.dcFlushRequired);
Dispatcher::dispatchMonitorFence(directSubmission.ringCommandStream, 0ull, 0ull, directSubmission.rootDeviceEnvironment, false, directSubmission.dcFlushRequired, false);
EXPECT_NE(0x0u, directSubmission.ringCommandStream.getUsed());
EXPECT_EQ(Dispatcher::getSizeMonitorFence(directSubmission.rootDeviceEnvironment), directSubmission.ringCommandStream.getUsed());
}

View File

@@ -954,7 +954,7 @@ HWCMDTEST_F(IGFX_XE_HP_CORE, DirectSubmissionDispatchBufferTest,
}
HWTEST_F(DirectSubmissionDispatchBufferTest,
givenRenderDirectSubmissionWhenDispatchWorkloadCalledWithMonitorFenceThenExpectPostSyncOperationWithNotifyFlag) {
givenRenderDirectSubmissionWhenDispatchWorkloadCalledWithMonitorFenceThenExpectPostSyncOperationWithoutNotifyFlag) {
using PIPE_CONTROL = typename FamilyType::PIPE_CONTROL;
using POST_SYNC_OPERATION = typename PIPE_CONTROL::POST_SYNC_OPERATION;
using Dispatcher = RenderDispatcher<FamilyType>;
@@ -981,7 +981,7 @@ HWTEST_F(DirectSubmissionDispatchBufferTest,
auto pipeControl = genCmdCast<PIPE_CONTROL *>(*it);
if (pipeControl->getPostSyncOperation() == POST_SYNC_OPERATION::POST_SYNC_OPERATION_WRITE_IMMEDIATE_DATA) {
foundFenceUpdate = true;
EXPECT_TRUE(pipeControl->getNotifyEnable());
EXPECT_FALSE(pipeControl->getNotifyEnable());
break;
}
}
@@ -989,7 +989,7 @@ HWTEST_F(DirectSubmissionDispatchBufferTest,
}
HWTEST_F(DirectSubmissionDispatchBufferTest,
givenBlitterDirectSubmissionUsingNotifyEnabledWhenDispatchWorkloadCalledWithMonitorFenceThenExpectPostSyncOperationWithNotifyFlag) {
givenBlitterDirectSubmissionWhenDispatchWorkloadCalledWithMonitorFenceThenExpectPostSyncOperationWithoutNotifyFlag) {
using MI_FLUSH_DW = typename FamilyType::MI_FLUSH_DW;
using Dispatcher = BlitterDispatcher<FamilyType>;
@@ -1015,7 +1015,43 @@ HWTEST_F(DirectSubmissionDispatchBufferTest,
auto miFlush = genCmdCast<MI_FLUSH_DW *>(*it);
if (miFlush->getPostSyncOperation() == MI_FLUSH_DW::POST_SYNC_OPERATION_WRITE_IMMEDIATE_DATA_QWORD) {
foundFenceUpdate = true;
EXPECT_TRUE(miFlush->getNotifyEnable());
EXPECT_FALSE(miFlush->getNotifyEnable());
break;
}
}
EXPECT_TRUE(foundFenceUpdate);
}
HWTEST_F(DirectSubmissionDispatchBufferTest,
givenRenderDirectSubmissionWhenDispatchWorkloadCalledWithMonitorFenceAndNotifyEnableRequiredThenExpectPostSyncOperationWithNotifyFlag) {
using PIPE_CONTROL = typename FamilyType::PIPE_CONTROL;
using POST_SYNC_OPERATION = typename PIPE_CONTROL::POST_SYNC_OPERATION;
using Dispatcher = RenderDispatcher<FamilyType>;
FlushStampTracker flushStamp(true);
MockDirectSubmissionHw<FamilyType, Dispatcher> directSubmission(*pDevice->getDefaultEngine().commandStreamReceiver);
directSubmission.disableMonitorFence = false;
directSubmission.notifyKmdDuringMonitorFence = true;
bool ret = directSubmission.initialize(true);
EXPECT_TRUE(ret);
size_t sizeUsedBefore = directSubmission.ringCommandStream.getUsed();
ret = directSubmission.dispatchCommandBuffer(batchBuffer, flushStamp);
EXPECT_TRUE(ret);
HardwareParse hwParse;
hwParse.parsePipeControl = true;
hwParse.parseCommands<FamilyType>(directSubmission.ringCommandStream, sizeUsedBefore);
hwParse.findHardwareCommands<FamilyType>();
bool foundFenceUpdate = false;
for (auto it = hwParse.pipeControlList.begin(); it != hwParse.pipeControlList.end(); it++) {
auto pipeControl = genCmdCast<PIPE_CONTROL *>(*it);
if (pipeControl->getPostSyncOperation() == POST_SYNC_OPERATION::POST_SYNC_OPERATION_WRITE_IMMEDIATE_DATA) {
foundFenceUpdate = true;
EXPECT_TRUE(pipeControl->getNotifyEnable());
break;
}
}

View File

@@ -41,7 +41,7 @@ HWTEST_F(BlitterDispatcheTest, givenBlitterWhenDispatchingMonitorFenceCmdThenDis
uint64_t expectedGpuAddress = 0x5100ull;
uint64_t expectedValue = 0x1234ull;
BlitterDispatcher<FamilyType>::dispatchMonitorFence(cmdBuffer, expectedGpuAddress, expectedValue, pDevice->getRootDeviceEnvironment(), false, false);
BlitterDispatcher<FamilyType>::dispatchMonitorFence(cmdBuffer, expectedGpuAddress, expectedValue, pDevice->getRootDeviceEnvironment(), false, false, false);
EXPECT_EQ(expectedSize, cmdBuffer.getUsed());

View File

@@ -65,7 +65,7 @@ HWTEST_F(RenderDispatcherTest, givenRenderWhenAddingMonitorFenceCmdThenExpectPip
uint64_t gpuVa = 0xFF00FF0000ull;
uint64_t value = 0x102030;
RenderDispatcher<FamilyType>::dispatchMonitorFence(cmdBuffer, gpuVa, value, this->pDevice->getRootDeviceEnvironment(), false, false);
RenderDispatcher<FamilyType>::dispatchMonitorFence(cmdBuffer, gpuVa, value, this->pDevice->getRootDeviceEnvironment(), false, false, false);
HardwareParse hwParse;
hwParse.parseCommands<FamilyType>(cmdBuffer);
@@ -127,7 +127,7 @@ HWCMDTEST_F(IGFX_XE_HP_CORE, RenderDispatcherTest,
uint64_t gpuVa = 0xBADA550000ull;
uint64_t value = 0x102030;
RenderDispatcher<FamilyType>::dispatchMonitorFence(cmdBuffer, gpuVa, value, this->pDevice->getRootDeviceEnvironment(), true, false);
RenderDispatcher<FamilyType>::dispatchMonitorFence(cmdBuffer, gpuVa, value, this->pDevice->getRootDeviceEnvironment(), true, false, true);
HardwareParse hwParse;
hwParse.parsePipeControl = true;
@@ -162,7 +162,7 @@ HWTEST_F(RenderDispatcherTest, givenRenderWithDcFlushFlagTrueWhenAddingMonitorFe
uint64_t gpuVa = 0xFF00FF0000ull;
uint64_t value = 0x102030;
RenderDispatcher<FamilyType>::dispatchMonitorFence(cmdBuffer, gpuVa, value, this->pDevice->getRootDeviceEnvironment(), false, true);
RenderDispatcher<FamilyType>::dispatchMonitorFence(cmdBuffer, gpuVa, value, this->pDevice->getRootDeviceEnvironment(), false, true, false);
HardwareParse hwParse;
hwParse.parseCommands<FamilyType>(cmdBuffer);

View File

@@ -368,19 +368,42 @@ HWTEST_F(WddmDirectSubmissionTest, givenWddmWhenSwitchingRingBufferNotStartedThe
EXPECT_EQ(nullptr, bbStart);
}
HWTEST_F(WddmDirectSubmissionTest, givenWddmDirectSubmissionWhenDispatchMonitorFenceThenProgramPipeControl) {
HWTEST_F(WddmDirectSubmissionTest, givenWddmDirectSubmissionWhenDispatchMonitorFenceAndNotifyKmdDisabledThenProgramPipeControlWithoutNotifyEnable) {
using PIPE_CONTROL = typename FamilyType::PIPE_CONTROL;
MockWddmDirectSubmission<FamilyType, RenderDispatcher<FamilyType>> wddmDirectSubmission(*device->getDefaultEngine().commandStreamReceiver);
bool ret = wddmDirectSubmission.initialize(false);
EXPECT_TRUE(ret);
wddmDirectSubmission.flushMonitorFence();
auto currOffset = wddmDirectSubmission.ringCommandStream.getUsed();
wddmDirectSubmission.flushMonitorFence(false);
HardwareParse hwParse;
hwParse.parseCommands<FamilyType>(wddmDirectSubmission.ringCommandStream, 0u);
auto pipeControl = hwParse.getCommand<PIPE_CONTROL>();
EXPECT_NE(nullptr, pipeControl);
hwParse.parseCommands<FamilyType>(wddmDirectSubmission.ringCommandStream, currOffset);
auto pipeControls = hwParse.getCommandsList<PIPE_CONTROL>();
bool isNotifyEnabledProgrammed = false;
for (auto &pipeControl : pipeControls) {
isNotifyEnabledProgrammed |= reinterpret_cast<PIPE_CONTROL *>(pipeControl)->getNotifyEnable();
}
EXPECT_FALSE(isNotifyEnabledProgrammed);
}
HWTEST_F(WddmDirectSubmissionTest, givenWddmDirectSubmissionWhenDispatchMonitorFenceAndNotifyKmdEnabledThenProgramPipeControlWithNotifyEnable) {
using PIPE_CONTROL = typename FamilyType::PIPE_CONTROL;
MockWddmDirectSubmission<FamilyType, RenderDispatcher<FamilyType>> wddmDirectSubmission(*device->getDefaultEngine().commandStreamReceiver);
bool ret = wddmDirectSubmission.initialize(false);
EXPECT_TRUE(ret);
auto currOffset = wddmDirectSubmission.ringCommandStream.getUsed();
wddmDirectSubmission.flushMonitorFence(true);
HardwareParse hwParse;
hwParse.parseCommands<FamilyType>(wddmDirectSubmission.ringCommandStream, currOffset);
auto pipeControls = hwParse.getCommandsList<PIPE_CONTROL>();
bool isNotifyEnabledProgrammed = false;
for (auto &pipeControl : pipeControls) {
isNotifyEnabledProgrammed |= reinterpret_cast<PIPE_CONTROL *>(pipeControl)->getNotifyEnable();
}
EXPECT_TRUE(isNotifyEnabledProgrammed);
}
HWTEST_F(WddmDirectSubmissionTest, givenDirectSubmissionNewResourceTlbFlushWhenHandleNewResourcesSubmissionThenDispatchProperCommands) {
@@ -809,7 +832,7 @@ HWTEST_F(WddmDirectSubmissionTest,
}
HWTEST_F(WddmDirectSubmissionTest,
givenRenderDirectSubmissionWithDisabledMonitorFenceWhenMonitorFenceDispatchedThenDispatchPostSyncOperation) {
givenRenderDirectSubmissionWithDisabledMonitorFenceWhenMonitorFenceDispatchedThenDispatchPostSyncOperationWithoutNotifyFlag) {
using PIPE_CONTROL = typename FamilyType::PIPE_CONTROL;
using POST_SYNC_OPERATION = typename PIPE_CONTROL::POST_SYNC_OPERATION;
using Dispatcher = RenderDispatcher<FamilyType>;
@@ -863,7 +886,7 @@ HWTEST_F(WddmDirectSubmissionTest,
uint64_t pipeControlPostSyncAddress = UnitTestHelper<FamilyType>::getPipeControlPostSyncAddress(*pipeControl);
if (pipeControlPostSyncAddress == monitorFence.gpuAddress) {
foundFenceUpdate = true;
EXPECT_TRUE(pipeControl->getNotifyEnable());
EXPECT_FALSE(pipeControl->getNotifyEnable());
break;
}
}

View File

@@ -1114,12 +1114,14 @@ struct MockWddmDrmDirectSubmissionDispatchCommandBuffer : public MockWddmDirectS
return false;
}
void flushMonitorFence() override {
void flushMonitorFence(bool notifyKmd) override {
flushMonitorFenceCalled++;
lastNotifyKmdParamValue = notifyKmd;
}
uint32_t dispatchCommandBufferCalled = 0;
uint32_t flushMonitorFenceCalled = 0u;
uint32_t lastNotifyKmdParamValue = false;
};
HWTEST_TEMPLATED_F(WddmCommandStreamMockGdiTest, givenCsrWhenFlushMonitorFenceThenFlushMonitorFenceOnDirectSubmission) {
@@ -1152,7 +1154,7 @@ HWTEST_TEMPLATED_F(WddmCommandStreamMockGdiTest, givenCsrWhenFlushMonitorFenceTh
auto directSubmission = reinterpret_cast<MockSubmission *>(mockCsr->directSubmission.get());
EXPECT_EQ(directSubmission->flushMonitorFenceCalled, 0u);
csr->flushMonitorFence();
csr->flushMonitorFence(false);
EXPECT_EQ(directSubmission->flushMonitorFenceCalled, 1u);
}
@@ -1178,11 +1180,11 @@ HWTEST_TEMPLATED_F(WddmCommandStreamMockGdiTest, givenDirectSubmissionEnabledOnB
EXPECT_TRUE(csr->isBlitterDirectSubmissionEnabled());
EXPECT_EQ(directSubmission->flushMonitorFenceCalled, 0u);
csr->flushMonitorFence();
csr->flushMonitorFence(false);
EXPECT_EQ(directSubmission->flushMonitorFenceCalled, 1u);
}
HWTEST_TEMPLATED_F(WddmCommandStreamMockGdiTest, givenLastSubmittedFenceLowerThanFenceValueToWaitWhenWaitFromCpuThenFlushMonitorFence) {
HWTEST_TEMPLATED_F(WddmCommandStreamMockGdiTest, givenLastSubmittedFenceLowerThanFenceValueToWaitWhenWaitFromCpuThenFlushMonitorFenceWithNotifyEnabledFlag) {
using Dispatcher = RenderDispatcher<FamilyType>;
using MockSubmission = MockWddmDrmDirectSubmissionDispatchCommandBuffer<FamilyType, Dispatcher>;
auto mockCsr = static_cast<MockWddmCsr<FamilyType> *>(csr);
@@ -1224,7 +1226,8 @@ HWTEST_TEMPLATED_F(WddmCommandStreamMockGdiTest, givenLastSubmittedFenceLowerTha
static_cast<OsContextWin *>(device->getDefaultEngine().osContext)->getResidencyController().resetMonitoredFenceParams(handle, &value, gpuVa);
wddm->waitFromCpu(1, monitorFence, false);
EXPECT_EQ(directSubmission->flushMonitorFenceCalled, 1u);
EXPECT_EQ(directSubmission->flushMonitorFenceCalled, 2u);
EXPECT_TRUE(directSubmission->lastNotifyKmdParamValue);
}
HWTEST_TEMPLATED_F(WddmCommandStreamMockGdiTest, givenDirectSubmissionFailsThenFlushReturnsError) {

View File

@@ -931,6 +931,7 @@ using WddmSkipResourceCleanupFixtureTests = Test<WddmSkipResourceCleanupFixtureW
TEST_F(WddmSkipResourceCleanupFixtureTests, givenWaitForSynchronizationObjectFromCpuWhenSkipResourceCleanupIsTrueThenSuccessIsReturnedAndGdiFunctionIsNotCalled) {
VariableBackup<uint64_t> varBackup(&waitForSynchronizationObjectFromCpuCounter);
init();
executionEnvironment->initializeMemoryManager();
wddm->skipResourceCleanupVar = true;
EXPECT_TRUE(wddm->skipResourceCleanup());
wddm->getGdi()->waitForSynchronizationObjectFromCpu = &waitForSynchronizationObjectFromCpuNoOpMock;
@@ -942,6 +943,7 @@ TEST_F(WddmSkipResourceCleanupFixtureTests, givenWaitForSynchronizationObjectFro
TEST_F(WddmSkipResourceCleanupFixtureTests, givenWaitForSynchronizationObjectFromCpuWhenSkipResourceCleanupIsFalseThenSuccessIsReturnedAndGdiFunctionIsCalled) {
VariableBackup<uint64_t> varBackup(&waitForSynchronizationObjectFromCpuCounter);
init();
executionEnvironment->initializeMemoryManager();
wddm->skipResourceCleanupVar = false;
EXPECT_FALSE(wddm->skipResourceCleanup());
wddm->getGdi()->waitForSynchronizationObjectFromCpu = &waitForSynchronizationObjectFromCpuNoOpMock;
@@ -958,6 +960,7 @@ TEST_F(WddmSkipResourceCleanupFixtureTests, givenWaitForSynchronizationObjectFro
TEST_F(WddmSkipResourceCleanupFixtureTests, givenWaitForSynchronizationObjectFromCpuWhenSkipResourceCleanupIsFalseAndFenceWasNotUpdatedThenSuccessIsReturnedAndGdiFunctionIsNotCalled) {
VariableBackup<uint64_t> varBackup(&waitForSynchronizationObjectFromCpuCounter);
init();
executionEnvironment->initializeMemoryManager();
wddm->skipResourceCleanupVar = false;
EXPECT_FALSE(wddm->skipResourceCleanup());
wddm->getGdi()->waitForSynchronizationObjectFromCpu = &waitForSynchronizationObjectFromCpuNoOpMock;