Refactor MemoryManager::allocateGraphicsMemoryInDevicePool

- create MemoryAllocation for OsAgnosticMemoryManager so that
freeGraphicsMemory is freeing correct object type
- other memory managers do not go this path

Change-Id: If2ada9b77bb4a41d09f82b79502594e0eda9f11b
Signed-off-by: Hoppe, Mateusz <mateusz.hoppe@intel.com>
This commit is contained in:
Hoppe, Mateusz
2019-05-08 14:48:26 +02:00
committed by sys_ocldev
parent eefb2bb488
commit 97245a2ca6
3 changed files with 29 additions and 6 deletions

View File

@@ -212,12 +212,11 @@ class MemoryManager {
return nullptr;
}
uint64_t gpuAddress = reinterpret_cast<uint64_t>(allocationData.hostPtr);
allocation = new GraphicsAllocation(allocationData.type,
cpuAllocation,
gpuAddress,
gpuAddress,
allocationData.size, MemoryPool::LocalMemory, false);
allocation->setDriverAllocatedCpuPtr(cpuAllocation);
allocation = constructGraphicsAllocation(allocationData.type,
cpuAllocation,
gpuAddress,
allocationData.size, MemoryPool::LocalMemory, false);
allocation->setGpuBaseAddress(gpuAddress);
} else {
allocation = allocateGraphicsMemory(allocationData);
}
@@ -236,6 +235,10 @@ class MemoryManager {
GraphicsAllocation *allocateGraphicsMemoryForImageFromHostPtr(const AllocationData &allocationData);
MOCKABLE_VIRTUAL GraphicsAllocation *allocateGraphicsMemoryForImage(const AllocationData &allocationData);
virtual GraphicsAllocation *allocateGraphicsMemoryForImageImpl(const AllocationData &allocationData, std::unique_ptr<Gmm> gmm) = 0;
virtual GraphicsAllocation *constructGraphicsAllocation(GraphicsAllocation::AllocationType allocationType, void *cpuPtrIn, uint64_t gpuAddress,
size_t sizeIn, MemoryPool::Type pool, bool multiOsContextCapable) {
return nullptr;
}
virtual void *lockResourceImpl(GraphicsAllocation &graphicsAllocation) = 0;
virtual void unlockResourceImpl(GraphicsAllocation &graphicsAllocation) = 0;