mirror of
https://github.com/intel/compute-runtime.git
synced 2026-01-03 14:55:24 +08:00
WddmAllocation constructor accepts allocationType.
Change-Id: I1e561b11e78dd942e04f3b029739921d0929ceed Signed-off-by: Piotr Fusik <piotr.fusik@intel.com>
This commit is contained in:
@@ -33,16 +33,16 @@ class WddmAllocation : public GraphicsAllocation {
|
||||
|
||||
D3DGPU_VIRTUAL_ADDRESS gpuPtr; // set by mapGpuVA
|
||||
|
||||
WddmAllocation(void *cpuPtrIn, size_t sizeIn, void *reservedAddr, MemoryPool::Type pool, bool multiOsContextCapable)
|
||||
: GraphicsAllocation(AllocationType::UNKNOWN, cpuPtrIn, castToUint64(cpuPtrIn), 0llu, sizeIn, pool, multiOsContextCapable),
|
||||
WddmAllocation(AllocationType allocationType, void *cpuPtrIn, size_t sizeIn, void *reservedAddr, MemoryPool::Type pool, bool multiOsContextCapable)
|
||||
: GraphicsAllocation(allocationType, cpuPtrIn, castToUint64(cpuPtrIn), 0llu, sizeIn, pool, multiOsContextCapable),
|
||||
handle(0),
|
||||
gpuPtr(0),
|
||||
trimCandidateListPositions(maxOsContextCount, trimListUnusedPosition) {
|
||||
reservedAddressSpace = reservedAddr;
|
||||
}
|
||||
|
||||
WddmAllocation(void *cpuPtrIn, size_t sizeIn, osHandle sharedHandle, MemoryPool::Type pool, bool multiOsContextCapable)
|
||||
: GraphicsAllocation(AllocationType::UNKNOWN, cpuPtrIn, sizeIn, sharedHandle, pool, multiOsContextCapable),
|
||||
WddmAllocation(AllocationType allocationType, void *cpuPtrIn, size_t sizeIn, osHandle sharedHandle, MemoryPool::Type pool, bool multiOsContextCapable)
|
||||
: GraphicsAllocation(allocationType, cpuPtrIn, sizeIn, sharedHandle, pool, multiOsContextCapable),
|
||||
handle(0),
|
||||
gpuPtr(0),
|
||||
trimCandidateListPositions(maxOsContextCount, trimListUnusedPosition) {
|
||||
|
||||
@@ -47,7 +47,7 @@ GraphicsAllocation *WddmMemoryManager::allocateGraphicsMemoryForImageImpl(const
|
||||
return allocateGraphicsMemoryWithAlignment(allocationData);
|
||||
}
|
||||
|
||||
auto allocation = std::make_unique<WddmAllocation>(nullptr, allocationData.imgInfo->size, nullptr, MemoryPool::SystemCpuInaccessible, false);
|
||||
auto allocation = std::make_unique<WddmAllocation>(allocationData.type, nullptr, allocationData.imgInfo->size, nullptr, MemoryPool::SystemCpuInaccessible, false);
|
||||
allocation->gmm = gmm.get();
|
||||
if (!createWddmAllocation(allocation.get())) {
|
||||
return nullptr;
|
||||
@@ -62,7 +62,7 @@ GraphicsAllocation *WddmMemoryManager::allocateGraphicsMemoryForImageImpl(const
|
||||
GraphicsAllocation *WddmMemoryManager::allocateGraphicsMemory64kb(AllocationData allocationData) {
|
||||
size_t sizeAligned = alignUp(allocationData.size, MemoryConstants::pageSize64k);
|
||||
|
||||
auto wddmAllocation = std::make_unique<WddmAllocation>(nullptr, sizeAligned, nullptr, MemoryPool::System64KBPages, !!allocationData.flags.multiOsContextCapable);
|
||||
auto wddmAllocation = std::make_unique<WddmAllocation>(allocationData.type, nullptr, sizeAligned, nullptr, MemoryPool::System64KBPages, !!allocationData.flags.multiOsContextCapable);
|
||||
|
||||
auto gmm = new Gmm(nullptr, sizeAligned, false, allocationData.flags.preferRenderCompressed, true, {});
|
||||
wddmAllocation->gmm = gmm;
|
||||
@@ -93,7 +93,7 @@ GraphicsAllocation *WddmMemoryManager::allocateGraphicsMemoryWithAlignment(const
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
auto wddmAllocation = std::make_unique<WddmAllocation>(pSysMem, sizeAligned, nullptr, MemoryPool::System4KBPages, allocationData.flags.multiOsContextCapable);
|
||||
auto wddmAllocation = std::make_unique<WddmAllocation>(allocationData.type, pSysMem, sizeAligned, nullptr, MemoryPool::System4KBPages, allocationData.flags.multiOsContextCapable);
|
||||
wddmAllocation->driverAllocatedCpuPointer = pSysMem;
|
||||
|
||||
gmm = new Gmm(pSysMem, sizeAligned, allocationData.flags.uncacheable);
|
||||
@@ -115,7 +115,7 @@ GraphicsAllocation *WddmMemoryManager::allocateGraphicsMemoryForNonSvmHostPtr(si
|
||||
auto offsetInPage = ptrDiff(cpuPtr, alignedPtr);
|
||||
auto alignedSize = alignSizeWholePage(cpuPtr, size);
|
||||
|
||||
auto wddmAllocation = std::make_unique<WddmAllocation>(cpuPtr, size, nullptr, MemoryPool::System4KBPages, false);
|
||||
auto wddmAllocation = std::make_unique<WddmAllocation>(GraphicsAllocation::AllocationType::EXTERNAL_HOST_PTR, cpuPtr, size, nullptr, MemoryPool::System4KBPages, false);
|
||||
wddmAllocation->allocationOffset = offsetInPage;
|
||||
|
||||
auto gmm = new Gmm(alignedPtr, alignedSize, false);
|
||||
@@ -149,7 +149,7 @@ GraphicsAllocation *WddmMemoryManager::allocateGraphicsMemory(const AllocationPr
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
auto allocation = new WddmAllocation(ptr, properties.size, reserve, MemoryPool::System4KBPages, false);
|
||||
auto allocation = new WddmAllocation(properties.allocationType, ptr, properties.size, reserve, MemoryPool::System4KBPages, false);
|
||||
allocation->allocationOffset = offset;
|
||||
|
||||
Gmm *gmm = new Gmm(ptrAligned, sizeAligned, false);
|
||||
@@ -187,7 +187,7 @@ GraphicsAllocation *WddmMemoryManager::allocate32BitGraphicsMemoryImpl(const All
|
||||
ptrAligned = pSysMem;
|
||||
}
|
||||
|
||||
auto wddmAllocation = std::make_unique<WddmAllocation>(const_cast<void *>(ptrAligned), sizeAligned, nullptr,
|
||||
auto wddmAllocation = std::make_unique<WddmAllocation>(allocationData.type, const_cast<void *>(ptrAligned), sizeAligned, nullptr,
|
||||
MemoryPool::System4KBPagesWith32BitGpuAddressing, false);
|
||||
wddmAllocation->driverAllocatedCpuPointer = pSysMem;
|
||||
wddmAllocation->is32BitAllocation = true;
|
||||
@@ -212,7 +212,7 @@ GraphicsAllocation *WddmMemoryManager::allocate32BitGraphicsMemoryImpl(const All
|
||||
}
|
||||
|
||||
GraphicsAllocation *WddmMemoryManager::createAllocationFromHandle(osHandle handle, bool requireSpecificBitness, bool ntHandle) {
|
||||
auto allocation = std::make_unique<WddmAllocation>(nullptr, 0, handle, MemoryPool::SystemCpuInaccessible, false);
|
||||
auto allocation = std::make_unique<WddmAllocation>(GraphicsAllocation::AllocationType::UNDECIDED, nullptr, 0, handle, MemoryPool::SystemCpuInaccessible, false);
|
||||
|
||||
bool status = ntHandle ? wddm->openNTHandle((HANDLE)((UINT_PTR)handle), allocation.get())
|
||||
: wddm->openSharedHandle(handle, allocation.get());
|
||||
@@ -434,7 +434,7 @@ void WddmMemoryManager::obtainGpuAddressFromFragments(WddmAllocation *allocation
|
||||
}
|
||||
|
||||
GraphicsAllocation *WddmMemoryManager::createGraphicsAllocation(OsHandleStorage &handleStorage, const AllocationData &allocationData) {
|
||||
auto allocation = new WddmAllocation(const_cast<void *>(allocationData.hostPtr), allocationData.size, nullptr, MemoryPool::System4KBPages, false);
|
||||
auto allocation = new WddmAllocation(allocationData.type, const_cast<void *>(allocationData.hostPtr), allocationData.size, nullptr, MemoryPool::System4KBPages, false);
|
||||
allocation->fragmentsStorage = handleStorage;
|
||||
obtainGpuAddressFromFragments(allocation, handleStorage);
|
||||
return allocation;
|
||||
|
||||
Reference in New Issue
Block a user