mirror of
https://github.com/intel/compute-runtime.git
synced 2025-09-15 13:01:45 +08:00
Add osContextsCount argument to WddmAllocation's constructors
The argument is not anywhere yet, this is just a preparation step for future change. Change-Id: I5a441352cb5cf10d1a0ff31933041ff9521d0307 Signed-off-by: Maciej Dziuban <maciej.dziuban@intel.com>
This commit is contained in:

committed by
sys_ocldev

parent
ef65e6433e
commit
ac2c2763ab
@ -30,7 +30,7 @@ class WddmAllocation : public GraphicsAllocation {
|
||||
D3DKMT_HANDLE resourceHandle = 0u; // used by shared resources
|
||||
|
||||
D3DGPU_VIRTUAL_ADDRESS gpuPtr; // set by mapGpuVA
|
||||
WddmAllocation(void *cpuPtrIn, size_t sizeIn, void *alignedCpuPtr, size_t alignedSize, void *reservedAddr, MemoryPool::Type pool)
|
||||
WddmAllocation(void *cpuPtrIn, size_t sizeIn, void *alignedCpuPtr, size_t alignedSize, void *reservedAddr, MemoryPool::Type pool, size_t osContextsCount)
|
||||
: GraphicsAllocation(cpuPtrIn, sizeIn),
|
||||
handle(0),
|
||||
gpuPtr(0),
|
||||
@ -41,18 +41,19 @@ class WddmAllocation : public GraphicsAllocation {
|
||||
this->memoryPool = pool;
|
||||
}
|
||||
|
||||
WddmAllocation(void *cpuPtrIn, size_t sizeIn, osHandle sharedHandle, MemoryPool::Type pool) : GraphicsAllocation(cpuPtrIn, sizeIn, sharedHandle),
|
||||
handle(0),
|
||||
gpuPtr(0),
|
||||
alignedCpuPtr(nullptr),
|
||||
alignedSize(sizeIn) {
|
||||
WddmAllocation(void *cpuPtrIn, size_t sizeIn, osHandle sharedHandle, MemoryPool::Type pool, size_t osContextsCount)
|
||||
: GraphicsAllocation(cpuPtrIn, sizeIn, sharedHandle),
|
||||
handle(0),
|
||||
gpuPtr(0),
|
||||
alignedCpuPtr(nullptr),
|
||||
alignedSize(sizeIn) {
|
||||
trimListPosition = trimListUnusedPosition;
|
||||
reservedAddressSpace = nullptr;
|
||||
this->memoryPool = pool;
|
||||
}
|
||||
|
||||
WddmAllocation(void *alignedCpuPtr, size_t sizeIn, void *reservedAddress, MemoryPool::Type pool)
|
||||
: WddmAllocation(alignedCpuPtr, sizeIn, alignedCpuPtr, sizeIn, reservedAddress, pool) {
|
||||
WddmAllocation(void *alignedCpuPtr, size_t sizeIn, void *reservedAddress, MemoryPool::Type pool, size_t osContextsCount)
|
||||
: WddmAllocation(alignedCpuPtr, sizeIn, alignedCpuPtr, sizeIn, reservedAddress, pool, osContextsCount) {
|
||||
}
|
||||
|
||||
void *getAlignedCpuPtr() const {
|
||||
|
@ -67,7 +67,7 @@ GraphicsAllocation *WddmMemoryManager::allocateGraphicsMemoryForImage(ImageInfo
|
||||
delete gmm;
|
||||
return allocateGraphicsMemory(imgInfo.size);
|
||||
}
|
||||
auto allocation = new WddmAllocation(nullptr, imgInfo.size, nullptr, MemoryPool::SystemCpuInaccessible);
|
||||
auto allocation = new WddmAllocation(nullptr, imgInfo.size, nullptr, MemoryPool::SystemCpuInaccessible, getOsContextCount());
|
||||
allocation->gmm = gmm;
|
||||
|
||||
if (!WddmMemoryManager::createWddmAllocation(allocation, AllocationOrigin::EXTERNAL_ALLOCATION)) {
|
||||
@ -81,7 +81,7 @@ GraphicsAllocation *WddmMemoryManager::allocateGraphicsMemory64kb(size_t size, s
|
||||
size_t sizeAligned = alignUp(size, MemoryConstants::pageSize64k);
|
||||
Gmm *gmm = nullptr;
|
||||
|
||||
auto wddmAllocation = new WddmAllocation(nullptr, sizeAligned, nullptr, sizeAligned, nullptr, MemoryPool::System64KBPages);
|
||||
auto wddmAllocation = new WddmAllocation(nullptr, sizeAligned, nullptr, sizeAligned, nullptr, MemoryPool::System64KBPages, getOsContextCount());
|
||||
|
||||
gmm = new Gmm(nullptr, sizeAligned, false, preferRenderCompressed, true);
|
||||
wddmAllocation->gmm = gmm;
|
||||
@ -114,7 +114,7 @@ GraphicsAllocation *WddmMemoryManager::allocateGraphicsMemory(size_t size, size_
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
auto wddmAllocation = new WddmAllocation(pSysMem, sizeAligned, pSysMem, sizeAligned, nullptr, MemoryPool::System4KBPages);
|
||||
auto wddmAllocation = new WddmAllocation(pSysMem, sizeAligned, pSysMem, sizeAligned, nullptr, MemoryPool::System4KBPages, getOsContextCount());
|
||||
wddmAllocation->cpuPtrAllocated = true;
|
||||
|
||||
gmm = new Gmm(pSysMem, sizeAligned, uncacheable);
|
||||
@ -135,7 +135,7 @@ GraphicsAllocation *WddmMemoryManager::allocateGraphicsMemoryForNonSvmHostPtr(si
|
||||
auto offsetInPage = ptrDiff(cpuPtr, alignedPtr);
|
||||
auto alignedSize = alignSizeWholePage(cpuPtr, size);
|
||||
|
||||
auto wddmAllocation = new WddmAllocation(cpuPtr, size, alignedPtr, alignedSize, nullptr, MemoryPool::System4KBPages);
|
||||
auto wddmAllocation = new WddmAllocation(cpuPtr, size, alignedPtr, alignedSize, nullptr, MemoryPool::System4KBPages, getOsContextCount());
|
||||
wddmAllocation->allocationOffset = offsetInPage;
|
||||
|
||||
auto gmm = new Gmm(alignedPtr, alignedSize, false);
|
||||
@ -168,7 +168,7 @@ GraphicsAllocation *WddmMemoryManager::allocateGraphicsMemory(size_t size, const
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
auto allocation = new WddmAllocation(ptr, size, ptrAligned, sizeAligned, reserve, MemoryPool::System4KBPages);
|
||||
auto allocation = new WddmAllocation(ptr, size, ptrAligned, sizeAligned, reserve, MemoryPool::System4KBPages, getOsContextCount());
|
||||
allocation->allocationOffset = offset;
|
||||
|
||||
Gmm *gmm = new Gmm(ptrAligned, sizeAligned, false);
|
||||
@ -205,7 +205,7 @@ GraphicsAllocation *WddmMemoryManager::allocate32BitGraphicsMemory(size_t size,
|
||||
cpuPtrAllocated = true;
|
||||
}
|
||||
|
||||
auto wddmAllocation = new WddmAllocation(const_cast<void *>(ptrAligned), sizeAligned, const_cast<void *>(ptrAligned), sizeAligned, nullptr, MemoryPool::System4KBPagesWith32BitGpuAddressing);
|
||||
auto wddmAllocation = new WddmAllocation(const_cast<void *>(ptrAligned), sizeAligned, const_cast<void *>(ptrAligned), sizeAligned, nullptr, MemoryPool::System4KBPagesWith32BitGpuAddressing, getOsContextCount());
|
||||
wddmAllocation->cpuPtrAllocated = cpuPtrAllocated;
|
||||
wddmAllocation->is32BitAllocation = true;
|
||||
wddmAllocation->allocationOffset = offset;
|
||||
@ -228,7 +228,7 @@ GraphicsAllocation *WddmMemoryManager::allocate32BitGraphicsMemory(size_t size,
|
||||
}
|
||||
|
||||
GraphicsAllocation *WddmMemoryManager::createAllocationFromHandle(osHandle handle, bool requireSpecificBitness, bool ntHandle) {
|
||||
auto allocation = new WddmAllocation(nullptr, 0, handle, MemoryPool::SystemCpuInaccessible);
|
||||
auto allocation = new WddmAllocation(nullptr, 0, handle, MemoryPool::SystemCpuInaccessible, getOsContextCount());
|
||||
bool is32BitAllocation = false;
|
||||
|
||||
bool status = ntHandle ? wddm->openNTHandle((HANDLE)((UINT_PTR)handle), allocation)
|
||||
@ -455,7 +455,7 @@ void WddmMemoryManager::obtainGpuAddresFromFragments(WddmAllocation *allocation,
|
||||
}
|
||||
|
||||
GraphicsAllocation *WddmMemoryManager::createGraphicsAllocation(OsHandleStorage &handleStorage, size_t hostPtrSize, const void *hostPtr) {
|
||||
auto allocation = new WddmAllocation(const_cast<void *>(hostPtr), hostPtrSize, const_cast<void *>(hostPtr), hostPtrSize, nullptr, MemoryPool::System4KBPages);
|
||||
auto allocation = new WddmAllocation(const_cast<void *>(hostPtr), hostPtrSize, const_cast<void *>(hostPtr), hostPtrSize, nullptr, MemoryPool::System4KBPages, getOsContextCount());
|
||||
allocation->fragmentsStorage = handleStorage;
|
||||
obtainGpuAddresFromFragments(allocation, handleStorage);
|
||||
return allocation;
|
||||
|
@ -12,7 +12,7 @@ namespace OCLRT {
|
||||
|
||||
class MockWddmAllocation : public WddmAllocation {
|
||||
public:
|
||||
MockWddmAllocation() : WddmAllocation(nullptr, 0, nullptr, 0, nullptr, MemoryPool::MemoryNull) {
|
||||
MockWddmAllocation() : WddmAllocation(nullptr, 0, nullptr, 0, nullptr, MemoryPool::MemoryNull, 1u) {
|
||||
}
|
||||
};
|
||||
|
||||
|
@ -76,7 +76,7 @@ TEST_F(Wddm20Tests, givenNullPageTableManagerAndRenderCompressedResourceWhenMapp
|
||||
mockGmmRes->setUnifiedAuxTranslationCapable();
|
||||
|
||||
void *fakePtr = reinterpret_cast<void *>(0x100);
|
||||
WddmAllocation allocation(fakePtr, 0x2100, fakePtr, 0x3000, nullptr, MemoryPool::MemoryNull);
|
||||
WddmAllocation allocation(fakePtr, 0x2100, fakePtr, 0x3000, nullptr, MemoryPool::MemoryNull, 1u);
|
||||
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);
|
||||
WddmAllocation allocation(mm.allocateSystemMemory(100, 0), 100, nullptr, MemoryPool::MemoryNull, 1u);
|
||||
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, ptr, 0x3000, nullptr, MemoryPool::MemoryNull);
|
||||
WddmAllocation allocation(ptr, 0x2100, ptr, 0x3000, nullptr, MemoryPool::MemoryNull, 1u);
|
||||
Gmm *gmm = GmmHelperFunctions::getGmm(allocation.getAlignedCpuPtr(), allocation.getAlignedSize());
|
||||
|
||||
allocation.gmm = gmm;
|
||||
@ -217,7 +217,7 @@ TEST_F(Wddm20WithMockGdiDllTests, givenAllocationSmallerUnderlyingThanAlignedSiz
|
||||
|
||||
TEST_F(Wddm20WithMockGdiDllTests, givenWddmAllocationWhenMappingGpuVaThenUseGmmSize) {
|
||||
void *fakePtr = reinterpret_cast<void *>(0x123);
|
||||
WddmAllocation allocation(fakePtr, 100, fakePtr, 200, nullptr, MemoryPool::MemoryNull);
|
||||
WddmAllocation allocation(fakePtr, 100, fakePtr, 200, nullptr, MemoryPool::MemoryNull, 1u);
|
||||
std::unique_ptr<Gmm> gmm(GmmHelperFunctions::getGmm(allocation.getAlignedCpuPtr(), allocation.getAlignedSize()));
|
||||
|
||||
allocation.gmm = gmm.get();
|
||||
@ -240,7 +240,7 @@ TEST_F(Wddm20Tests, createAllocation32bit) {
|
||||
void *alignedPtr = (void *)0x12000;
|
||||
size_t alignedSize = 0x2000;
|
||||
|
||||
WddmAllocation allocation(alignedPtr, alignedSize, nullptr, MemoryPool::MemoryNull);
|
||||
WddmAllocation allocation(alignedPtr, alignedSize, nullptr, MemoryPool::MemoryNull, 1u);
|
||||
Gmm *gmm = GmmHelperFunctions::getGmm(allocation.getUnderlyingBuffer(), allocation.getUnderlyingBufferSize());
|
||||
|
||||
allocation.gmm = gmm;
|
||||
@ -268,7 +268,7 @@ TEST_F(Wddm20Tests, createAllocation32bit) {
|
||||
TEST_F(Wddm20Tests, givenGraphicsAllocationWhenItIsMappedInHeap1ThenItHasGpuAddressWithingHeap1Limits) {
|
||||
void *alignedPtr = (void *)0x12000;
|
||||
size_t alignedSize = 0x2000;
|
||||
WddmAllocation allocation(alignedPtr, alignedSize, nullptr, MemoryPool::MemoryNull);
|
||||
WddmAllocation allocation(alignedPtr, alignedSize, nullptr, MemoryPool::MemoryNull, 1u);
|
||||
|
||||
allocation.handle = ALLOCATION_HANDLE;
|
||||
allocation.gmm = GmmHelperFunctions::getGmm(allocation.getUnderlyingBuffer(), allocation.getUnderlyingBufferSize());
|
||||
@ -318,7 +318,7 @@ TEST_F(Wddm20WithMockGdiDllTests, GivenThreeOsHandlesWhenAskedForDestroyAllocati
|
||||
|
||||
TEST_F(Wddm20Tests, mapAndFreeGpuVa) {
|
||||
OsAgnosticMemoryManager mm(false, false, executionEnvironment);
|
||||
WddmAllocation allocation(mm.allocateSystemMemory(100, 0), 100, nullptr, MemoryPool::MemoryNull);
|
||||
WddmAllocation allocation(mm.allocateSystemMemory(100, 0), 100, nullptr, MemoryPool::MemoryNull, 1u);
|
||||
Gmm *gmm = GmmHelperFunctions::getGmm(allocation.getUnderlyingBuffer(), allocation.getUnderlyingBufferSize());
|
||||
|
||||
allocation.gmm = gmm;
|
||||
@ -344,7 +344,7 @@ TEST_F(Wddm20Tests, mapAndFreeGpuVa) {
|
||||
TEST_F(Wddm20Tests, givenNullAllocationWhenCreateThenAllocateAndMap) {
|
||||
OsAgnosticMemoryManager mm(false, false, executionEnvironment);
|
||||
|
||||
WddmAllocation allocation(nullptr, 100, nullptr, MemoryPool::MemoryNull);
|
||||
WddmAllocation allocation(nullptr, 100, nullptr, MemoryPool::MemoryNull, 1u);
|
||||
Gmm *gmm = GmmHelperFunctions::getGmm(allocation.getUnderlyingBuffer(), allocation.getUnderlyingBufferSize());
|
||||
|
||||
allocation.gmm = gmm;
|
||||
@ -363,7 +363,7 @@ TEST_F(Wddm20Tests, givenNullAllocationWhenCreateThenAllocateAndMap) {
|
||||
|
||||
TEST_F(Wddm20Tests, makeResidentNonResident) {
|
||||
OsAgnosticMemoryManager mm(false, false, executionEnvironment);
|
||||
WddmAllocation allocation(mm.allocateSystemMemory(100, 0), 100, nullptr, MemoryPool::MemoryNull);
|
||||
WddmAllocation allocation(mm.allocateSystemMemory(100, 0), 100, nullptr, MemoryPool::MemoryNull, 1u);
|
||||
Gmm *gmm = GmmHelperFunctions::getGmm(allocation.getUnderlyingBuffer(), allocation.getUnderlyingBufferSize());
|
||||
|
||||
allocation.gmm = gmm;
|
||||
@ -568,7 +568,7 @@ TEST(DebugFlagTest, givenDebugManagerWhenGetForUseNoRingFlushesKmdModeIsCalledTh
|
||||
|
||||
TEST_F(Wddm20Tests, makeResidentMultipleHandles) {
|
||||
OsAgnosticMemoryManager mm(false, false, executionEnvironment);
|
||||
WddmAllocation allocation(mm.allocateSystemMemory(100, 0), 100, nullptr, MemoryPool::MemoryNull);
|
||||
WddmAllocation allocation(mm.allocateSystemMemory(100, 0), 100, nullptr, MemoryPool::MemoryNull, 1u);
|
||||
allocation.handle = ALLOCATION_HANDLE;
|
||||
|
||||
D3DKMT_HANDLE handles[2] = {0};
|
||||
@ -590,7 +590,7 @@ TEST_F(Wddm20Tests, makeResidentMultipleHandles) {
|
||||
|
||||
TEST_F(Wddm20Tests, makeResidentMultipleHandlesWithReturnBytesToTrim) {
|
||||
OsAgnosticMemoryManager mm(false, false, executionEnvironment);
|
||||
WddmAllocation allocation(mm.allocateSystemMemory(100, 0), 100, nullptr, MemoryPool::MemoryNull);
|
||||
WddmAllocation allocation(mm.allocateSystemMemory(100, 0), 100, nullptr, MemoryPool::MemoryNull, 1u);
|
||||
allocation.handle = ALLOCATION_HANDLE;
|
||||
|
||||
D3DKMT_HANDLE handles[2] = {0};
|
||||
@ -630,7 +630,7 @@ TEST_F(Wddm20Tests, makeNonResidentCallsEvict) {
|
||||
}
|
||||
|
||||
TEST_F(Wddm20Tests, givenDestroyAllocationWhenItIsCalledThenAllocationIsPassedToDestroyAllocation) {
|
||||
WddmAllocation allocation((void *)0x23000, 0x1000, nullptr, MemoryPool::MemoryNull);
|
||||
WddmAllocation allocation((void *)0x23000, 0x1000, nullptr, MemoryPool::MemoryNull, 1u);
|
||||
allocation.getResidencyData().updateCompletionData(10, osContext.get());
|
||||
allocation.handle = ALLOCATION_HANDLE;
|
||||
|
||||
@ -658,7 +658,7 @@ TEST_F(Wddm20Tests, givenDestroyAllocationWhenItIsCalledThenAllocationIsPassedTo
|
||||
}
|
||||
|
||||
TEST_F(Wddm20Tests, WhenLastFenceLessEqualThanMonitoredThenWaitFromCpuIsNotCalled) {
|
||||
WddmAllocation allocation((void *)0x23000, 0x1000, nullptr, MemoryPool::MemoryNull);
|
||||
WddmAllocation allocation((void *)0x23000, 0x1000, nullptr, MemoryPool::MemoryNull, 1u);
|
||||
allocation.getResidencyData().updateCompletionData(10, osContext.get());
|
||||
allocation.handle = ALLOCATION_HANDLE;
|
||||
|
||||
@ -681,7 +681,7 @@ TEST_F(Wddm20Tests, WhenLastFenceLessEqualThanMonitoredThenWaitFromCpuIsNotCalle
|
||||
}
|
||||
|
||||
TEST_F(Wddm20Tests, WhenLastFenceGreaterThanMonitoredThenWaitFromCpuIsCalled) {
|
||||
WddmAllocation allocation((void *)0x23000, 0x1000, nullptr, MemoryPool::MemoryNull);
|
||||
WddmAllocation allocation((void *)0x23000, 0x1000, nullptr, MemoryPool::MemoryNull, 1u);
|
||||
allocation.getResidencyData().updateCompletionData(10, osContext.get());
|
||||
allocation.handle = ALLOCATION_HANDLE;
|
||||
|
||||
@ -739,7 +739,7 @@ TEST_F(Wddm20Tests, whenCreateAllocation64kFailsThenReturnFalse) {
|
||||
|
||||
void *fakePtr = reinterpret_cast<void *>(0x123);
|
||||
auto gmm = std::make_unique<Gmm>(fakePtr, 100, false);
|
||||
WddmAllocation allocation(fakePtr, 100, fakePtr, 200, nullptr, MemoryPool::MemoryNull);
|
||||
WddmAllocation allocation(fakePtr, 100, fakePtr, 200, nullptr, MemoryPool::MemoryNull, 1u);
|
||||
allocation.gmm = gmm.get();
|
||||
|
||||
EXPECT_FALSE(wddm->createAllocation64k(&allocation));
|
||||
|
@ -84,7 +84,7 @@ TEST_F(WddmKmDafListenerTest, givenWddmWhenUnlockResourceIsCalledThenKmDafListen
|
||||
}
|
||||
|
||||
TEST_F(WddmKmDafListenerTest, givenWddmWhenMapGpuVirtualAddressIsCalledThenKmDafListenerNotifyMapGpuVAIsFedWithCorrectParams) {
|
||||
WddmAllocation allocation((void *)0x23000, 0x1000, nullptr, MemoryPool::MemoryNull);
|
||||
WddmAllocation allocation((void *)0x23000, 0x1000, nullptr, MemoryPool::MemoryNull, 1u);
|
||||
allocation.handle = ALLOCATION_HANDLE;
|
||||
auto gmm = std::unique_ptr<Gmm>(new Gmm(nullptr, 1, false));
|
||||
allocation.gmm = gmm.get();
|
||||
@ -100,7 +100,7 @@ TEST_F(WddmKmDafListenerTest, givenWddmWhenMapGpuVirtualAddressIsCalledThenKmDaf
|
||||
}
|
||||
|
||||
TEST_F(WddmKmDafListenerTest, givenWddmWhenFreeGpuVirtualAddressIsCalledThenKmDafListenerNotifyUnmapGpuVAIsFedWithCorrectParams) {
|
||||
WddmAllocation allocation((void *)0x23000, 0x1000, nullptr, MemoryPool::MemoryNull);
|
||||
WddmAllocation allocation((void *)0x23000, 0x1000, nullptr, MemoryPool::MemoryNull, 1u);
|
||||
allocation.gpuPtr = GPUVA;
|
||||
|
||||
wddmWithKmDafMock->freeGpuVirtualAddres(allocation.gpuPtr, allocation.getUnderlyingBufferSize());
|
||||
@ -140,7 +140,7 @@ TEST_F(WddmKmDafListenerTest, givenWddmWhenEvictIsCalledThenKmDafListenerNotifyE
|
||||
}
|
||||
|
||||
TEST_F(WddmKmDafListenerTest, givenWddmWhenCreateAllocationIsCalledThenKmDafListenerNotifyWriteTargetIsFedWithCorrectParams) {
|
||||
WddmAllocation allocation((void *)0x23000, 0x1000, nullptr, MemoryPool::MemoryNull);
|
||||
WddmAllocation allocation((void *)0x23000, 0x1000, nullptr, MemoryPool::MemoryNull, 1u);
|
||||
auto gmm = std::unique_ptr<Gmm>(new Gmm(nullptr, 1, false));
|
||||
allocation.gmm = gmm.get();
|
||||
|
||||
@ -154,7 +154,7 @@ TEST_F(WddmKmDafListenerTest, givenWddmWhenCreateAllocationIsCalledThenKmDafList
|
||||
}
|
||||
|
||||
TEST_F(WddmKmDafListenerTest, givenWddmWhenCreateAllocation64IsCalledThenKmDafListenerNotifyWriteTargetIsFedWithCorrectParams) {
|
||||
WddmAllocation allocation((void *)0x23000, 0x1000, nullptr, MemoryPool::MemoryNull);
|
||||
WddmAllocation allocation((void *)0x23000, 0x1000, nullptr, MemoryPool::MemoryNull, 1u);
|
||||
auto gmm = std::unique_ptr<Gmm>(new Gmm(nullptr, 1, false));
|
||||
allocation.gmm = gmm.get();
|
||||
|
||||
|
@ -213,7 +213,7 @@ TEST_F(WddmMemoryManagerTest, GivenGraphicsAllocationWhenAddAndRemoveAllocationT
|
||||
void *cpuPtr = (void *)0x30000;
|
||||
size_t size = 0x1000;
|
||||
|
||||
WddmAllocation gfxAllocation(cpuPtr, size, nullptr, MemoryPool::MemoryNull);
|
||||
WddmAllocation gfxAllocation(cpuPtr, size, nullptr, MemoryPool::MemoryNull, memoryManager->getOsContextCount());
|
||||
memoryManager->addAllocationToHostPtrManager(&gfxAllocation);
|
||||
auto fragment = memoryManager->hostPtrManager.getFragment(gfxAllocation.getUnderlyingBuffer());
|
||||
EXPECT_NE(fragment, nullptr);
|
||||
@ -781,7 +781,7 @@ TEST_F(WddmMemoryManagerTest, givenManagerWithDisabledDeferredDeleterWhenMapGpuV
|
||||
memoryManager->setDeferredDeleter(nullptr);
|
||||
setMapGpuVaFailConfigFcn(0, 1);
|
||||
|
||||
WddmAllocation allocation(ptr, size, nullptr, MemoryPool::MemoryNull);
|
||||
WddmAllocation allocation(ptr, size, nullptr, MemoryPool::MemoryNull, memoryManager->getOsContextCount());
|
||||
allocation.gmm = gmm.get();
|
||||
bool ret = memoryManager->createWddmAllocation(&allocation, AllocationOrigin::EXTERNAL_ALLOCATION);
|
||||
EXPECT_FALSE(ret);
|
||||
@ -797,7 +797,7 @@ TEST_F(WddmMemoryManagerTest, givenManagerWithEnabledDeferredDeleterWhenFirstMap
|
||||
|
||||
setMapGpuVaFailConfigFcn(0, 1);
|
||||
|
||||
WddmAllocation allocation(ptr, size, nullptr, MemoryPool::MemoryNull);
|
||||
WddmAllocation allocation(ptr, size, nullptr, MemoryPool::MemoryNull, memoryManager->getOsContextCount());
|
||||
allocation.gmm = gmm.get();
|
||||
bool ret = memoryManager->createWddmAllocation(&allocation, AllocationOrigin::EXTERNAL_ALLOCATION);
|
||||
EXPECT_TRUE(ret);
|
||||
@ -813,7 +813,7 @@ TEST_F(WddmMemoryManagerTest, givenManagerWithEnabledDeferredDeleterWhenFirstAnd
|
||||
|
||||
setMapGpuVaFailConfigFcn(0, 2);
|
||||
|
||||
WddmAllocation allocation(ptr, size, nullptr, MemoryPool::MemoryNull);
|
||||
WddmAllocation allocation(ptr, size, nullptr, MemoryPool::MemoryNull, memoryManager->getOsContextCount());
|
||||
allocation.gmm = gmm.get();
|
||||
bool ret = memoryManager->createWddmAllocation(&allocation, AllocationOrigin::EXTERNAL_ALLOCATION);
|
||||
EXPECT_FALSE(ret);
|
||||
@ -1155,9 +1155,9 @@ TEST_F(WddmMemoryManagerResidencyTest, trimToBudgetReturnsFalseWhenNumBytesToTri
|
||||
}
|
||||
|
||||
TEST_F(WddmMemoryManagerResidencyTest, trimToBudgetStopsEvictingWhenNumBytesToTrimIsZero) {
|
||||
WddmAllocation allocation1(reinterpret_cast<void *>(0x1000), 0x1000, reinterpret_cast<void *>(0x1000), 0x1000, nullptr, MemoryPool::MemoryNull),
|
||||
allocation2(reinterpret_cast<void *>(0x1000), 0x3000, reinterpret_cast<void *>(0x1000), 0x3000, nullptr, MemoryPool::MemoryNull),
|
||||
allocation3(reinterpret_cast<void *>(0x1000), 0x1000, reinterpret_cast<void *>(0x1000), 0x1000, nullptr, MemoryPool::MemoryNull);
|
||||
WddmAllocation allocation1(reinterpret_cast<void *>(0x1000), 0x1000, reinterpret_cast<void *>(0x1000), 0x1000, nullptr, MemoryPool::MemoryNull, memoryManager->getOsContextCount()),
|
||||
allocation2(reinterpret_cast<void *>(0x1000), 0x3000, reinterpret_cast<void *>(0x1000), 0x3000, nullptr, MemoryPool::MemoryNull, memoryManager->getOsContextCount()),
|
||||
allocation3(reinterpret_cast<void *>(0x1000), 0x1000, reinterpret_cast<void *>(0x1000), 0x1000, nullptr, MemoryPool::MemoryNull, memoryManager->getOsContextCount());
|
||||
|
||||
allocation1.getResidencyData().resident = true;
|
||||
allocation1.getResidencyData().updateCompletionData(0, osContext);
|
||||
@ -1250,8 +1250,8 @@ TEST_F(WddmMemoryManagerResidencyTest, trimToBudgetWaitsFromCpuWhenLastFenceIsGr
|
||||
TEST_F(WddmMemoryManagerResidencyTest, trimToBudgetEvictsDoneFragmentsOnly) {
|
||||
gdi->setNonZeroNumBytesToTrimInEvict();
|
||||
void *ptr = reinterpret_cast<void *>(wddm->virtualAllocAddress + 0x1000);
|
||||
WddmAllocation allocation1(ptr, 0x1000, ptr, 0x1000, nullptr, MemoryPool::MemoryNull);
|
||||
WddmAllocation allocation2(ptr, 0x1000, ptr, 0x1000, nullptr, MemoryPool::MemoryNull);
|
||||
WddmAllocation allocation1(ptr, 0x1000, ptr, 0x1000, nullptr, MemoryPool::MemoryNull, memoryManager->getOsContextCount());
|
||||
WddmAllocation allocation2(ptr, 0x1000, ptr, 0x1000, nullptr, MemoryPool::MemoryNull, memoryManager->getOsContextCount());
|
||||
|
||||
allocation1.getResidencyData().resident = true;
|
||||
allocation1.getResidencyData().updateCompletionData(0, osContext);
|
||||
@ -1309,9 +1309,9 @@ TEST_F(WddmMemoryManagerResidencyTest, givenThreeAllocationsAlignedSizeBiggerTha
|
||||
void *ptr2 = reinterpret_cast<void *>(wddm->virtualAllocAddress + 0x3000);
|
||||
void *ptr3 = reinterpret_cast<void *>(wddm->virtualAllocAddress + 0x5000);
|
||||
|
||||
WddmAllocation allocation1(ptr1, underlyingSize, ptr1, alignedSize, nullptr, MemoryPool::MemoryNull);
|
||||
WddmAllocation allocation2(ptr2, underlyingSize, ptr2, alignedSize, nullptr, MemoryPool::MemoryNull);
|
||||
WddmAllocation allocation3(ptr3, underlyingSize, ptr3, alignedSize, nullptr, MemoryPool::MemoryNull);
|
||||
WddmAllocation allocation1(ptr1, underlyingSize, ptr1, alignedSize, nullptr, MemoryPool::MemoryNull, memoryManager->getOsContextCount());
|
||||
WddmAllocation allocation2(ptr2, underlyingSize, ptr2, alignedSize, nullptr, MemoryPool::MemoryNull, memoryManager->getOsContextCount());
|
||||
WddmAllocation allocation3(ptr3, underlyingSize, ptr3, alignedSize, nullptr, MemoryPool::MemoryNull, memoryManager->getOsContextCount());
|
||||
|
||||
allocation1.getResidencyData().resident = true;
|
||||
allocation1.getResidencyData().updateCompletionData(0, osContext);
|
||||
@ -1600,7 +1600,7 @@ TEST_F(WddmMemoryManagerTest2, makeResidentResidencyAllocationsSucceedsWhenMakeR
|
||||
MockWddmAllocation allocation1;
|
||||
void *cpuPtr = reinterpret_cast<void *>(wddm->getWddmMinAddress() + 0x1000);
|
||||
size_t allocationSize = 0x1000;
|
||||
WddmAllocation allocationToTrim(cpuPtr, allocationSize, cpuPtr, allocationSize, nullptr, MemoryPool::MemoryNull);
|
||||
WddmAllocation allocationToTrim(cpuPtr, allocationSize, cpuPtr, allocationSize, nullptr, MemoryPool::MemoryNull, memoryManager->getOsContextCount());
|
||||
|
||||
allocationToTrim.getResidencyData().updateCompletionData(osContext->get()->getMonitoredFence().lastSubmittedFence, osContext);
|
||||
|
||||
|
Reference in New Issue
Block a user