mirror of
https://github.com/intel/compute-runtime.git
synced 2026-01-03 06:49:52 +08:00
Refactor Graphics Allocation paths for Images
Change-Id: Ifa3084b18cac95289bbceeaf3669dd31567fbd3e
This commit is contained in:
committed by
sys_ocldev
parent
3dca095ccf
commit
f6790c42cf
@@ -40,17 +40,26 @@ WddmMemoryManager::WddmMemoryManager(bool enable64kbPages, bool enableLocalMemor
|
||||
mallocRestrictions.minAddress = wddm->getWddmMinAddress();
|
||||
}
|
||||
|
||||
GraphicsAllocation *WddmMemoryManager::allocateGraphicsMemoryForImage(ImageInfo &imgInfo, Gmm *gmm) {
|
||||
GraphicsAllocation *WddmMemoryManager::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) && imgInfo.mipCount == 0) {
|
||||
delete gmm;
|
||||
return allocateGraphicsMemoryWithProperties({imgInfo.size, GraphicsAllocation::AllocationType::UNDECIDED});
|
||||
}
|
||||
|
||||
auto allocation = std::make_unique<WddmAllocation>(nullptr, imgInfo.size, nullptr, MemoryPool::SystemCpuInaccessible, getOsContextCount(), false);
|
||||
allocation->gmm = gmm;
|
||||
allocation->gmm = gmm.get();
|
||||
|
||||
if (!WddmMemoryManager::createWddmAllocation(allocation.get(), AllocationOrigin::EXTERNAL_ALLOCATION)) {
|
||||
return nullptr;
|
||||
}
|
||||
gmm.release();
|
||||
return allocation.release();
|
||||
}
|
||||
|
||||
|
||||
@@ -39,7 +39,7 @@ class WddmMemoryManager : public MemoryManager {
|
||||
GraphicsAllocation *allocate32BitGraphicsMemory(size_t size, const void *ptr, AllocationOrigin allocationOrigin) override;
|
||||
GraphicsAllocation *createGraphicsAllocationFromSharedHandle(osHandle handle, bool requireSpecificBitness) override;
|
||||
GraphicsAllocation *createGraphicsAllocationFromNTHandle(void *handle) override;
|
||||
GraphicsAllocation *allocateGraphicsMemoryForImage(ImageInfo &imgInfo, Gmm *gmm) override;
|
||||
GraphicsAllocation *allocateGraphicsMemoryForImage(ImageInfo &imgInfo, const void *hostPtr) override;
|
||||
GraphicsAllocation *allocateGraphicsMemoryInDevicePool(const AllocationData &allocationData, AllocationStatus &status) override;
|
||||
|
||||
void addAllocationToHostPtrManager(GraphicsAllocation *memory) override;
|
||||
|
||||
Reference in New Issue
Block a user