Handle missing tag address in getting completion address

rename test fixture to comply one definition rule

Related-To: NEO-6643
Signed-off-by: Mateusz Jablonski <mateusz.jablonski@intel.com>
This commit is contained in:
Mateusz Jablonski
2022-04-01 09:40:06 +00:00
committed by Compute-Runtime-Automation
parent 9cba46e5bf
commit 7910567a76
4 changed files with 37 additions and 9 deletions

View File

@ -72,14 +72,9 @@ struct DrmCommandStreamMultiTileMemExecFixture {
using DrmCommandStreamMultiTileMemExecTest = Test<DrmCommandStreamMultiTileMemExecFixture>;
HWCMDTEST_F(IGFX_XE_HP_CORE, DrmCommandStreamMultiTileMemExecTest, GivenDrmSupportsCompletionFenceAndVmBindWhenCallingCsrExecThenMultipleTagAllocationIsPassed) {
auto osContext = std::make_unique<OsContextLinux>(*mock, 0u, EngineDescriptorHelper::getDefaultDescriptor(device->getDeviceBitfield()));
osContext->ensureContextInitialized();
auto *testCsr = new TestedDrmCommandStreamReceiver<FamilyType>(*executionEnvironment, 0, device->getDeviceBitfield());
auto device = std::unique_ptr<MockDevice>(MockDevice::create<MockDevice>(executionEnvironment, 0));
device->resetCommandStreamReceiver(testCsr);
EXPECT_EQ(2u, testCsr->activePartitions);
testCsr->setupContext(*osContext.get());
mock->completionFenceSupported = true;
mock->isVmBindAvailableCall.callParent = false;

View File

@ -5920,4 +5920,27 @@ TEST_F(DrmMemoryManagerTest, givenCompletionFenceEnabledWhenHandlingCompletionOf
memoryManager->freeGraphicsMemory(allocation);
}
HWTEST_F(DrmMemoryManagerTest, givenCompletionFenceEnabledWhenHandlingCompletionAndTagAddressIsNullThenDoNotCallWaitUserFence) {
mock->ioctl_expected.total = -1;
VariableBackup<bool> backupFenceSupported{&mock->completionFenceSupported, true};
VariableBackup<bool> backupVmBindCallParent{&mock->isVmBindAvailableCall.callParent, false};
VariableBackup<bool> backupVmBindReturnValue{&mock->isVmBindAvailableCall.returnValue, true};
auto allocation = memoryManager->allocateGraphicsMemoryWithProperties(MockAllocationProperties{rootDeviceIndex, 1024, AllocationType::COMMAND_BUFFER});
auto engine = memoryManager->getRegisteredEngines()[0];
allocation->updateTaskCount(2, engine.osContext->getContextId());
auto testCsr = static_cast<TestedDrmCommandStreamReceiver<FamilyType> *>(engine.commandStreamReceiver);
auto backupTagAddress = testCsr->tagAddress;
testCsr->tagAddress = nullptr;
memoryManager->handleFenceCompletion(allocation);
EXPECT_EQ(0u, mock->waitUserFenceCall.called);
testCsr->tagAddress = backupTagAddress;
memoryManager->freeGraphicsMemory(allocation);
}
} // namespace NEO