diff --git a/shared/source/os_interface/linux/drm_buffer_object.h b/shared/source/os_interface/linux/drm_buffer_object.h index 30c3dd14e1..7e375e0afd 100644 --- a/shared/source/os_interface/linux/drm_buffer_object.h +++ b/shared/source/os_interface/linux/drm_buffer_object.h @@ -227,9 +227,6 @@ class BufferObject { void requireExplicitLockedMemory(bool locked) { requiresLocked = locked; } bool isExplicitLockedMemoryRequired() { return requiresLocked; } - void setIsLockable(bool lockable) { this->lockable = lockable; }; - bool isLockable() const { return lockable; }; - uint64_t peekPatIndex() const { return patIndex; } void setPatIndex(uint64_t newPatIndex) { this->patIndex = newPatIndex; } BOType peekBOType() const { return boType; } @@ -283,6 +280,5 @@ class BufferObject { bool chunked = false; bool isReused = false; bool readOnlyGpuResource = false; - bool lockable = true; }; } // namespace NEO diff --git a/shared/source/os_interface/linux/drm_neo.cpp b/shared/source/os_interface/linux/drm_neo.cpp index 7c0317cbee..6445ba91a2 100644 --- a/shared/source/os_interface/linux/drm_neo.cpp +++ b/shared/source/os_interface/linux/drm_neo.cpp @@ -1435,10 +1435,10 @@ int changeBufferObjectBinding(Drm *drm, OsContext *osContext, uint32_t vmHandleI bool readOnlyResource = bo->isReadOnlyGpuResource(); if (drm->useVMBindImmediate()) { - bindMakeResident = bo->isExplicitResidencyRequired() && bo->isLockable(); + bindMakeResident = bo->isExplicitResidencyRequired(); bindImmediate = true; } - bool bindLock = bo->isExplicitLockedMemoryRequired() && bo->isLockable(); + bool bindLock = bo->isExplicitLockedMemoryRequired(); flags |= ioctlHelper->getFlagsForVmBind(bindCapture, bindImmediate, bindMakeResident, bindLock, readOnlyResource); } @@ -1532,14 +1532,8 @@ int changeBufferObjectBinding(Drm *drm, OsContext *osContext, uint32_t vmHandleI int Drm::bindBufferObject(OsContext *osContext, uint32_t vmHandleId, BufferObject *bo) { auto ret = changeBufferObjectBinding(this, osContext, vmHandleId, bo, true); if (ret != 0) { - errno = 0; static_cast(this->rootDeviceEnvironment.memoryOperationsInterface.get())->evictUnusedAllocations(false, false); ret = changeBufferObjectBinding(this, osContext, vmHandleId, bo, true); - if ((getErrno() == ENOMEM) && pageFaultSupported) { - DEBUG_BREAK_IF(true); - bo->setIsLockable(false); - ret = changeBufferObjectBinding(this, osContext, vmHandleId, bo, true); - } } return ret; } diff --git a/shared/test/unit_test/os_interface/linux/drm_buffer_object_tests.cpp b/shared/test/unit_test/os_interface/linux/drm_buffer_object_tests.cpp index ecda22c8ba..08b161ee44 100644 --- a/shared/test/unit_test/os_interface/linux/drm_buffer_object_tests.cpp +++ b/shared/test/unit_test/os_interface/linux/drm_buffer_object_tests.cpp @@ -1139,54 +1139,3 @@ TEST(DrmBufferObjectHandleWrapperTest, GivenWrapperWhenMoveConstructingAnotherOb EXPECT_EQ(2, secondBoHandleWrapper.controlBlock->refCount); } - -TEST_F(DrmBufferObjectTest, givenDrmWhenBindOperationFailsWithENOMEMThenBindWithoutLockingIsTried) { - auto executionEnvironment = new ExecutionEnvironment; - executionEnvironment->setDebuggingMode(NEO::DebuggingMode::online); - executionEnvironment->prepareRootDeviceEnvironments(1); - executionEnvironment->rootDeviceEnvironments[0]->setHwInfoAndInitHelpers(defaultHwInfo.get()); - executionEnvironment->rootDeviceEnvironments[0]->initGmm(); - executionEnvironment->rootDeviceEnvironments[0]->osInterface = std::make_unique(); - - auto drm = new DrmMock(*executionEnvironment->rootDeviceEnvironments[0]); - drm->requirePerContextVM = false; - drm->isVMBindImmediateSupported = true; - drm->pageFaultSupported = true; - - auto ioctlHelper = std::make_unique(*drm); - ioctlHelper->vmBindResult = -1; - ioctlHelper->isWaitBeforeBindRequiredResult = true; - drm->ioctlHelper.reset(ioctlHelper.release()); - - executionEnvironment->rootDeviceEnvironments[0]->osInterface->setDriverModel(std::unique_ptr(drm)); - executionEnvironment->rootDeviceEnvironments[0]->memoryOperationsInterface = DrmMemoryOperationsHandler::create(*drm, 0u, false); - uint64_t initFenceValue = 10u; - drm->fenceVal[0] = initFenceValue; - std::unique_ptr device(MockDevice::createWithExecutionEnvironment(defaultHwInfo.get(), executionEnvironment, 0)); - auto &engines = device->getExecutionEnvironment()->memoryManager->getRegisteredEngines(device->getRootDeviceIndex()); - auto osContextCount = engines.size(); - auto contextId = osContextCount / 2; - auto osContext = engines[contextId].osContext; - - MockBufferObject bo(device->getRootDeviceIndex(), drm, 3, 0, 0, osContextCount); - EXPECT_EQ(bo.isLockable(), true); - - drm->bindBufferObject(osContext, 0, &bo); - EXPECT_EQ(bo.isLockable(), true); - - drm->errnoRetVal = ENOMEM; - drm->baseErrno = false; - drm->bindBufferObject(osContext, 0, &bo); - EXPECT_EQ(bo.isLockable(), false); -} - -TEST_F(DrmBufferObjectTest, givenBufferObjectWhenSetIsLockableIsCalledThenIsLockableIsSet) { - MockExecutionEnvironment executionEnvironment(defaultHwInfo.get()); - DrmMock drm(*(executionEnvironment.rootDeviceEnvironments[0].get())); - MockBufferObject bo(0, &drm, 3, 0, 0, 1); - - for (auto isLockable : {false, true}) { - bo.setIsLockable(isLockable); - EXPECT_EQ(isLockable, bo.isLockable()); - } -}