Add new functions reserving address range to Memory Manager

Change-Id: I947203c24495c9e5a206b95bb0c69440824586b6
Signed-off-by: Zbigniew Zdanowicz <zbigniew.zdanowicz@intel.com>
This commit is contained in:
Zbigniew Zdanowicz
2019-03-13 15:31:46 +01:00
committed by sys_ocldev
parent 669d19297c
commit cdb52400c4
16 changed files with 112 additions and 35 deletions

View File

@@ -1758,3 +1758,15 @@ TEST(MemoryManagerCopyMemoryTest, givenValidAllocationAndMemoryWhenCopyMemoryToA
EXPECT_TRUE(memoryManager.copyMemoryToAllocation(&allocation, &memory, sizeof(memory)));
EXPECT_EQ(memory, allocationStorage[0]);
}
TEST_F(MemoryAllocatorTest, whenReservingAddressRangeThenExpectProperAddressAndReleaseWhenFreeing) {
size_t size = 0x1000;
auto allocation = memoryManager->allocateGraphicsMemoryWithProperties(MockAllocationProperties{size});
ASSERT_NE(nullptr, allocation);
void *reserve = memoryManager->reserveCpuAddressRange(size);
EXPECT_NE(nullptr, reserve);
allocation->setReservedAddressRange(reserve, size);
EXPECT_EQ(reserve, allocation->getReservedAddressPtr());
EXPECT_EQ(size, allocation->getReservedAddressSize());
memoryManager->freeGraphicsMemory(allocation);
}