@@ -50,7 +50,7 @@ GraphicsAllocation *WddmMemoryManager::allocateGraphicsMemoryForImageImpl(const
5050
5151 auto allocation = std::make_unique<WddmAllocation>(allocationData.type , nullptr , allocationData.imgInfo ->size , nullptr , MemoryPool::SystemCpuInaccessible, false );
5252 allocation->setDefaultGmm (gmm.get ());
53- if (!createWddmAllocation (allocation.get ())) {
53+ if (!createWddmAllocation (allocation.get (), nullptr )) {
5454 return nullptr ;
5555 }
5656
@@ -101,7 +101,7 @@ GraphicsAllocation *WddmMemoryManager::allocateGraphicsMemoryWithAlignment(const
101101
102102 wddmAllocation->setDefaultGmm (gmm);
103103
104- if (!createWddmAllocation (wddmAllocation.get ())) {
104+ if (!createWddmAllocation (wddmAllocation.get (), wddmAllocation-> getAlignedCpuPtr () )) {
105105 delete gmm;
106106 freeSystemMemory (pSysMem);
107107 return nullptr ;
@@ -124,7 +124,7 @@ GraphicsAllocation *WddmMemoryManager::allocateGraphicsMemoryForNonSvmHostPtr(co
124124
125125 wddmAllocation->setDefaultGmm (gmm);
126126
127- if (!createWddmAllocation (wddmAllocation.get ())) {
127+ if (!createWddmAllocation (wddmAllocation.get (), wddmAllocation-> getAlignedCpuPtr () )) {
128128 delete gmm;
129129 return nullptr ;
130130 }
@@ -156,7 +156,7 @@ GraphicsAllocation *WddmMemoryManager::allocateGraphicsMemoryWithProperties(cons
156156
157157 Gmm *gmm = new Gmm (ptrAligned, sizeAligned, false );
158158 allocation->setDefaultGmm (gmm);
159- if (createWddmAllocation (allocation)) {
159+ if (createWddmAllocation (allocation, reserve )) {
160160 DebugManager.logAllocation (allocation);
161161 return allocation;
162162 }
@@ -198,7 +198,7 @@ GraphicsAllocation *WddmMemoryManager::allocate32BitGraphicsMemoryImpl(const All
198198 gmm = new Gmm (ptrAligned, sizeAligned, false );
199199 wddmAllocation->setDefaultGmm (gmm);
200200
201- if (!createWddmAllocation (wddmAllocation.get ())) {
201+ if (!createWddmAllocation (wddmAllocation.get (), wddmAllocation-> getAlignedCpuPtr () )) {
202202 delete gmm;
203203 freeSystemMemory (pSysMem);
204204 return nullptr ;
@@ -483,18 +483,18 @@ AlignedMallocRestrictions *WddmMemoryManager::getAlignedMallocRestrictions() {
483483 return &mallocRestrictions;
484484}
485485
486- bool WddmMemoryManager::createWddmAllocation (WddmAllocation *allocation) {
486+ bool WddmMemoryManager::createWddmAllocation (WddmAllocation *allocation, void *requiredGpuPtr ) {
487487 auto wddmSuccess = wddm->createAllocation (allocation->getAlignedCpuPtr (), allocation->getDefaultGmm (), allocation->getHandleToModify (0u ));
488488 if (wddmSuccess == STATUS_GRAPHICS_NO_VIDEO_MEMORY && deferredDeleter) {
489489 deferredDeleter->drain (true );
490490 wddmSuccess = wddm->createAllocation (allocation->getAlignedCpuPtr (), allocation->getDefaultGmm (), allocation->getHandleToModify (0u ));
491491 }
492492
493493 if (wddmSuccess == STATUS_SUCCESS) {
494- bool mapSuccess = wddm->mapGpuVirtualAddress (allocation, allocation-> getAlignedCpuPtr () );
494+ bool mapSuccess = wddm->mapGpuVirtualAddress (allocation, requiredGpuPtr );
495495 if (!mapSuccess && deferredDeleter) {
496496 deferredDeleter->drain (true );
497- mapSuccess = wddm->mapGpuVirtualAddress (allocation, allocation-> getAlignedCpuPtr () );
497+ mapSuccess = wddm->mapGpuVirtualAddress (allocation, requiredGpuPtr );
498498 }
499499 if (!mapSuccess) {
500500 wddm->destroyAllocations (allocation->getHandles ().data (), allocation->getNumHandles (), allocation->resourceHandle );
0 commit comments