@@ -152,7 +152,7 @@ TEST_F(DrmMemoryManagerTest, GivenGraphicsAllocationWhenAddAndRemoveAllocationTo
152152 EXPECT_EQ (fragment->fragmentCpuPointer , cpuPtr);
153153 EXPECT_EQ (fragment->fragmentSize , size);
154154 EXPECT_NE (fragment->osInternalStorage , nullptr );
155- EXPECT_EQ (fragment->osInternalStorage ->bo , gfxAllocation.getBO ());
155+ EXPECT_EQ (static_cast <OsHandleLinux *>( fragment->osInternalStorage ) ->bo , gfxAllocation.getBO ());
156156 EXPECT_NE (fragment->residency , nullptr );
157157
158158 FragmentStorage fragmentStorage = {};
@@ -1036,10 +1036,10 @@ TEST_F(DrmMemoryManagerWithExplicitExpectationsTest, givenEnabledHostMemoryValid
10361036}
10371037
10381038TEST_F (DrmMemoryManagerTest, GivenNoInputsWhenOsHandleIsCreatedThenAllBoHandlesAreInitializedAsNullPtrs) {
1039- OsHandle boHandle;
1039+ OsHandleLinux boHandle;
10401040 EXPECT_EQ (nullptr , boHandle.bo );
10411041
1042- std::unique_ptr<OsHandle > boHandle2 (new OsHandle );
1042+ std::unique_ptr<OsHandleLinux > boHandle2 (new OsHandleLinux );
10431043 EXPECT_EQ (nullptr , boHandle2->bo );
10441044}
10451045
@@ -1138,9 +1138,10 @@ TEST_F(DrmMemoryManagerTest, GivenMisalignedHostPtrAndMultiplePagesSizeWhenAsked
11381138 auto reqs = MockHostPtrManager::getAllocationRequirements (rootDeviceIndex, ptr, size);
11391139
11401140 for (int i = 0 ; i < maxFragmentsCount; i++) {
1141- ASSERT_NE (nullptr , graphicsAllocation->fragmentsStorage .fragmentStorageData [i].osHandleStorage ->bo );
1142- EXPECT_EQ (reqs.allocationFragments [i].allocationSize , graphicsAllocation->fragmentsStorage .fragmentStorageData [i].osHandleStorage ->bo ->peekSize ());
1143- EXPECT_EQ (reqs.allocationFragments [i].allocationPtr , reinterpret_cast <void *>(graphicsAllocation->fragmentsStorage .fragmentStorageData [i].osHandleStorage ->bo ->peekAddress ()));
1141+ auto osHandle = static_cast <OsHandleLinux *>(graphicsAllocation->fragmentsStorage .fragmentStorageData [i].osHandleStorage );
1142+ ASSERT_NE (nullptr , osHandle->bo );
1143+ EXPECT_EQ (reqs.allocationFragments [i].allocationSize , osHandle->bo ->peekSize ());
1144+ EXPECT_EQ (reqs.allocationFragments [i].allocationPtr , reinterpret_cast <void *>(osHandle->bo ->peekAddress ()));
11441145 }
11451146 memoryManager->freeGraphicsMemory (graphicsAllocation);
11461147
@@ -3232,7 +3233,7 @@ TEST_F(DrmMemoryManagerWithExplicitExpectationsTest, givenDisabledForcePinAndEna
32323233 mock->ioctl_expected .execbuffer2 = 0 ; // pinning for host memory validation is mocked
32333234
32343235 OsHandleStorage handleStorage;
3235- OsHandle handle1;
3236+ OsHandleLinux handle1;
32363237 handleStorage.fragmentStorageData [0 ].osHandleStorage = &handle1;
32373238 handleStorage.fragmentStorageData [0 ].cpuPtr = reinterpret_cast <void *>(0x1000 );
32383239 handleStorage.fragmentStorageData [0 ].fragmentSize = 4096 ;
@@ -3254,8 +3255,8 @@ TEST_F(DrmMemoryManagerWithExplicitExpectationsTest, givenDisabledForcePinAndEna
32543255 EXPECT_NE (nullptr , handleStorage.fragmentStorageData [1 ].osHandleStorage );
32553256 EXPECT_NE (nullptr , handleStorage.fragmentStorageData [2 ].osHandleStorage );
32563257
3257- EXPECT_EQ (handleStorage.fragmentStorageData [1 ].osHandleStorage ->bo , pinBB->pinnedBoArray [0 ]);
3258- EXPECT_EQ (handleStorage.fragmentStorageData [2 ].osHandleStorage ->bo , pinBB->pinnedBoArray [1 ]);
3258+ EXPECT_EQ (static_cast <OsHandleLinux *>( handleStorage.fragmentStorageData [1 ].osHandleStorage ) ->bo , pinBB->pinnedBoArray [0 ]);
3259+ EXPECT_EQ (static_cast <OsHandleLinux *>( handleStorage.fragmentStorageData [2 ].osHandleStorage ) ->bo , pinBB->pinnedBoArray [1 ]);
32593260
32603261 handleStorage.fragmentStorageData [0 ].freeTheFragment = false ;
32613262 handleStorage.fragmentStorageData [1 ].freeTheFragment = true ;
@@ -3534,7 +3535,7 @@ TEST_F(DrmMemoryManagerWithExplicitExpectationsTest, givenEnabledValidateHostMem
35343535 mock->ioctl_expected .execbuffer2 = 1 ;
35353536
35363537 OsHandleStorage handleStorage;
3537- OsHandle handle1;
3538+ OsHandleLinux handle1;
35383539 handleStorage.fragmentStorageData [0 ].osHandleStorage = &handle1;
35393540 handleStorage.fragmentStorageData [0 ].cpuPtr = reinterpret_cast <void *>(0x1000 );
35403541 handleStorage.fragmentStorageData [0 ].fragmentSize = 4096 ;
@@ -3584,7 +3585,7 @@ TEST_F(DrmMemoryManagerWithExplicitExpectationsTest, givenEnabledValidateHostMem
35843585 mock->ioctl_expected .execbuffer2 = 1 ;
35853586
35863587 OsHandleStorage handleStorage;
3587- OsHandle handle1;
3588+ OsHandleLinux handle1;
35883589 handleStorage.fragmentStorageData [0 ].osHandleStorage = &handle1;
35893590 handleStorage.fragmentStorageData [0 ].cpuPtr = reinterpret_cast <void *>(0x1000 );
35903591 handleStorage.fragmentStorageData [0 ].fragmentSize = 4096 ;
@@ -3652,12 +3653,12 @@ TEST_F(DrmMemoryManagerWithExplicitExpectationsTest, givenDrmMemoryManagerWhenCl
36523653 auto maxOsContextCount = 1u ;
36533654
36543655 OsHandleStorage handleStorage;
3655- handleStorage.fragmentStorageData [0 ].osHandleStorage = new OsHandle ();
3656+ handleStorage.fragmentStorageData [0 ].osHandleStorage = new OsHandleLinux ();
36563657 handleStorage.fragmentStorageData [0 ].residency = new ResidencyData (maxOsContextCount);
36573658 handleStorage.fragmentStorageData [0 ].cpuPtr = reinterpret_cast <void *>(0x1000 );
36583659 handleStorage.fragmentStorageData [0 ].fragmentSize = 4096 ;
36593660
3660- handleStorage.fragmentStorageData [1 ].osHandleStorage = new OsHandle ();
3661+ handleStorage.fragmentStorageData [1 ].osHandleStorage = new OsHandleLinux ();
36613662 handleStorage.fragmentStorageData [1 ].residency = new ResidencyData (maxOsContextCount);
36623663 handleStorage.fragmentStorageData [1 ].cpuPtr = reinterpret_cast <void *>(0x1000 );
36633664 handleStorage.fragmentStorageData [1 ].fragmentSize = 4096 ;
@@ -4377,7 +4378,7 @@ TEST_F(DrmMemoryManagerTest, givenDrmAllocationWithHostPtrWhenItIsCreatedWithCac
43774378 allocation->setCacheAdvice (drm, 1024 , CacheRegion::Region1);
43784379
43794380 for (uint32_t i = 0 ; i < storage.fragmentCount ; i++) {
4380- auto bo = allocation->fragmentsStorage .fragmentStorageData [i].osHandleStorage ->bo ;
4381+ auto bo = static_cast <OsHandleLinux *>( allocation->fragmentsStorage .fragmentStorageData [i].osHandleStorage ) ->bo ;
43814382 EXPECT_EQ (CacheRegion::Region1, bo->peekCacheRegion ());
43824383 }
43834384
0 commit comments