Destroy resource handle when created

Do not create resource when cpuPtr is set

Signed-off-by: Kamil Diedrich <kamil.diedrich@intel.com>
This commit is contained in:
Kamil Diedrich
2022-08-09 16:31:10 +00:00
committed by Compute-Runtime-Automation
parent 54dc2f2000
commit 011a0dd497
3 changed files with 15 additions and 2 deletions

View File

@ -811,6 +811,19 @@ TEST_F(WddmMemoryManagerTest, givenWddmMemoryManagerWhenFreeAllocFromSharedHandl
EXPECT_EQ(lastDestroyed, expectedDestroyHandle);
}
TEST_F(WddmMemoryManagerTest, givenWddmMemoryManagerWhenAllocFromHostPtrIsCalledThenResourceHandleIsNotCreated) {
auto size = 13u;
auto hostPtr = reinterpret_cast<const void *>(0x10001);
AllocationData allocationData{};
allocationData.size = size;
allocationData.hostPtr = hostPtr;
auto allocation = static_cast<WddmAllocation *>(memoryManager->allocateGraphicsMemoryForNonSvmHostPtr(allocationData));
EXPECT_EQ(0u, allocation->resourceHandle);
memoryManager->freeGraphicsMemory(allocation);
}
TEST_F(WddmMemoryManagerTest, givenWddmMemoryManagerSizeZeroWhenCreateFromSharedHandleIsCalledThenUpdateSize) {
auto osHandle = 1u;
auto size = 4096u;