Add support for ntHandles in OCL

Signed-off-by: Kamil Diedrich <kamil.diedrich@intel.com>
This commit is contained in:
Kamil Diedrich
2022-06-15 11:07:49 +00:00
committed by Compute-Runtime-Automation
parent 5dda77d628
commit 97ea332a9f
8 changed files with 64 additions and 4 deletions

View File

@@ -163,6 +163,20 @@ GraphicsAllocation *MockMemoryManager::createGraphicsAllocationFromSharedHandle(
}
}
GraphicsAllocation *MockMemoryManager::createGraphicsAllocationFromNTHandle(void *handle, uint32_t rootDeviceIndex, AllocationType allocType) {
if (toOsHandle(handle) != invalidSharedHandle) {
auto graphicsAllocation = createMemoryAllocation(NEO::AllocationType::SHARED_BUFFER, nullptr, reinterpret_cast<void *>(1), 1,
4096u, toOsHandle(handle), MemoryPool::SystemCpuInaccessible, rootDeviceIndex,
false, false, false);
graphicsAllocation->setSharedHandle(toOsHandle(handle));
this->capturedSharedHandle = toOsHandle(handle);
return graphicsAllocation;
} else {
this->capturedSharedHandle = toOsHandle(handle);
return nullptr;
}
}
bool MockMemoryManager::copyMemoryToAllocationBanks(GraphicsAllocation *graphicsAllocation, size_t destinationOffset, const void *memoryToCopy, size_t sizeToCopy, DeviceBitfield handleMask) {
copyMemoryToAllocationBanksCalled++;
copyMemoryToAllocationBanksParamsPassed.push_back({graphicsAllocation, destinationOffset, memoryToCopy, sizeToCopy, handleMask});

View File

@@ -81,6 +81,7 @@ class MockMemoryManager : public MemoryManagerCreate<OsAgnosticMemoryManager> {
GraphicsAllocation *allocateGraphicsMemoryWithProperties(const AllocationProperties &properties, const void *ptr) override;
GraphicsAllocation *createGraphicsAllocationFromExistingStorage(AllocationProperties &properties, void *ptr, MultiGraphicsAllocation &multiGraphicsAllocation) override;
GraphicsAllocation *createGraphicsAllocationFromSharedHandle(osHandle handle, const AllocationProperties &properties, bool requireSpecificBitness, bool isHostIpcAllocation) override;
GraphicsAllocation *createGraphicsAllocationFromNTHandle(void *handle, uint32_t rootDeviceIndex, AllocationType allocType) override;
void *allocateSystemMemory(size_t size, size_t alignment) override;