Skip to content

Commit 3a6ce6d

Browse files
feature: Improve ioctl helper function to synchronize userptr allocation
Related-To: NEO-11817 Signed-off-by: Slawomir Milczarek <[email protected]>
1 parent e7a8936 commit 3a6ce6d

File tree

2 files changed

+3
-4
lines changed

2 files changed

+3
-4
lines changed

shared/source/os_interface/linux/drm_memory_manager.cpp

+2-3
Original file line numberDiff line numberDiff line change
@@ -455,8 +455,7 @@ DrmAllocation *DrmMemoryManager::createAllocWithAlignmentFromUserptr(const Alloc
455455
return nullptr;
456456
}
457457

458-
auto ioctlHelper = getDrm(allocationData.rootDeviceIndex).getIoctlHelper();
459-
std::unique_ptr<BufferObject, BufferObject::Deleter> bo(ioctlHelper->allocUserptr(*this, allocationData, reinterpret_cast<uintptr_t>(res), size, allocationData.rootDeviceIndex));
458+
std::unique_ptr<BufferObject, BufferObject::Deleter> bo(allocUserptr(reinterpret_cast<uintptr_t>(res), size, allocationData.rootDeviceIndex));
460459
if (!bo) {
461460
alignedFreeWrapper(res);
462461
return nullptr;
@@ -1364,6 +1363,7 @@ void DrmMemoryManager::freeGraphicsMemoryImpl(GraphicsAllocation *gfxAllocation,
13641363
}
13651364
}
13661365

1366+
ioctlHelper->syncUserptrAlloc(*this, *gfxAllocation);
13671367
ioctlHelper->releaseGpuRange(*this, gfxAllocation->getReservedAddressPtr(), gfxAllocation->getReservedAddressSize(), gfxAllocation->getRootDeviceIndex());
13681368
alignedFreeWrapper(gfxAllocation->getDriverAllocatedCpuPtr());
13691369

@@ -1383,7 +1383,6 @@ void DrmMemoryManager::handleFenceCompletion(GraphicsAllocation *allocation) {
13831383
} else {
13841384
static_cast<DrmAllocation *>(allocation)->getBO()->wait(-1);
13851385
}
1386-
drm.getIoctlHelper()->syncUserptrAllocs(*this);
13871386
}
13881387

13891388
GraphicsAllocation *DrmMemoryManager::createGraphicsAllocationFromExistingStorage(AllocationProperties &properties, void *ptr, MultiGraphicsAllocation &multiGraphicsAllocation) {

shared/source/os_interface/linux/ioctl_helper.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -229,7 +229,7 @@ class IoctlHelper {
229229
virtual int munmapFunction(DrmMemoryManager &memoryManager, void *ptr, size_t size);
230230
virtual void registerMemoryToUnmap(DrmAllocation &allocation, void *pointer, size_t size, DrmAllocation::MemoryUnmapFunction unmapFunction);
231231
virtual BufferObject *allocUserptr(DrmMemoryManager &memoryManager, const AllocationData &allocData, uintptr_t address, size_t size, uint32_t rootDeviceIndex);
232-
virtual void syncUserptrAllocs(DrmMemoryManager &memoryManager) { return; };
232+
virtual void syncUserptrAlloc(DrmMemoryManager &memoryManager, GraphicsAllocation &allocation) { return; };
233233

234234
virtual bool queryDeviceParams(uint32_t *moduleId, uint16_t *serverType) { return false; }
235235

0 commit comments

Comments
 (0)