diff --git a/opencl/test/unit_test/os_interface/linux/drm_memory_manager_tests.cpp b/opencl/test/unit_test/os_interface/linux/drm_memory_manager_tests.cpp index 1c4d7cfdfc..e7dd669aa9 100644 --- a/opencl/test/unit_test/os_interface/linux/drm_memory_manager_tests.cpp +++ b/opencl/test/unit_test/os_interface/linux/drm_memory_manager_tests.cpp @@ -656,7 +656,7 @@ TEST_F(DrmMemoryManagerTest, WhenAskedButNotAllowedHostPtrThenDoNotPinAfterAlloc TEST_F(DrmMemoryManagerTest, WhenUnreferenceIsCalledThenCallSucceeds) { mock->ioctl_expected.gemUserptr = 1; mock->ioctl_expected.gemClose = 1; - BufferObject *bo = memoryManager->allocUserptr(0, (size_t)1024, 0ul, rootDeviceIndex); + BufferObject *bo = memoryManager->allocUserptr(0, (size_t)1024, rootDeviceIndex); ASSERT_NE(nullptr, bo); memoryManager->unreference(bo, false); } @@ -669,7 +669,7 @@ TEST_F(DrmMemoryManagerTest, whenPrintBOCreateDestroyResultIsSetAndAllocUserptrI mock->ioctl_expected.gemClose = 1; testing::internal::CaptureStdout(); - BufferObject *bo = memoryManager->allocUserptr(0, (size_t)1024, 0ul, rootDeviceIndex); + BufferObject *bo = memoryManager->allocUserptr(0, (size_t)1024, rootDeviceIndex); ASSERT_NE(nullptr, bo); DebugManager.flags.PrintBOCreateDestroyResult.set(false); @@ -952,7 +952,7 @@ TEST_F(DrmMemoryManagerTest, GivenBoWaitFailureThenExpectThrow) { mock->ioctl_expected.gemWait = 1; mock->ioctl_expected.gemClose = 1; - BufferObject *bo = memoryManager->allocUserptr(0, (size_t)1024, 0ul, rootDeviceIndex); + BufferObject *bo = memoryManager->allocUserptr(0, (size_t)1024, rootDeviceIndex); ASSERT_NE(nullptr, bo); mock->ioctl_res = -EIO; EXPECT_THROW(bo->wait(-1), std::exception); diff --git a/shared/source/os_interface/linux/drm_memory_manager.cpp b/shared/source/os_interface/linux/drm_memory_manager.cpp index 181fcefacf..f7140a2afe 100644 --- a/shared/source/os_interface/linux/drm_memory_manager.cpp +++ b/shared/source/os_interface/linux/drm_memory_manager.cpp @@ -102,7 +102,7 @@ void DrmMemoryManager::initialize(gemCloseWorkerMode mode) { BufferObject *DrmMemoryManager::createRootDeviceBufferObject(uint32_t rootDeviceIndex) { BufferObject *bo = nullptr; if (forcePinEnabled || validateHostPtrMemory) { - bo = allocUserptr(reinterpret_cast(memoryForPinBBs[rootDeviceIndex]), MemoryConstants::pageSize, 0, rootDeviceIndex); + bo = allocUserptr(reinterpret_cast(memoryForPinBBs[rootDeviceIndex]), MemoryConstants::pageSize, rootDeviceIndex); if (bo) { if (isLimitedRange(rootDeviceIndex)) { auto boSize = bo->peekSize(); @@ -239,11 +239,10 @@ bool DrmMemoryManager::setMemPrefetch(GraphicsAllocation *gfxAllocation, uint32_ return drmAllocation->setMemPrefetch(&this->getDrm(rootDeviceIndex), subDeviceId); } -NEO::BufferObject *DrmMemoryManager::allocUserptr(uintptr_t address, size_t size, uint64_t flags, uint32_t rootDeviceIndex) { +NEO::BufferObject *DrmMemoryManager::allocUserptr(uintptr_t address, size_t size, uint32_t rootDeviceIndex) { GemUserPtr userptr = {}; userptr.userPtr = address; userptr.userSize = size; - userptr.flags = static_cast(flags); auto &drm = this->getDrm(rootDeviceIndex); @@ -339,7 +338,7 @@ DrmAllocation *DrmMemoryManager::createAllocWithAlignmentFromUserptr(const Alloc return nullptr; } - std::unique_ptr bo(allocUserptr(reinterpret_cast(res), size, 0, allocationData.rootDeviceIndex)); + std::unique_ptr bo(allocUserptr(reinterpret_cast(res), size, allocationData.rootDeviceIndex)); if (!bo) { alignedFreeWrapper(res); return nullptr; @@ -382,7 +381,6 @@ DrmAllocation *DrmMemoryManager::allocateUSMHostGraphicsMemory(const AllocationD std::unique_ptr bo(allocUserptr(reinterpret_cast(bufferPtr), cSize, - 0, allocationData.rootDeviceIndex)); if (!bo) { return nullptr; @@ -439,7 +437,7 @@ GraphicsAllocation *DrmMemoryManager::allocateGraphicsMemoryWithGpuVa(const Allo if (!res) return nullptr; - std::unique_ptr bo(allocUserptr(reinterpret_cast(res), alignedSize, 0, allocationData.rootDeviceIndex)); + std::unique_ptr bo(allocUserptr(reinterpret_cast(res), alignedSize, allocationData.rootDeviceIndex)); if (!bo) { alignedFreeWrapper(res); @@ -476,7 +474,7 @@ DrmAllocation *DrmMemoryManager::allocateGraphicsMemoryForNonSvmHostPtr(const Al return nullptr; } - std::unique_ptr bo(allocUserptr(reinterpret_cast(alignedPtr), realAllocationSize, 0, rootDeviceIndex)); + std::unique_ptr bo(allocUserptr(reinterpret_cast(alignedPtr), realAllocationSize, rootDeviceIndex)); if (!bo) { releaseGpuRange(reinterpret_cast(gpuVirtualAddress), alignedSize, rootDeviceIndex); return nullptr; @@ -593,7 +591,7 @@ DrmAllocation *DrmMemoryManager::allocate32BitGraphicsMemoryImpl(const Allocatio auto alignedUserPointer = reinterpret_cast(alignDown(allocationData.hostPtr, MemoryConstants::pageSize)); auto inputPointerOffset = inputPtr - alignedUserPointer; - std::unique_ptr bo(allocUserptr(alignedUserPointer, allocationSize, 0, allocationData.rootDeviceIndex)); + std::unique_ptr bo(allocUserptr(alignedUserPointer, allocationSize, allocationData.rootDeviceIndex)); if (!bo) { gfxPartition->heapFree(allocatorToUse, gpuVirtualAddress, realAllocationSize); return nullptr; @@ -628,7 +626,7 @@ DrmAllocation *DrmMemoryManager::allocate32BitGraphicsMemoryImpl(const Allocatio return nullptr; } - std::unique_ptr bo(allocUserptr(reinterpret_cast(ptrAlloc), alignedAllocationSize, 0, allocationData.rootDeviceIndex)); + std::unique_ptr bo(allocUserptr(reinterpret_cast(ptrAlloc), alignedAllocationSize, allocationData.rootDeviceIndex)); if (!bo) { alignedFreeWrapper(ptrAlloc); @@ -875,7 +873,7 @@ GraphicsAllocation *DrmMemoryManager::createPaddedAllocation(GraphicsAllocation auto alignedPtr = reinterpret_cast(alignDown(srcPtr, MemoryConstants::pageSize)); auto offset = ptrDiff(srcPtr, alignedPtr); - std::unique_ptr bo(allocUserptr(alignedPtr, alignedSrcSize, 0, rootDeviceIndex)); + std::unique_ptr bo(allocUserptr(alignedPtr, alignedSrcSize, rootDeviceIndex)); if (!bo) { return nullptr; } @@ -1024,8 +1022,7 @@ MemoryManager::AllocationStatus DrmMemoryManager::populateOsHandles(OsHandleStor handleStorage.fragmentStorageData[i].residency = new ResidencyData(maxOsContextCount); osHandle->bo = allocUserptr((uintptr_t)handleStorage.fragmentStorageData[i].cpuPtr, - handleStorage.fragmentStorageData[i].fragmentSize, - 0, rootDeviceIndex); + handleStorage.fragmentStorageData[i].fragmentSize, rootDeviceIndex); if (!osHandle->bo) { handleStorage.fragmentStorageData[i].freeTheFragment = true; return AllocationStatus::Error; diff --git a/shared/source/os_interface/linux/drm_memory_manager.h b/shared/source/os_interface/linux/drm_memory_manager.h index 882a776671..aa3dea69d1 100644 --- a/shared/source/os_interface/linux/drm_memory_manager.h +++ b/shared/source/os_interface/linux/drm_memory_manager.h @@ -92,7 +92,7 @@ class DrmMemoryManager : public MemoryManager { MOCKABLE_VIRTUAL BufferObject *findAndReferenceSharedBufferObject(int boHandle, uint32_t rootDeviceIndex); void eraseSharedBufferObject(BufferObject *bo); void pushSharedBufferObject(BufferObject *bo); - BufferObject *allocUserptr(uintptr_t address, size_t size, uint64_t flags, uint32_t rootDeviceIndex); + BufferObject *allocUserptr(uintptr_t address, size_t size, uint32_t rootDeviceIndex); bool setDomainCpu(GraphicsAllocation &graphicsAllocation, bool writeEnable); uint64_t acquireGpuRange(size_t &size, uint32_t rootDeviceIndex, HeapIndex heapIndex); MOCKABLE_VIRTUAL void releaseGpuRange(void *address, size_t size, uint32_t rootDeviceIndex); diff --git a/shared/source/os_interface/linux/drm_memory_manager_create_multi_host_allocation.cpp b/shared/source/os_interface/linux/drm_memory_manager_create_multi_host_allocation.cpp index af2fa607bc..8043d7961d 100644 --- a/shared/source/os_interface/linux/drm_memory_manager_create_multi_host_allocation.cpp +++ b/shared/source/os_interface/linux/drm_memory_manager_create_multi_host_allocation.cpp @@ -56,7 +56,7 @@ DrmAllocation *DrmMemoryManager::createMultiHostAllocation(const AllocationData } auto boHostPtr = static_cast(cpuBasePointer) + tile * sizePerTile; - auto bo = allocUserptr(reinterpret_cast(boHostPtr), sizePerTile, 0, allocationData.rootDeviceIndex); + auto bo = allocUserptr(reinterpret_cast(boHostPtr), sizePerTile, allocationData.rootDeviceIndex); if (!bo) { freeGraphicsMemoryImpl(allocation); return nullptr;