mirror of
https://github.com/intel/compute-runtime.git
synced 2025-12-20 08:53:55 +08:00
Refactor Graphics Allocation paths for Images
Change-Id: Ifa3084b18cac95289bbceeaf3669dd31567fbd3e
This commit is contained in:
committed by
sys_ocldev
parent
3dca095ccf
commit
f6790c42cf
@@ -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;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user