Add logic to create wddm allocation with many handles

Change-Id: I1eeffddf7108183ad867d2b05d313f0cf6941c01
Signed-off-by: Mateusz Jablonski <mateusz.jablonski@intel.com>
This commit is contained in:
Mateusz Jablonski
2019-03-07 15:14:11 +01:00
committed by sys_ocldev
parent 22c3c10679
commit 6abc3f7d9b
12 changed files with 84 additions and 18 deletions

View File

@@ -1621,3 +1621,25 @@ TEST_F(WddmMemoryManagerSimpleTest, whenDestroyingNotLockedAllocationThatNeedsMa
memoryManager->freeGraphicsMemory(allocation);
EXPECT_EQ(0u, wddm->evictTemporaryResourceResult.called);
}
TEST_F(WddmMemoryManagerSimpleTest, whenDestroyingAllocationWithPreferredGpuAddressThenReleaseTheAddress) {
auto allocation = static_cast<WddmAllocation *>(memoryManager->allocateGraphicsMemoryWithProperties(MockAllocationProperties{MemoryConstants::pageSize}));
uint64_t gpuAddress = 0x123;
allocation->preferredGpuAddress = gpuAddress;
memoryManager->freeGraphicsMemory(allocation);
EXPECT_EQ(1u, wddm->freeGpuVirtualAddressResult.called);
EXPECT_EQ(gpuAddress, wddm->freeGpuVirtualAddressResult.uint64ParamPassed);
}
TEST_F(WddmMemoryManagerSimpleTest, givenAllocationWithPreferredGpuAddressWhenMapCallFailsDuringCreateWddmAllocationThenReleasePreferredAddress) {
MockWddmAllocation allocation;
allocation.setAllocationType(GraphicsAllocation::AllocationType::KERNEL_ISA);
uint64_t gpuAddress = 0x123;
allocation.preferredGpuAddress = gpuAddress;
wddm->callBaseMapGpuVa = false;
wddm->mapGpuVaStatus = false;
memoryManager->createWddmAllocation(&allocation, nullptr);
EXPECT_EQ(1u, wddm->freeGpuVirtualAddressResult.called);
EXPECT_EQ(gpuAddress, wddm->freeGpuVirtualAddressResult.uint64ParamPassed);
}