Refactor Graphics Allocation paths for Images

Change-Id: Ifa3084b18cac95289bbceeaf3669dd31567fbd3e
This commit is contained in:
Hoppe, Mateusz
2018-12-14 11:24:45 +01:00
committed by sys_ocldev
parent 3dca095ccf
commit f6790c42cf
20 changed files with 452 additions and 82 deletions

View File

@@ -280,11 +280,20 @@ DrmAllocation *DrmMemoryManager::allocateGraphicsMemory64kb(AllocationData alloc
return nullptr;
}
GraphicsAllocation *DrmMemoryManager::allocateGraphicsMemoryForImage(ImageInfo &imgInfo, Gmm *gmm) {
GraphicsAllocation *DrmMemoryManager::allocateGraphicsMemoryForImage(ImageInfo &imgInfo, const void *hostPtr) {
auto gmm = std::make_unique<Gmm>(imgInfo);
auto hostPtrAllocation = allocateGraphicsMemoryForImageFromHostPtr(imgInfo, hostPtr);
if (hostPtrAllocation) {
hostPtrAllocation->gmm = gmm.release();
return hostPtrAllocation;
}
if (!GmmHelper::allowTiling(*imgInfo.imgDesc)) {
auto alloc = MemoryManager::allocateGraphicsMemoryWithProperties({imgInfo.size, GraphicsAllocation::AllocationType::UNDECIDED});
if (alloc) {
alloc->gmm = gmm;
alloc->gmm = gmm.release();
}
return alloc;
}
@@ -316,7 +325,7 @@ GraphicsAllocation *DrmMemoryManager::allocateGraphicsMemoryForImage(ImageInfo &
auto allocation = new DrmAllocation(bo, nullptr, (uint64_t)gpuRange, imgInfo.size, MemoryPool::SystemCpuInaccessible, getOsContextCount(), false);
bo->setAllocationType(allocatorType);
allocation->gmm = gmm;
allocation->gmm = gmm.release();
return allocation;
}