Make sure that resources are not made resident multiple times.

Related-To: NEO-3054

Change-Id: I32d01f8993e8d327ee117a352a8b4bcb1bbb7e30
Signed-off-by: Mrozek, Michal <michal.mrozek@intel.com>
This commit is contained in:
Mrozek, Michal
2019-04-16 15:32:15 +02:00
committed by sys_ocldev
parent a807a7498c
commit 97bc604316
2 changed files with 20 additions and 1 deletions

View File

@ -212,6 +212,21 @@ HWTEST_F(TbxCommandStreamTests, givenTbxCommandStreamReceiverWhenWriteMemoryIsCa
memoryManager->freeGraphicsMemory(graphicsAllocation);
}
HWTEST_F(TbxCommandStreamTests, givenTbxCommandStreamReceiverWhenWriteMemoryIsCalledWithGraphicsAllocationThatIsOnlyOneTimeWriteableThenGraphicsAllocationIsUpdated) {
TbxCommandStreamReceiverHw<FamilyType> *tbxCsr = (TbxCommandStreamReceiverHw<FamilyType> *)pCommandStreamReceiver;
TbxMemoryManager *memoryManager = tbxCsr->getMemoryManager();
ASSERT_NE(nullptr, memoryManager);
auto graphicsAllocation = memoryManager->allocateGraphicsMemoryWithProperties(MockAllocationProperties{MemoryConstants::pageSize, GraphicsAllocation::AllocationType::BUFFER});
ASSERT_NE(nullptr, graphicsAllocation);
EXPECT_TRUE(graphicsAllocation->isAubWritable());
EXPECT_TRUE(tbxCsr->writeMemory(*graphicsAllocation));
EXPECT_FALSE(graphicsAllocation->isAubWritable());
memoryManager->freeGraphicsMemory(graphicsAllocation);
}
HWTEST_F(TbxCommandStreamTests, givenTbxCommandStreamReceiverWhenWriteMemoryIsCalledForGraphicsAllocationWithZeroSizeThenItShouldReturnFalse) {
TbxCommandStreamReceiverHw<FamilyType> *tbxCsr = (TbxCommandStreamReceiverHw<FamilyType> *)pCommandStreamReceiver;
MockGraphicsAllocation graphicsAllocation((void *)0x1234, 0);