From e11b7675d5c9b782481eb44c78bcd2a5d94acdc1 Mon Sep 17 00:00:00 2001 From: Piotr Fusik Date: Thu, 28 Feb 2019 09:51:36 +0100 Subject: [PATCH] WddmAllocation constructor accepts allocationType. Change-Id: I1e561b11e78dd942e04f3b029739921d0929ceed Signed-off-by: Piotr Fusik --- .../os_interface/windows/wddm_allocation.h | 8 +-- .../windows/wddm_memory_manager.cpp | 16 ++--- .../memory_manager/memory_manager_tests.cpp | 10 +++ .../linux/drm_memory_manager_tests.cpp | 16 +++++ .../windows/mock_wddm_allocation.h | 2 +- .../os_interface/windows/wddm20_tests.cpp | 65 +++++++++---------- .../windows/wddm_kmdaf_listener_tests.cpp | 8 +-- .../windows/wddm_memory_manager_tests.cpp | 30 +++++++-- .../wddm_residency_controller_tests.cpp | 18 ++--- 9 files changed, 107 insertions(+), 66 deletions(-) diff --git a/runtime/os_interface/windows/wddm_allocation.h b/runtime/os_interface/windows/wddm_allocation.h index f48db7e303..bd4e87a012 100644 --- a/runtime/os_interface/windows/wddm_allocation.h +++ b/runtime/os_interface/windows/wddm_allocation.h @@ -33,16 +33,16 @@ class WddmAllocation : public GraphicsAllocation { D3DGPU_VIRTUAL_ADDRESS gpuPtr; // set by mapGpuVA - WddmAllocation(void *cpuPtrIn, size_t sizeIn, void *reservedAddr, MemoryPool::Type pool, bool multiOsContextCapable) - : GraphicsAllocation(AllocationType::UNKNOWN, cpuPtrIn, castToUint64(cpuPtrIn), 0llu, sizeIn, pool, multiOsContextCapable), + WddmAllocation(AllocationType allocationType, void *cpuPtrIn, size_t sizeIn, void *reservedAddr, MemoryPool::Type pool, bool multiOsContextCapable) + : GraphicsAllocation(allocationType, cpuPtrIn, castToUint64(cpuPtrIn), 0llu, sizeIn, pool, multiOsContextCapable), handle(0), gpuPtr(0), trimCandidateListPositions(maxOsContextCount, trimListUnusedPosition) { reservedAddressSpace = reservedAddr; } - WddmAllocation(void *cpuPtrIn, size_t sizeIn, osHandle sharedHandle, MemoryPool::Type pool, bool multiOsContextCapable) - : GraphicsAllocation(AllocationType::UNKNOWN, cpuPtrIn, sizeIn, sharedHandle, pool, multiOsContextCapable), + WddmAllocation(AllocationType allocationType, void *cpuPtrIn, size_t sizeIn, osHandle sharedHandle, MemoryPool::Type pool, bool multiOsContextCapable) + : GraphicsAllocation(allocationType, cpuPtrIn, sizeIn, sharedHandle, pool, multiOsContextCapable), handle(0), gpuPtr(0), trimCandidateListPositions(maxOsContextCount, trimListUnusedPosition) { diff --git a/runtime/os_interface/windows/wddm_memory_manager.cpp b/runtime/os_interface/windows/wddm_memory_manager.cpp index 4965f93950..28f6f91f85 100644 --- a/runtime/os_interface/windows/wddm_memory_manager.cpp +++ b/runtime/os_interface/windows/wddm_memory_manager.cpp @@ -47,7 +47,7 @@ GraphicsAllocation *WddmMemoryManager::allocateGraphicsMemoryForImageImpl(const return allocateGraphicsMemoryWithAlignment(allocationData); } - auto allocation = std::make_unique(nullptr, allocationData.imgInfo->size, nullptr, MemoryPool::SystemCpuInaccessible, false); + auto allocation = std::make_unique(allocationData.type, nullptr, allocationData.imgInfo->size, nullptr, MemoryPool::SystemCpuInaccessible, false); allocation->gmm = gmm.get(); if (!createWddmAllocation(allocation.get())) { return nullptr; @@ -62,7 +62,7 @@ GraphicsAllocation *WddmMemoryManager::allocateGraphicsMemoryForImageImpl(const GraphicsAllocation *WddmMemoryManager::allocateGraphicsMemory64kb(AllocationData allocationData) { size_t sizeAligned = alignUp(allocationData.size, MemoryConstants::pageSize64k); - auto wddmAllocation = std::make_unique(nullptr, sizeAligned, nullptr, MemoryPool::System64KBPages, !!allocationData.flags.multiOsContextCapable); + auto wddmAllocation = std::make_unique(allocationData.type, nullptr, sizeAligned, nullptr, MemoryPool::System64KBPages, !!allocationData.flags.multiOsContextCapable); auto gmm = new Gmm(nullptr, sizeAligned, false, allocationData.flags.preferRenderCompressed, true, {}); wddmAllocation->gmm = gmm; @@ -93,7 +93,7 @@ GraphicsAllocation *WddmMemoryManager::allocateGraphicsMemoryWithAlignment(const return nullptr; } - auto wddmAllocation = std::make_unique(pSysMem, sizeAligned, nullptr, MemoryPool::System4KBPages, allocationData.flags.multiOsContextCapable); + auto wddmAllocation = std::make_unique(allocationData.type, pSysMem, sizeAligned, nullptr, MemoryPool::System4KBPages, allocationData.flags.multiOsContextCapable); wddmAllocation->driverAllocatedCpuPointer = pSysMem; gmm = new Gmm(pSysMem, sizeAligned, allocationData.flags.uncacheable); @@ -115,7 +115,7 @@ GraphicsAllocation *WddmMemoryManager::allocateGraphicsMemoryForNonSvmHostPtr(si auto offsetInPage = ptrDiff(cpuPtr, alignedPtr); auto alignedSize = alignSizeWholePage(cpuPtr, size); - auto wddmAllocation = std::make_unique(cpuPtr, size, nullptr, MemoryPool::System4KBPages, false); + auto wddmAllocation = std::make_unique(GraphicsAllocation::AllocationType::EXTERNAL_HOST_PTR, cpuPtr, size, nullptr, MemoryPool::System4KBPages, false); wddmAllocation->allocationOffset = offsetInPage; auto gmm = new Gmm(alignedPtr, alignedSize, false); @@ -149,7 +149,7 @@ GraphicsAllocation *WddmMemoryManager::allocateGraphicsMemory(const AllocationPr return nullptr; } - auto allocation = new WddmAllocation(ptr, properties.size, reserve, MemoryPool::System4KBPages, false); + auto allocation = new WddmAllocation(properties.allocationType, ptr, properties.size, reserve, MemoryPool::System4KBPages, false); allocation->allocationOffset = offset; Gmm *gmm = new Gmm(ptrAligned, sizeAligned, false); @@ -187,7 +187,7 @@ GraphicsAllocation *WddmMemoryManager::allocate32BitGraphicsMemoryImpl(const All ptrAligned = pSysMem; } - auto wddmAllocation = std::make_unique(const_cast(ptrAligned), sizeAligned, nullptr, + auto wddmAllocation = std::make_unique(allocationData.type, const_cast(ptrAligned), sizeAligned, nullptr, MemoryPool::System4KBPagesWith32BitGpuAddressing, false); wddmAllocation->driverAllocatedCpuPointer = pSysMem; wddmAllocation->is32BitAllocation = true; @@ -212,7 +212,7 @@ GraphicsAllocation *WddmMemoryManager::allocate32BitGraphicsMemoryImpl(const All } GraphicsAllocation *WddmMemoryManager::createAllocationFromHandle(osHandle handle, bool requireSpecificBitness, bool ntHandle) { - auto allocation = std::make_unique(nullptr, 0, handle, MemoryPool::SystemCpuInaccessible, false); + auto allocation = std::make_unique(GraphicsAllocation::AllocationType::UNDECIDED, nullptr, 0, handle, MemoryPool::SystemCpuInaccessible, false); bool status = ntHandle ? wddm->openNTHandle((HANDLE)((UINT_PTR)handle), allocation.get()) : wddm->openSharedHandle(handle, allocation.get()); @@ -434,7 +434,7 @@ void WddmMemoryManager::obtainGpuAddressFromFragments(WddmAllocation *allocation } GraphicsAllocation *WddmMemoryManager::createGraphicsAllocation(OsHandleStorage &handleStorage, const AllocationData &allocationData) { - auto allocation = new WddmAllocation(const_cast(allocationData.hostPtr), allocationData.size, nullptr, MemoryPool::System4KBPages, false); + auto allocation = new WddmAllocation(allocationData.type, const_cast(allocationData.hostPtr), allocationData.size, nullptr, MemoryPool::System4KBPages, false); allocation->fragmentsStorage = handleStorage; obtainGpuAddressFromFragments(allocation, handleStorage); return allocation; diff --git a/unit_tests/memory_manager/memory_manager_tests.cpp b/unit_tests/memory_manager/memory_manager_tests.cpp index c1c7d05bdb..58644f3aad 100644 --- a/unit_tests/memory_manager/memory_manager_tests.cpp +++ b/unit_tests/memory_manager/memory_manager_tests.cpp @@ -1693,3 +1693,13 @@ TEST(HeapSelectorTest, givenLimitedAddressSpaceWhenSelectingHeapForNullAllocatio hwInfo.capabilityTable.gpuAddressSpace = MemoryConstants::max32BitAddress; EXPECT_EQ(HeapIndex::HEAP_LIMITED, MemoryManager::selectHeap(nullptr, nullptr, hwInfo)); } + +TEST(MemoryAllocationTest, givenAllocationTypeWhenPassedToMemoryAllocationConstructorThenAllocationTypeIsStored) { + MemoryAllocation allocation{GraphicsAllocation::AllocationType::COMMAND_BUFFER, nullptr, nullptr, 0, 0, 0, MemoryPool::MemoryNull, false}; + EXPECT_EQ(GraphicsAllocation::AllocationType::COMMAND_BUFFER, allocation.getAllocationType()); +} + +TEST(MemoryAllocationTest, givenMemoryPoolWhenPassedToMemoryAllocationConstructorThenMemoryPoolIsStored) { + MemoryAllocation allocation{GraphicsAllocation::AllocationType::COMMAND_BUFFER, nullptr, nullptr, 0, 0, 0, MemoryPool::System64KBPages, false}; + EXPECT_EQ(MemoryPool::System64KBPages, allocation.getMemoryPool()); +} diff --git a/unit_tests/os_interface/linux/drm_memory_manager_tests.cpp b/unit_tests/os_interface/linux/drm_memory_manager_tests.cpp index bc6432834b..65c9390fd1 100644 --- a/unit_tests/os_interface/linux/drm_memory_manager_tests.cpp +++ b/unit_tests/os_interface/linux/drm_memory_manager_tests.cpp @@ -3011,3 +3011,19 @@ TEST_F(DrmMemoryManagerTest, givenImageOrSharedResourceCopyWhenGraphicsAllocatio EXPECT_EQ(MemoryManager::AllocationStatus::RetryInNonDevicePool, status); } } + +TEST(DrmAllocationTest, givenAllocationTypeWhenPassedToDrmAllocationConstructorThenAllocationTypeIsStored) { + DrmAllocation allocation{GraphicsAllocation::AllocationType::COMMAND_BUFFER, nullptr, nullptr, static_cast(0), 0u, MemoryPool::MemoryNull, false}; + EXPECT_EQ(GraphicsAllocation::AllocationType::COMMAND_BUFFER, allocation.getAllocationType()); + + DrmAllocation allocation2{GraphicsAllocation::AllocationType::UNDECIDED, nullptr, nullptr, 0ULL, static_cast(0), MemoryPool::MemoryNull, false}; + EXPECT_EQ(GraphicsAllocation::AllocationType::UNDECIDED, allocation2.getAllocationType()); +} + +TEST(DrmAllocationTest, givenMemoryPoolWhenPassedToDrmAllocationConstructorThenMemoryPoolIsStored) { + DrmAllocation allocation{GraphicsAllocation::AllocationType::COMMAND_BUFFER, nullptr, nullptr, static_cast(0), 0u, MemoryPool::System64KBPages, false}; + EXPECT_EQ(MemoryPool::System64KBPages, allocation.getMemoryPool()); + + DrmAllocation allocation2{GraphicsAllocation::AllocationType::UNDECIDED, nullptr, nullptr, 0ULL, static_cast(0), MemoryPool::SystemCpuInaccessible, false}; + EXPECT_EQ(MemoryPool::SystemCpuInaccessible, allocation2.getMemoryPool()); +} diff --git a/unit_tests/os_interface/windows/mock_wddm_allocation.h b/unit_tests/os_interface/windows/mock_wddm_allocation.h index d218b17515..8cc5dc198e 100644 --- a/unit_tests/os_interface/windows/mock_wddm_allocation.h +++ b/unit_tests/os_interface/windows/mock_wddm_allocation.h @@ -12,7 +12,7 @@ namespace OCLRT { class MockWddmAllocation : public WddmAllocation { public: - MockWddmAllocation() : WddmAllocation(nullptr, 0, nullptr, MemoryPool::MemoryNull, false) { + MockWddmAllocation() : WddmAllocation(GraphicsAllocation::AllocationType::UNDECIDED, nullptr, 0, nullptr, MemoryPool::MemoryNull, false) { } void setMemoryPool(MemoryPool::Type pool) { diff --git a/unit_tests/os_interface/windows/wddm20_tests.cpp b/unit_tests/os_interface/windows/wddm20_tests.cpp index 979586e8f4..fccca6f266 100644 --- a/unit_tests/os_interface/windows/wddm20_tests.cpp +++ b/unit_tests/os_interface/windows/wddm20_tests.cpp @@ -76,7 +76,7 @@ TEST_F(Wddm20Tests, givenNullPageTableManagerAndRenderCompressedResourceWhenMapp mockGmmRes->setUnifiedAuxTranslationCapable(); void *fakePtr = reinterpret_cast(0x100); - WddmAllocation allocation(fakePtr, 0x2100, nullptr, MemoryPool::MemoryNull, false); + WddmAllocation allocation(GraphicsAllocation::AllocationType::UNDECIDED, fakePtr, 0x2100, nullptr, MemoryPool::MemoryNull, false); allocation.gmm = gmm.get(); allocation.handle = ALLOCATION_HANDLE; @@ -170,7 +170,7 @@ TEST_F(Wddm20Tests, whenInitializeWddmThenContextIsCreated) { TEST_F(Wddm20Tests, allocation) { OsAgnosticMemoryManager mm(false, false, executionEnvironment); - WddmAllocation allocation(mm.allocateSystemMemory(100, 0), 100, nullptr, MemoryPool::MemoryNull, false); + WddmAllocation allocation(GraphicsAllocation::AllocationType::UNDECIDED, mm.allocateSystemMemory(100, 0), 100, nullptr, MemoryPool::MemoryNull, false); Gmm *gmm = GmmHelperFunctions::getGmm(allocation.getUnderlyingBuffer(), allocation.getUnderlyingBufferSize()); allocation.gmm = gmm; @@ -194,7 +194,7 @@ TEST_F(Wddm20WithMockGdiDllTests, givenAllocationSmallerUnderlyingThanAlignedSiz size_t underlyingPages = underlyingSize / MemoryConstants::pageSize; size_t alignedPages = alignedSize / MemoryConstants::pageSize; - WddmAllocation allocation(ptr, 0x2100, nullptr, MemoryPool::MemoryNull, false); + WddmAllocation allocation(GraphicsAllocation::AllocationType::UNDECIDED, ptr, 0x2100, nullptr, MemoryPool::MemoryNull, false); Gmm *gmm = GmmHelperFunctions::getGmm(allocation.getAlignedCpuPtr(), allocation.getAlignedSize()); allocation.gmm = gmm; @@ -235,7 +235,7 @@ TEST_F(Wddm20WithMockGdiDllTests, givenReserveCallWhenItIsCalledWithProperParamt TEST_F(Wddm20WithMockGdiDllTests, givenWddmAllocationWhenMappingGpuVaThenUseGmmSize) { void *fakePtr = reinterpret_cast(0x123); - WddmAllocation allocation(fakePtr, 100, nullptr, MemoryPool::MemoryNull, false); + WddmAllocation allocation(GraphicsAllocation::AllocationType::UNDECIDED, fakePtr, 100, nullptr, MemoryPool::MemoryNull, false); std::unique_ptr gmm(GmmHelperFunctions::getGmm(allocation.getAlignedCpuPtr(), allocation.getAlignedSize())); allocation.gmm = gmm.get(); @@ -259,7 +259,7 @@ TEST_F(Wddm20Tests, createAllocation32bit) { void *alignedPtr = (void *)0x12000; size_t alignedSize = 0x2000; - WddmAllocation allocation(alignedPtr, alignedSize, nullptr, MemoryPool::MemoryNull, false); + WddmAllocation allocation(GraphicsAllocation::AllocationType::UNDECIDED, alignedPtr, alignedSize, nullptr, MemoryPool::MemoryNull, false); Gmm *gmm = GmmHelperFunctions::getGmm(allocation.getUnderlyingBuffer(), allocation.getUnderlyingBufferSize()); allocation.gmm = gmm; @@ -287,11 +287,10 @@ TEST_F(Wddm20Tests, createAllocation32bit) { TEST_F(Wddm20Tests, givenGraphicsAllocationWhenItIsMappedInHeap0ThenItHasGpuAddressWithinHeapInternalLimits) { void *alignedPtr = (void *)0x12000; size_t alignedSize = 0x2000; - WddmAllocation allocation(alignedPtr, alignedSize, nullptr, MemoryPool::MemoryNull, false); + WddmAllocation allocation(GraphicsAllocation::AllocationType::KERNEL_ISA, alignedPtr, alignedSize, nullptr, MemoryPool::MemoryNull, false); allocation.handle = ALLOCATION_HANDLE; allocation.gmm = GmmHelperFunctions::getGmm(allocation.getUnderlyingBuffer(), allocation.getUnderlyingBufferSize()); - allocation.setAllocationType(GraphicsAllocation::AllocationType::KERNEL_ISA); EXPECT_EQ(internalHeapIndex, MemoryManager::selectHeap(&allocation, allocation.getAlignedCpuPtr(), *hardwareInfoTable[wddm->getGfxPlatform()->eProductFamily])); bool ret = wddm->mapGpuVirtualAddress(&allocation, allocation.getAlignedCpuPtr()); EXPECT_TRUE(ret); @@ -338,7 +337,7 @@ TEST_F(Wddm20WithMockGdiDllTests, GivenThreeOsHandlesWhenAskedForDestroyAllocati TEST_F(Wddm20Tests, mapAndFreeGpuVa) { OsAgnosticMemoryManager mm(false, false, executionEnvironment); - WddmAllocation allocation(mm.allocateSystemMemory(100, 0), 100, nullptr, MemoryPool::MemoryNull, false); + WddmAllocation allocation(GraphicsAllocation::AllocationType::UNDECIDED, mm.allocateSystemMemory(100, 0), 100, nullptr, MemoryPool::MemoryNull, false); Gmm *gmm = GmmHelperFunctions::getGmm(allocation.getUnderlyingBuffer(), allocation.getUnderlyingBufferSize()); allocation.gmm = gmm; @@ -364,7 +363,7 @@ TEST_F(Wddm20Tests, mapAndFreeGpuVa) { TEST_F(Wddm20Tests, givenNullAllocationWhenCreateThenAllocateAndMap) { OsAgnosticMemoryManager mm(false, false, executionEnvironment); - WddmAllocation allocation(nullptr, 100, nullptr, MemoryPool::MemoryNull, false); + WddmAllocation allocation(GraphicsAllocation::AllocationType::UNDECIDED, nullptr, 100, nullptr, MemoryPool::MemoryNull, false); Gmm *gmm = GmmHelperFunctions::getGmm(allocation.getUnderlyingBuffer(), allocation.getUnderlyingBufferSize()); allocation.gmm = gmm; @@ -383,7 +382,7 @@ TEST_F(Wddm20Tests, givenNullAllocationWhenCreateThenAllocateAndMap) { TEST_F(Wddm20Tests, makeResidentNonResident) { OsAgnosticMemoryManager mm(false, false, executionEnvironment); - WddmAllocation allocation(mm.allocateSystemMemory(100, 0), 100, nullptr, MemoryPool::MemoryNull, false); + WddmAllocation allocation(GraphicsAllocation::AllocationType::UNDECIDED, mm.allocateSystemMemory(100, 0), 100, nullptr, MemoryPool::MemoryNull, false); Gmm *gmm = GmmHelperFunctions::getGmm(allocation.getUnderlyingBuffer(), allocation.getUnderlyingBufferSize()); allocation.gmm = gmm; @@ -595,7 +594,7 @@ TEST(DebugFlagTest, givenDebugManagerWhenGetForUseNoRingFlushesKmdModeIsCalledTh TEST_F(Wddm20Tests, makeResidentMultipleHandles) { OsAgnosticMemoryManager mm(false, false, executionEnvironment); - WddmAllocation allocation(mm.allocateSystemMemory(100, 0), 100, nullptr, MemoryPool::MemoryNull, false); + WddmAllocation allocation(GraphicsAllocation::AllocationType::UNDECIDED, mm.allocateSystemMemory(100, 0), 100, nullptr, MemoryPool::MemoryNull, false); allocation.handle = ALLOCATION_HANDLE; D3DKMT_HANDLE handles[2] = {0}; @@ -617,7 +616,7 @@ TEST_F(Wddm20Tests, makeResidentMultipleHandles) { TEST_F(Wddm20Tests, makeResidentMultipleHandlesWithReturnBytesToTrim) { OsAgnosticMemoryManager mm(false, false, executionEnvironment); - WddmAllocation allocation(mm.allocateSystemMemory(100, 0), 100, nullptr, MemoryPool::MemoryNull, false); + WddmAllocation allocation(GraphicsAllocation::AllocationType::UNDECIDED, mm.allocateSystemMemory(100, 0), 100, nullptr, MemoryPool::MemoryNull, false); allocation.handle = ALLOCATION_HANDLE; D3DKMT_HANDLE handles[2] = {0}; @@ -657,7 +656,7 @@ TEST_F(Wddm20Tests, makeNonResidentCallsEvict) { } TEST_F(Wddm20Tests, givenDestroyAllocationWhenItIsCalledThenAllocationIsPassedToDestroyAllocation) { - WddmAllocation allocation((void *)0x23000, 0x1000, nullptr, MemoryPool::MemoryNull, false); + WddmAllocation allocation(GraphicsAllocation::AllocationType::UNDECIDED, (void *)0x23000, 0x1000, nullptr, MemoryPool::MemoryNull, false); allocation.getResidencyData().updateCompletionData(10, osContext.get()->getContextId()); allocation.handle = ALLOCATION_HANDLE; @@ -683,7 +682,7 @@ TEST_F(Wddm20Tests, givenDestroyAllocationWhenItIsCalledThenAllocationIsPassedTo } TEST_F(Wddm20Tests, WhenLastFenceLessEqualThanMonitoredThenWaitFromCpuIsNotCalled) { - WddmAllocation allocation((void *)0x23000, 0x1000, nullptr, MemoryPool::MemoryNull, false); + WddmAllocation allocation(GraphicsAllocation::AllocationType::UNDECIDED, (void *)0x23000, 0x1000, nullptr, MemoryPool::MemoryNull, false); allocation.getResidencyData().updateCompletionData(10, osContext.get()->getContextId()); allocation.handle = ALLOCATION_HANDLE; @@ -706,7 +705,7 @@ TEST_F(Wddm20Tests, WhenLastFenceLessEqualThanMonitoredThenWaitFromCpuIsNotCalle } TEST_F(Wddm20Tests, WhenLastFenceGreaterThanMonitoredThenWaitFromCpuIsCalled) { - WddmAllocation allocation((void *)0x23000, 0x1000, nullptr, MemoryPool::MemoryNull, false); + WddmAllocation allocation(GraphicsAllocation::AllocationType::UNDECIDED, (void *)0x23000, 0x1000, nullptr, MemoryPool::MemoryNull, false); allocation.getResidencyData().updateCompletionData(10, osContext.get()->getContextId()); allocation.handle = ALLOCATION_HANDLE; @@ -764,7 +763,7 @@ TEST_F(Wddm20Tests, whenCreateAllocation64kFailsThenReturnFalse) { void *fakePtr = reinterpret_cast(0x123); auto gmm = std::make_unique(fakePtr, 100, false); - WddmAllocation allocation(fakePtr, 100, nullptr, MemoryPool::MemoryNull, false); + WddmAllocation allocation(GraphicsAllocation::AllocationType::UNDECIDED, fakePtr, 100, nullptr, MemoryPool::MemoryNull, false); allocation.gmm = gmm.get(); EXPECT_FALSE(wddm->createAllocation64k(&allocation)); @@ -838,7 +837,7 @@ TEST_F(Wddm20Tests, givenNullTrimCallbackHandleWhenUnregisteringTrimCallbackThen } TEST_F(Wddm20Tests, givenAllocationThatDoesntNeedMakeResidentBeforeLockWhenLockThenDontStoreItOrCallMakeResident) { - WddmAllocation allocation{nullptr, 0, nullptr, MemoryPool::MemoryNull, false}; + WddmAllocation allocation{GraphicsAllocation::AllocationType::UNDECIDED, nullptr, 0, nullptr, MemoryPool::MemoryNull, false}; EXPECT_FALSE(allocation.needsMakeResidentBeforeLock); EXPECT_TRUE(wddm->temporaryResources.empty()); EXPECT_EQ(0u, wddm->makeResidentResult.called); @@ -848,25 +847,25 @@ TEST_F(Wddm20Tests, givenAllocationThatDoesntNeedMakeResidentBeforeLockWhenLockT wddm->unlockResource(allocation); } TEST_F(Wddm20Tests, givenAllocationThatNeedsMakeResidentBeforeLockWhenLockThenCallBlockingMakeResident) { - WddmAllocation allocation{nullptr, 0, nullptr, MemoryPool::MemoryNull, false}; + WddmAllocation allocation{GraphicsAllocation::AllocationType::UNDECIDED, nullptr, 0, nullptr, MemoryPool::MemoryNull, false}; allocation.needsMakeResidentBeforeLock = true; wddm->lockResource(allocation); EXPECT_EQ(1u, wddm->applyBlockingMakeResidentResult.called); } TEST_F(Wddm20Tests, givenAllocationWhenApplyBlockingMakeResidentThenAcquireUniqueLock) { - WddmAllocation allocation{nullptr, 0, nullptr, MemoryPool::MemoryNull, false}; + WddmAllocation allocation{GraphicsAllocation::AllocationType::UNDECIDED, nullptr, 0, nullptr, MemoryPool::MemoryNull, false}; wddm->applyBlockingMakeResident(allocation); EXPECT_EQ(1u, wddm->acquireLockResult.called); EXPECT_EQ(reinterpret_cast(&wddm->temporaryResourcesLock), wddm->acquireLockResult.uint64ParamPassed); } TEST_F(Wddm20Tests, givenAllocationWhenApplyBlockingMakeResidentThenCallMakeResidentAndStoreAllocation) { - WddmAllocation allocation{nullptr, 0, nullptr, MemoryPool::MemoryNull, false}; + WddmAllocation allocation{GraphicsAllocation::AllocationType::UNDECIDED, nullptr, 0, nullptr, MemoryPool::MemoryNull, false}; wddm->applyBlockingMakeResident(allocation); EXPECT_EQ(1u, wddm->makeResidentResult.called); EXPECT_EQ(allocation.handle, wddm->temporaryResources.back()); } TEST_F(Wddm20Tests, givenAllocationWhenApplyBlockingMakeResidentThenWaitForCurrentPagingFenceValue) { - WddmAllocation allocation{nullptr, 0, nullptr, MemoryPool::MemoryNull, false}; + WddmAllocation allocation{GraphicsAllocation::AllocationType::UNDECIDED, nullptr, 0, nullptr, MemoryPool::MemoryNull, false}; wddm->mockPagingFence = 0u; wddm->currentPagingFenceValue = 3u; wddm->applyBlockingMakeResident(allocation); @@ -875,14 +874,14 @@ TEST_F(Wddm20Tests, givenAllocationWhenApplyBlockingMakeResidentThenWaitForCurre EXPECT_EQ(3u, wddm->getPagingFenceAddressResult.called); } TEST_F(Wddm20Tests, givenAllocationWhenApplyBlockingMakeResidentAndMakeResidentCallFailsThenEvictTemporaryResourcesAndRetry) { - WddmAllocation allocation{nullptr, 0, nullptr, MemoryPool::MemoryNull, false}; + WddmAllocation allocation{GraphicsAllocation::AllocationType::UNDECIDED, nullptr, 0, nullptr, MemoryPool::MemoryNull, false}; GmockWddm gmockWddm; EXPECT_CALL(gmockWddm, makeResident(&allocation.handle, ::testing::_, ::testing::_, ::testing::_)).Times(2).WillRepeatedly(::testing::Return(false)); gmockWddm.applyBlockingMakeResident(allocation); EXPECT_EQ(1u, gmockWddm.evictAllTemporaryResourcesResult.called); } TEST_F(Wddm20Tests, whenApplyBlockingMakeResidentAndTemporaryResourcesAreEvictedSuccessfullyThenCallMakeResidentOneMoreTime) { - WddmAllocation allocation{nullptr, 0, nullptr, MemoryPool::MemoryNull, false}; + WddmAllocation allocation{GraphicsAllocation::AllocationType::UNDECIDED, nullptr, 0, nullptr, MemoryPool::MemoryNull, false}; GmockWddm gmockWddm; gmockWddm.temporaryResources.push_back(allocation.handle); EXPECT_CALL(gmockWddm, evict(::testing::_, ::testing::_, ::testing::_)).Times(1).WillRepeatedly(::testing::Return(true)); @@ -891,7 +890,7 @@ TEST_F(Wddm20Tests, whenApplyBlockingMakeResidentAndTemporaryResourcesAreEvicted EXPECT_EQ(2u, gmockWddm.evictAllTemporaryResourcesResult.called); } TEST_F(Wddm20Tests, whenApplyBlockingMakeResidentAndMakeResidentStillFailsThenDontStoreTemporaryResource) { - WddmAllocation allocation{nullptr, 0, nullptr, MemoryPool::MemoryNull, false}; + WddmAllocation allocation{GraphicsAllocation::AllocationType::UNDECIDED, nullptr, 0, nullptr, MemoryPool::MemoryNull, false}; allocation.handle = 0x2; GmockWddm gmockWddm; gmockWddm.temporaryResources.push_back(0x1); @@ -902,7 +901,7 @@ TEST_F(Wddm20Tests, whenApplyBlockingMakeResidentAndMakeResidentStillFailsThenDo EXPECT_EQ(0u, gmockWddm.temporaryResources.size()); } TEST_F(Wddm20Tests, whenApplyBlockingMakeResidentAndMakeResidentPassesAfterEvictThenStoreTemporaryResource) { - WddmAllocation allocation{nullptr, 0, nullptr, MemoryPool::MemoryNull, false}; + WddmAllocation allocation{GraphicsAllocation::AllocationType::UNDECIDED, nullptr, 0, nullptr, MemoryPool::MemoryNull, false}; allocation.handle = 0x2; GmockWddm gmockWddm; gmockWddm.temporaryResources.push_back(0x1); @@ -914,7 +913,7 @@ TEST_F(Wddm20Tests, whenApplyBlockingMakeResidentAndMakeResidentPassesAfterEvict EXPECT_EQ(0x2, gmockWddm.temporaryResources.back()); } TEST_F(Wddm20Tests, whenApplyBlockingMakeResidentAndMakeResidentPassesThenStoreTemporaryResource) { - WddmAllocation allocation{nullptr, 0, nullptr, MemoryPool::MemoryNull, false}; + WddmAllocation allocation{GraphicsAllocation::AllocationType::UNDECIDED, nullptr, 0, nullptr, MemoryPool::MemoryNull, false}; allocation.handle = 0x2; GmockWddm gmockWddm; gmockWddm.temporaryResources.push_back(0x1); @@ -933,7 +932,7 @@ TEST_F(Wddm20Tests, whenEvictingAllTemporaryResourcesThenAcquireTemporaryResourc EXPECT_EQ(reinterpret_cast(&wddm->temporaryResourcesLock), wddm->acquireLockResult.uint64ParamPassed); } TEST_F(Wddm20Tests, whenEvictingAllTemporaryResourcesAndAllEvictionsSucceedThenReturnSuccess) { - WddmAllocation allocation{nullptr, 0, nullptr, MemoryPool::MemoryNull, false}; + WddmAllocation allocation{GraphicsAllocation::AllocationType::UNDECIDED, nullptr, 0, nullptr, MemoryPool::MemoryNull, false}; GmockWddm gmockWddm; gmockWddm.temporaryResources.push_back(allocation.handle); EXPECT_CALL(gmockWddm, evict(::testing::_, ::testing::_, ::testing::_)).Times(1).WillOnce(::testing::Return(true)); @@ -962,18 +961,18 @@ TEST_F(Wddm20Tests, givenThreeAllocationsWhenEvictingAllTemporaryResourcesAndOne EXPECT_EQ(EvictionStatus::FAILED, gmockWddm.evictAllTemporaryResourcesResult.status); } TEST_F(Wddm20Tests, givenNoTemporaryResourcesWhenEvictingTemporaryResourceThenEvictionIsNotApplied) { - WddmAllocation allocation{nullptr, 0, nullptr, MemoryPool::MemoryNull, false}; + WddmAllocation allocation{GraphicsAllocation::AllocationType::UNDECIDED, nullptr, 0, nullptr, MemoryPool::MemoryNull, false}; wddm->evictTemporaryResource(allocation); EXPECT_EQ(EvictionStatus::NOT_APPLIED, wddm->evictTemporaryResourceResult.status); } TEST_F(Wddm20Tests, whenEvictingTemporaryResourceThenAcquireTemporaryResourcesLock) { - WddmAllocation allocation{nullptr, 0, nullptr, MemoryPool::MemoryNull, false}; + WddmAllocation allocation{GraphicsAllocation::AllocationType::UNDECIDED, nullptr, 0, nullptr, MemoryPool::MemoryNull, false}; wddm->evictTemporaryResource(allocation); EXPECT_EQ(1u, wddm->acquireLockResult.called); EXPECT_EQ(reinterpret_cast(&wddm->temporaryResourcesLock), wddm->acquireLockResult.uint64ParamPassed); } TEST_F(Wddm20Tests, whenEvictingNonExistingTemporaryResourceThenEvictIsNotAppliedAndTemporaryResourcesAreRestored) { - WddmAllocation allocation{nullptr, 0, nullptr, MemoryPool::MemoryNull, false}; + WddmAllocation allocation{GraphicsAllocation::AllocationType::UNDECIDED, nullptr, 0, nullptr, MemoryPool::MemoryNull, false}; allocation.handle = 0x1; wddm->temporaryResources.push_back(0x2); EXPECT_FALSE(wddm->temporaryResources.empty()); @@ -982,7 +981,7 @@ TEST_F(Wddm20Tests, whenEvictingNonExistingTemporaryResourceThenEvictIsNotApplie EXPECT_EQ(EvictionStatus::NOT_APPLIED, wddm->evictTemporaryResourceResult.status); } TEST_F(Wddm20Tests, whenEvictingTemporaryResourceAndEvictFailsThenReturnFail) { - WddmAllocation allocation{nullptr, 0, nullptr, MemoryPool::MemoryNull, false}; + WddmAllocation allocation{GraphicsAllocation::AllocationType::UNDECIDED, nullptr, 0, nullptr, MemoryPool::MemoryNull, false}; GmockWddm gmockWddm; gmockWddm.temporaryResources.push_back(allocation.handle); EXPECT_CALL(gmockWddm, evict(::testing::_, ::testing::_, ::testing::_)).Times(1).WillOnce(::testing::Return(false)); @@ -991,7 +990,7 @@ TEST_F(Wddm20Tests, whenEvictingTemporaryResourceAndEvictFailsThenReturnFail) { EXPECT_EQ(EvictionStatus::FAILED, gmockWddm.evictTemporaryResourceResult.status); } TEST_F(Wddm20Tests, whenEvictingTemporaryResourceAndEvictSucceedThenReturnSuccess) { - WddmAllocation allocation{nullptr, 0, nullptr, MemoryPool::MemoryNull, false}; + WddmAllocation allocation{GraphicsAllocation::AllocationType::UNDECIDED, nullptr, 0, nullptr, MemoryPool::MemoryNull, false}; GmockWddm gmockWddm; gmockWddm.temporaryResources.push_back(allocation.handle); EXPECT_CALL(gmockWddm, evict(::testing::_, ::testing::_, ::testing::_)).Times(1).WillOnce(::testing::Return(true)); @@ -1004,7 +1003,7 @@ TEST_F(Wddm20Tests, whenEvictingTemporaryResourceThenOtherResourcesRemainOnTheLi wddm->temporaryResources.push_back(0x2); wddm->temporaryResources.push_back(0x3); - WddmAllocation allocation{nullptr, 0, nullptr, MemoryPool::MemoryNull, false}; + WddmAllocation allocation{GraphicsAllocation::AllocationType::UNDECIDED, nullptr, 0, nullptr, MemoryPool::MemoryNull, false}; allocation.handle = 0x2; wddm->evictTemporaryResource(allocation); diff --git a/unit_tests/os_interface/windows/wddm_kmdaf_listener_tests.cpp b/unit_tests/os_interface/windows/wddm_kmdaf_listener_tests.cpp index 6fad5351cf..fb1bf5d8e4 100644 --- a/unit_tests/os_interface/windows/wddm_kmdaf_listener_tests.cpp +++ b/unit_tests/os_interface/windows/wddm_kmdaf_listener_tests.cpp @@ -80,7 +80,7 @@ TEST_F(WddmKmDafListenerTest, givenWddmWhenUnlockResourceIsCalledThenKmDafListen } TEST_F(WddmKmDafListenerTest, givenWddmWhenMapGpuVirtualAddressIsCalledThenKmDafListenerNotifyMapGpuVAIsFedWithCorrectParams) { - WddmAllocation allocation((void *)0x23000, 0x1000, nullptr, MemoryPool::MemoryNull, false); + WddmAllocation allocation(GraphicsAllocation::AllocationType::UNDECIDED, (void *)0x23000, 0x1000, nullptr, MemoryPool::MemoryNull, false); allocation.handle = ALLOCATION_HANDLE; auto gmm = std::unique_ptr(new Gmm(nullptr, 1, false)); allocation.gmm = gmm.get(); @@ -97,7 +97,7 @@ TEST_F(WddmKmDafListenerTest, givenWddmWhenMapGpuVirtualAddressIsCalledThenKmDaf } TEST_F(WddmKmDafListenerTest, givenWddmWhenFreeGpuVirtualAddressIsCalledThenKmDafListenerNotifyUnmapGpuVAIsFedWithCorrectParams) { - WddmAllocation allocation((void *)0x23000, 0x1000, nullptr, MemoryPool::MemoryNull, false); + WddmAllocation allocation(GraphicsAllocation::AllocationType::UNDECIDED, (void *)0x23000, 0x1000, nullptr, MemoryPool::MemoryNull, false); allocation.gpuPtr = GPUVA; wddmWithKmDafMock->freeGpuVirtualAddress(allocation.gpuPtr, allocation.getUnderlyingBufferSize()); @@ -137,7 +137,7 @@ TEST_F(WddmKmDafListenerTest, givenWddmWhenEvictIsCalledThenKmDafListenerNotifyE } TEST_F(WddmKmDafListenerTest, givenWddmWhenCreateAllocationIsCalledThenKmDafListenerNotifyWriteTargetIsFedWithCorrectParams) { - WddmAllocation allocation((void *)0x23000, 0x1000, nullptr, MemoryPool::MemoryNull, false); + WddmAllocation allocation(GraphicsAllocation::AllocationType::UNDECIDED, (void *)0x23000, 0x1000, nullptr, MemoryPool::MemoryNull, false); auto gmm = std::unique_ptr(new Gmm(nullptr, 1, false)); allocation.gmm = gmm.get(); @@ -151,7 +151,7 @@ TEST_F(WddmKmDafListenerTest, givenWddmWhenCreateAllocationIsCalledThenKmDafList } TEST_F(WddmKmDafListenerTest, givenWddmWhenCreateAllocation64IsCalledThenKmDafListenerNotifyWriteTargetIsFedWithCorrectParams) { - WddmAllocation allocation((void *)0x23000, 0x1000, nullptr, MemoryPool::MemoryNull, false); + WddmAllocation allocation(GraphicsAllocation::AllocationType::UNDECIDED, (void *)0x23000, 0x1000, nullptr, MemoryPool::MemoryNull, false); auto gmm = std::unique_ptr(new Gmm(nullptr, 1, false)); allocation.gmm = gmm.get(); diff --git a/unit_tests/os_interface/windows/wddm_memory_manager_tests.cpp b/unit_tests/os_interface/windows/wddm_memory_manager_tests.cpp index 137f9a4a26..e0ef456256 100644 --- a/unit_tests/os_interface/windows/wddm_memory_manager_tests.cpp +++ b/unit_tests/os_interface/windows/wddm_memory_manager_tests.cpp @@ -68,7 +68,7 @@ TEST(WddmMemoryManager, NonAssignable) { constexpr EngineInstanceT defaultRcsEngine{ENGINE_RCS, 0}; TEST(WddmAllocationTest, givenAllocationIsTrimCandidateInOneOsContextWhenGettingTrimCandidatePositionThenReturnItsPositionAndUnusedPositionInOtherContexts) { - WddmAllocation allocation{nullptr, 0, nullptr, MemoryPool::MemoryNull, false}; + WddmAllocation allocation{GraphicsAllocation::AllocationType::UNDECIDED, nullptr, 0, nullptr, MemoryPool::MemoryNull, false}; OsContext osContext(nullptr, 1u, 1, defaultRcsEngine, PreemptionHelper::getDefaultPreemptionMode(*platformDevices[0])); allocation.setTrimCandidateListPosition(osContext.getContextId(), 700u); EXPECT_EQ(trimListUnusedPosition, allocation.getTrimCandidateListPosition(0u)); @@ -77,18 +77,34 @@ TEST(WddmAllocationTest, givenAllocationIsTrimCandidateInOneOsContextWhenGetting } TEST(WddmAllocationTest, givenAllocationCreatedWithOsContextCountOneWhenItIsCreatedThenMaxOsContextCountIsUsedInstead) { - WddmAllocation allocation{nullptr, 0, nullptr, MemoryPool::MemoryNull, false}; + WddmAllocation allocation{GraphicsAllocation::AllocationType::UNDECIDED, nullptr, 0, nullptr, MemoryPool::MemoryNull, false}; allocation.setTrimCandidateListPosition(3u, 700u); EXPECT_EQ(700u, allocation.getTrimCandidateListPosition(3u)); EXPECT_EQ(trimListUnusedPosition, allocation.getTrimCandidateListPosition(2u)); } TEST(WddmAllocationTest, givenRequestedContextIdTooLargeWhenGettingTrimCandidateListPositionThenReturnUnusedPosition) { - WddmAllocation allocation{nullptr, 0, nullptr, MemoryPool::MemoryNull, false}; + WddmAllocation allocation{GraphicsAllocation::AllocationType::UNDECIDED, nullptr, 0, nullptr, MemoryPool::MemoryNull, false}; EXPECT_EQ(trimListUnusedPosition, allocation.getTrimCandidateListPosition(1u)); EXPECT_EQ(trimListUnusedPosition, allocation.getTrimCandidateListPosition(1000u)); } +TEST(WddmAllocationTest, givenAllocationTypeWhenPassedToWddmAllocationConstructorThenAllocationTypeIsStored) { + WddmAllocation allocation{GraphicsAllocation::AllocationType::COMMAND_BUFFER, nullptr, 0, nullptr, MemoryPool::MemoryNull, false}; + EXPECT_EQ(GraphicsAllocation::AllocationType::COMMAND_BUFFER, allocation.getAllocationType()); + + WddmAllocation allocation2{GraphicsAllocation::AllocationType::UNDECIDED, nullptr, 0, 0u, MemoryPool::MemoryNull, false}; + EXPECT_EQ(GraphicsAllocation::AllocationType::UNDECIDED, allocation2.getAllocationType()); +} + +TEST(WddmAllocationTest, givenMemoryPoolWhenPassedToWddmAllocationConstructorThenMemoryPoolIsStored) { + WddmAllocation allocation{GraphicsAllocation::AllocationType::COMMAND_BUFFER, nullptr, 0, nullptr, MemoryPool::System64KBPages, false}; + EXPECT_EQ(MemoryPool::System64KBPages, allocation.getMemoryPool()); + + WddmAllocation allocation2{GraphicsAllocation::AllocationType::UNDECIDED, nullptr, 0, 0u, MemoryPool::SystemCpuInaccessible, false}; + EXPECT_EQ(MemoryPool::SystemCpuInaccessible, allocation2.getMemoryPool()); +} + TEST(WddmMemoryManagerAllocator32BitTest, allocator32BitIsCreatedWithCorrectBase) { ExecutionEnvironment executionEnvironment; std::unique_ptr wddm(static_cast(Wddm::createWddm())); @@ -253,7 +269,7 @@ TEST_F(WddmMemoryManagerTest, GivenGraphicsAllocationWhenAddAndRemoveAllocationT void *cpuPtr = (void *)0x30000; size_t size = 0x1000; - WddmAllocation gfxAllocation(cpuPtr, size, nullptr, MemoryPool::MemoryNull, false); + WddmAllocation gfxAllocation(GraphicsAllocation::AllocationType::UNDECIDED, cpuPtr, size, nullptr, MemoryPool::MemoryNull, false); memoryManager->addAllocationToHostPtrManager(&gfxAllocation); auto fragment = memoryManager->getHostPtrManager()->getFragment(gfxAllocation.getUnderlyingBuffer()); EXPECT_NE(fragment, nullptr); @@ -817,7 +833,7 @@ TEST_F(WddmMemoryManagerTest, givenManagerWithDisabledDeferredDeleterWhenMapGpuV memoryManager->setDeferredDeleter(nullptr); setMapGpuVaFailConfigFcn(0, 1); - WddmAllocation allocation(ptr, size, nullptr, MemoryPool::MemoryNull, false); + WddmAllocation allocation(GraphicsAllocation::AllocationType::UNDECIDED, ptr, size, nullptr, MemoryPool::MemoryNull, false); allocation.gmm = gmm.get(); bool ret = memoryManager->createWddmAllocation(&allocation); EXPECT_FALSE(ret); @@ -833,7 +849,7 @@ TEST_F(WddmMemoryManagerTest, givenManagerWithEnabledDeferredDeleterWhenFirstMap setMapGpuVaFailConfigFcn(0, 1); - WddmAllocation allocation(ptr, size, nullptr, MemoryPool::MemoryNull, false); + WddmAllocation allocation(GraphicsAllocation::AllocationType::UNDECIDED, ptr, size, nullptr, MemoryPool::MemoryNull, false); allocation.gmm = gmm.get(); bool ret = memoryManager->createWddmAllocation(&allocation); EXPECT_TRUE(ret); @@ -849,7 +865,7 @@ TEST_F(WddmMemoryManagerTest, givenManagerWithEnabledDeferredDeleterWhenFirstAnd setMapGpuVaFailConfigFcn(0, 2); - WddmAllocation allocation(ptr, size, nullptr, MemoryPool::MemoryNull, false); + WddmAllocation allocation(GraphicsAllocation::AllocationType::UNDECIDED, ptr, size, nullptr, MemoryPool::MemoryNull, false); allocation.gmm = gmm.get(); bool ret = memoryManager->createWddmAllocation(&allocation); EXPECT_FALSE(ret); diff --git a/unit_tests/os_interface/windows/wddm_residency_controller_tests.cpp b/unit_tests/os_interface/windows/wddm_residency_controller_tests.cpp index 80f50edef2..a87077a9ef 100644 --- a/unit_tests/os_interface/windows/wddm_residency_controller_tests.cpp +++ b/unit_tests/os_interface/windows/wddm_residency_controller_tests.cpp @@ -630,9 +630,9 @@ TEST_F(WddmResidencyControllerWithGdiTest, trimToBudgetReturnsFalseWhenNumBytesT } TEST_F(WddmResidencyControllerWithGdiTest, trimToBudgetStopsEvictingWhenNumBytesToTrimIsZero) { - WddmAllocation allocation1(reinterpret_cast(0x1000), 0x1000, nullptr, MemoryPool::MemoryNull, false), - allocation2(reinterpret_cast(0x1000), 0x3000, nullptr, MemoryPool::MemoryNull, false), - allocation3(reinterpret_cast(0x1000), 0x1000, nullptr, MemoryPool::MemoryNull, false); + WddmAllocation allocation1(GraphicsAllocation::AllocationType::UNDECIDED, reinterpret_cast(0x1000), 0x1000, nullptr, MemoryPool::MemoryNull, false); + WddmAllocation allocation2(GraphicsAllocation::AllocationType::UNDECIDED, reinterpret_cast(0x1000), 0x3000, nullptr, MemoryPool::MemoryNull, false); + WddmAllocation allocation3(GraphicsAllocation::AllocationType::UNDECIDED, reinterpret_cast(0x1000), 0x1000, nullptr, MemoryPool::MemoryNull, false); allocation1.getResidencyData().resident[osContextId] = true; allocation1.getResidencyData().updateCompletionData(0, osContextId); @@ -725,8 +725,8 @@ TEST_F(WddmResidencyControllerWithGdiTest, trimToBudgetWaitsFromCpuWhenLastFence TEST_F(WddmResidencyControllerWithGdiAndMemoryManagerTest, trimToBudgetEvictsDoneFragmentsOnly) { gdi->setNonZeroNumBytesToTrimInEvict(); void *ptr = reinterpret_cast(wddm->virtualAllocAddress + 0x1000); - WddmAllocation allocation1(ptr, 0x1000, nullptr, MemoryPool::MemoryNull, false); - WddmAllocation allocation2(ptr, 0x1000, nullptr, MemoryPool::MemoryNull, false); + WddmAllocation allocation1(GraphicsAllocation::AllocationType::UNDECIDED, ptr, 0x1000, nullptr, MemoryPool::MemoryNull, false); + WddmAllocation allocation2(GraphicsAllocation::AllocationType::UNDECIDED, ptr, 0x1000, nullptr, MemoryPool::MemoryNull, false); allocation1.getResidencyData().resident[osContextId] = true; allocation1.getResidencyData().updateCompletionData(0, osContextId); @@ -784,9 +784,9 @@ TEST_F(WddmResidencyControllerWithGdiTest, givenThreeAllocationsAlignedSizeBigge void *ptr2 = reinterpret_cast(wddm->virtualAllocAddress + 0x3000); void *ptr3 = reinterpret_cast(wddm->virtualAllocAddress + 0x5000); - WddmAllocation allocation1(ptr1, underlyingSize, nullptr, MemoryPool::MemoryNull, false); - WddmAllocation allocation2(ptr2, underlyingSize, nullptr, MemoryPool::MemoryNull, false); - WddmAllocation allocation3(ptr3, underlyingSize, nullptr, MemoryPool::MemoryNull, false); + WddmAllocation allocation1(GraphicsAllocation::AllocationType::UNDECIDED, ptr1, underlyingSize, nullptr, MemoryPool::MemoryNull, false); + WddmAllocation allocation2(GraphicsAllocation::AllocationType::UNDECIDED, ptr2, underlyingSize, nullptr, MemoryPool::MemoryNull, false); + WddmAllocation allocation3(GraphicsAllocation::AllocationType::UNDECIDED, ptr3, underlyingSize, nullptr, MemoryPool::MemoryNull, false); allocation1.getResidencyData().resident[osContextId] = true; allocation1.getResidencyData().updateCompletionData(0, osContextId); @@ -986,7 +986,7 @@ TEST_F(WddmResidencyControllerWithMockWddmTest, givenMakeResidentFailsAndTrimToB MockWddmAllocation allocation1; void *cpuPtr = reinterpret_cast(wddm->getWddmMinAddress() + 0x1000); size_t allocationSize = 0x1000; - WddmAllocation allocationToTrim(cpuPtr, allocationSize, nullptr, MemoryPool::MemoryNull, false); + WddmAllocation allocationToTrim(GraphicsAllocation::AllocationType::UNDECIDED, cpuPtr, allocationSize, nullptr, MemoryPool::MemoryNull, false); allocationToTrim.getResidencyData().updateCompletionData(residencyController->getMonitoredFence().lastSubmittedFence, osContext->getContextId());