@@ -90,24 +90,6 @@ TEST_F(DrmMemoryManagerTest, givenDebugVariableWhenCreatingDrmMemoryManagerThenS
9090 }
9191}
9292
93- TEST_F (DrmMemoryManagerTest, whenNewResidencyModelAvailableThenGemCloseWorkerInactive) {
94- auto drm = static_cast <DrmMockCustom *>(executionEnvironment->rootDeviceEnvironments [rootDeviceIndex]->osInterface ->getDriverModel ()->as <Drm>());
95- drm->bindAvailable = true ;
96-
97- memoryManager->disableGemCloseWorkerForNewResidencyModel ();
98-
99- for (const auto &engine : memoryManager->getRegisteredEngines ()) {
100- auto engineRootDeviceIndex = engine.commandStreamReceiver ->getRootDeviceIndex ();
101- auto rootDeviceDrm = static_cast <DrmMockCustom *>(executionEnvironment->rootDeviceEnvironments [engineRootDeviceIndex]->osInterface ->getDriverModel ()->as <Drm>());
102-
103- auto csr = static_cast <TestedDrmCommandStreamReceiver<DEFAULT_TEST_FAMILY_NAME> *>(engine.commandStreamReceiver );
104- EXPECT_TRUE (rootDeviceDrm->isVmBindAvailable ());
105- EXPECT_EQ (csr->peekGemCloseWorkerOperationMode (), gemCloseWorkerMode::gemCloseWorkerInactive);
106- }
107-
108- this ->dontTestIoctlInTearDown = true ;
109- }
110-
11193TEST_F (DrmMemoryManagerTest, givenDrmMemoryManagerWhenCheckForKmdMigrationThenCorrectValueIsReturned) {
11294 DebugManagerStateRestore restorer;
11395 auto drm = static_cast <DrmMockCustom *>(executionEnvironment->rootDeviceEnvironments [rootDeviceIndex]->osInterface ->getDriverModel ()->as <Drm>());
@@ -775,14 +757,15 @@ TEST(DrmMemoryManagerTest2, givenDrmMemoryManagerWhengetSystemSharedMemoryIsCall
775757 auto executionEnvironment = std::make_unique<MockExecutionEnvironment>();
776758 executionEnvironment->prepareRootDeviceEnvironments (4u );
777759 for (auto i = 0u ; i < 4u ; i++) {
760+ auto mock = new DrmMockCustom ();
761+ executionEnvironment->rootDeviceEnvironments [i]->osInterface = std::make_unique<OSInterface>();
762+ executionEnvironment->rootDeviceEnvironments [i]->osInterface ->setDriverModel (std::unique_ptr<DriverModel>(mock));
778763 executionEnvironment->rootDeviceEnvironments [i]->setHwInfo (defaultHwInfo.get ());
779764 }
780765 auto memoryManager = std::make_unique<TestedDrmMemoryManager>(false , false , false , *executionEnvironment);
781766
782767 for (auto i = 0u ; i < 4u ; i++) {
783- auto mock = new DrmMockCustom ();
784- executionEnvironment->rootDeviceEnvironments [i]->osInterface = std::make_unique<OSInterface>();
785- executionEnvironment->rootDeviceEnvironments [i]->osInterface ->setDriverModel (std::unique_ptr<DriverModel>(mock));
768+ auto mock = executionEnvironment->rootDeviceEnvironments [i]->osInterface ->getDriverModel ()->as <DrmMockCustom>();
786769
787770 mock->getContextParamRetValue = 16 * MemoryConstants::gigaByte;
788771 uint64_t mem = memoryManager->getSystemSharedMemory (i);
@@ -808,20 +791,24 @@ TEST(DrmMemoryManagerTest2, WhenGetMinimumSystemSharedMemoryThenCorrectValueIsRe
808791 executionEnvironment->prepareRootDeviceEnvironments (4u );
809792 for (auto i = 0u ; i < 4u ; i++) {
810793 executionEnvironment->rootDeviceEnvironments [i]->setHwInfo (defaultHwInfo.get ());
811- }
812- auto memoryManager = std::make_unique<TestedDrmMemoryManager>(false , false , false , *executionEnvironment);
813- for (auto i = 0u ; i < 4u ; i++) {
814794 auto mock = new DrmMockCustom ();
815795 executionEnvironment->rootDeviceEnvironments [i]->osInterface = std::make_unique<OSInterface>();
816796 executionEnvironment->rootDeviceEnvironments [i]->osInterface ->setDriverModel (std::unique_ptr<DriverModel>(mock));
797+ }
798+
799+ auto memoryManager = std::make_unique<TestedDrmMemoryManager>(false , false , false , *executionEnvironment);
800+
801+ for (auto i = 0u ; i < 4u ; i++) {
802+ auto mock = executionEnvironment->rootDeviceEnvironments [i]->osInterface ->getDriverModel ()->as <DrmMockCustom>();
817803
818804 auto hostMemorySize = MemoryConstants::pageSize * (uint64_t )(sysconf (_SC_PHYS_PAGES));
819805 // gpuMemSize < hostMemSize
820806 auto gpuMemorySize = hostMemorySize - 1u ;
807+
808+ mock->ioctl_expected .contextGetParam = 1 ;
821809 mock->getContextParamRetValue = gpuMemorySize;
822810
823811 uint64_t systemSharedMemorySize = memoryManager->getSystemSharedMemory (i);
824- mock->ioctl_expected .contextGetParam = 1 ;
825812
826813 EXPECT_EQ (gpuMemorySize, systemSharedMemorySize);
827814 mock->ioctl_expected .contextDestroy = 0 ;
@@ -3852,12 +3839,13 @@ TEST(DrmMemoryManagerWithExplicitExpectationsTest2, whenObtainFdFromHandleIsCall
38523839 executionEnvironment->prepareRootDeviceEnvironments (4u );
38533840 for (auto i = 0u ; i < 4u ; i++) {
38543841 executionEnvironment->rootDeviceEnvironments [i]->setHwInfo (defaultHwInfo.get ());
3855- }
3856- auto memoryManager = std::make_unique<TestedDrmMemoryManager>(false , false , false , *executionEnvironment);
3857- for (auto i = 0u ; i < 4u ; i++) {
38583842 auto mock = new DrmMockCustom ();
38593843 executionEnvironment->rootDeviceEnvironments [i]->osInterface = std::make_unique<OSInterface>();
38603844 executionEnvironment->rootDeviceEnvironments [i]->osInterface ->setDriverModel (std::unique_ptr<DriverModel>(mock));
3845+ }
3846+ auto memoryManager = std::make_unique<TestedDrmMemoryManager>(false , false , false , *executionEnvironment);
3847+ for (auto i = 0u ; i < 4u ; i++) {
3848+ auto mock = executionEnvironment->rootDeviceEnvironments [i]->osInterface ->getDriverModel ()->as <DrmMockCustom>();
38613849
38623850 int boHandle = 3 ;
38633851 mock->outputFd = 1337 ;
@@ -4128,10 +4116,10 @@ TEST(DrmMemoryManager, givenTrackedAllocationTypeAndDisabledRegistrationInDrmWhe
41284116 auto executionEnvironment = std::make_unique<MockExecutionEnvironment>();
41294117 executionEnvironment->prepareRootDeviceEnvironments (1u );
41304118 executionEnvironment->rootDeviceEnvironments [0 ]->setHwInfo (defaultHwInfo.get ());
4131- auto memoryManager = std::make_unique<TestedDrmMemoryManager>(false , false , false , *executionEnvironment);
41324119 auto mockDrm = new DrmMockResources (*executionEnvironment->rootDeviceEnvironments [0 ]);
41334120 executionEnvironment->rootDeviceEnvironments [0 ]->osInterface = std::make_unique<OSInterface>();
41344121 executionEnvironment->rootDeviceEnvironments [0 ]->osInterface ->setDriverModel (std::unique_ptr<DriverModel>(mockDrm));
4122+ auto memoryManager = std::make_unique<TestedDrmMemoryManager>(false , false , false , *executionEnvironment);
41354123
41364124 EXPECT_FALSE (mockDrm->resourceRegistrationEnabled ());
41374125
@@ -4149,10 +4137,10 @@ TEST(DrmMemoryManager, givenResourceRegistrationEnabledAndAllocTypeToCaptureWhen
41494137 auto executionEnvironment = std::make_unique<MockExecutionEnvironment>();
41504138 executionEnvironment->prepareRootDeviceEnvironments (1u );
41514139 executionEnvironment->rootDeviceEnvironments [0 ]->setHwInfo (defaultHwInfo.get ());
4152- auto memoryManager = std::make_unique<TestedDrmMemoryManager>(false , false , false , *executionEnvironment);
41534140 auto mockDrm = new DrmMockResources (*executionEnvironment->rootDeviceEnvironments [0 ]);
41544141 executionEnvironment->rootDeviceEnvironments [0 ]->osInterface = std::make_unique<OSInterface>();
41554142 executionEnvironment->rootDeviceEnvironments [0 ]->osInterface ->setDriverModel (std::unique_ptr<DriverModel>(mockDrm));
4143+ auto memoryManager = std::make_unique<TestedDrmMemoryManager>(false , false , false , *executionEnvironment);
41564144
41574145 // mock resource registration enabling by storing class handles
41584146 mockDrm->classHandles .push_back (1 );
@@ -4175,10 +4163,10 @@ TEST(DrmMemoryManager, givenTrackedAllocationTypeWhenAllocatingThenAllocationIsR
41754163 auto executionEnvironment = std::make_unique<MockExecutionEnvironment>();
41764164 executionEnvironment->prepareRootDeviceEnvironments (1u );
41774165 executionEnvironment->rootDeviceEnvironments [0 ]->setHwInfo (defaultHwInfo.get ());
4178- auto memoryManager = std::make_unique<TestedDrmMemoryManager>(false , false , false , *executionEnvironment);
41794166 auto mockDrm = new DrmMockResources (*executionEnvironment->rootDeviceEnvironments [0 ]);
41804167 executionEnvironment->rootDeviceEnvironments [0 ]->osInterface = std::make_unique<OSInterface>();
41814168 executionEnvironment->rootDeviceEnvironments [0 ]->osInterface ->setDriverModel (std::unique_ptr<DriverModel>(mockDrm));
4169+ auto memoryManager = std::make_unique<TestedDrmMemoryManager>(false , false , false , *executionEnvironment);
41824170
41834171 for (uint32_t i = 3 ; i < 3 + static_cast <uint32_t >(Drm::ResourceClass::MaxSize); i++) {
41844172 mockDrm->classHandles .push_back (i);
@@ -4205,10 +4193,10 @@ TEST(DrmMemoryManager, givenTrackedAllocationTypeWhenFreeingThenRegisteredHandle
42054193 auto executionEnvironment = std::make_unique<MockExecutionEnvironment>();
42064194 executionEnvironment->prepareRootDeviceEnvironments (1u );
42074195 executionEnvironment->rootDeviceEnvironments [0 ]->setHwInfo (defaultHwInfo.get ());
4208- auto memoryManager = std::make_unique<TestedDrmMemoryManager>(false , false , false , *executionEnvironment);
42094196 auto mockDrm = new DrmMockResources (*executionEnvironment->rootDeviceEnvironments [0 ]);
42104197 executionEnvironment->rootDeviceEnvironments [0 ]->osInterface = std::make_unique<OSInterface>();
42114198 executionEnvironment->rootDeviceEnvironments [0 ]->osInterface ->setDriverModel (std::unique_ptr<DriverModel>(mockDrm));
4199+ auto memoryManager = std::make_unique<TestedDrmMemoryManager>(false , false , false , *executionEnvironment);
42124200
42134201 for (uint32_t i = 3 ; i < 3 + static_cast <uint32_t >(Drm::ResourceClass::MaxSize); i++) {
42144202 mockDrm->classHandles .push_back (i);
0 commit comments