Skip to content

Commit 9e1c9ec

Browse files
Use MMAP_OFFSET ioctl to lock BufferObject
Signed-off-by: Bartosz Dunajski <[email protected]>
1 parent 77dde01 commit 9e1c9ec

File tree

7 files changed

+49
-110
lines changed

7 files changed

+49
-110
lines changed

opencl/test/unit_test/os_interface/linux/drm_memory_manager_localmem_upstream_tests.cpp

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -605,10 +605,10 @@ HWTEST2_F(DrmMemoryManagerLocalMemoryTest, givenSupportedTypeWhenAllocatingInDev
605605
}
606606

607607
TEST_F(DrmMemoryManagerLocalMemoryTest, givenDrmMemoryManagerWithLocalMemoryWhenLockResourceIsCalledOnNullBufferObjectThenReturnNullPtr) {
608-
auto ptr = memoryManager->lockResourceInLocalMemoryImpl(nullptr);
608+
auto ptr = memoryManager->lockBufferObject(nullptr);
609609
EXPECT_EQ(nullptr, ptr);
610610

611-
memoryManager->unlockResourceInLocalMemoryImpl(nullptr);
611+
memoryManager->unlockBufferObject(nullptr);
612612
}
613613

614614
TEST_F(DrmMemoryManagerLocalMemoryWithCustomMockTest, givenDrmMemoryManagerWithLocalMemoryWhenLockResourceIsCalledOnBufferObjectThenReturnPtr) {
@@ -617,11 +617,11 @@ TEST_F(DrmMemoryManagerLocalMemoryWithCustomMockTest, givenDrmMemoryManagerWithL
617617
DrmAllocation drmAllocation(0, AllocationType::UNKNOWN, &bo, nullptr, 0u, 0u, MemoryPool::LocalMemory);
618618
EXPECT_EQ(&bo, drmAllocation.getBO());
619619

620-
auto ptr = memoryManager->lockResourceInLocalMemoryImpl(&bo);
620+
auto ptr = memoryManager->lockBufferObject(&bo);
621621
EXPECT_NE(nullptr, ptr);
622622
EXPECT_EQ(ptr, bo.peekLockedAddress());
623623

624-
memoryManager->unlockResourceInLocalMemoryImpl(&bo);
624+
memoryManager->unlockBufferObject(&bo);
625625
EXPECT_EQ(nullptr, bo.peekLockedAddress());
626626
}
627627

@@ -691,14 +691,14 @@ struct DrmMemoryManagerToTestCopyMemoryToAllocation : public DrmMemoryManager {
691691
}
692692
return nullptr;
693693
}
694-
void *lockResourceInLocalMemoryImpl(BufferObject *bo) override {
694+
void *lockBufferObject(BufferObject *bo) override {
695695
if (lockedLocalMemorySize > 0) {
696696
lockedLocalMemory.reset(new uint8_t[lockedLocalMemorySize]);
697697
return lockedLocalMemory.get();
698698
}
699699
return nullptr;
700700
}
701-
void unlockResourceInLocalMemoryImpl(BufferObject *bo) override {
701+
void unlockBufferObject(BufferObject *bo) override {
702702
}
703703
void unlockResourceImpl(GraphicsAllocation &graphicsAllocation) override {
704704
}

opencl/test/unit_test/os_interface/linux/drm_memory_manager_tests.cpp

Lines changed: 16 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -2626,8 +2626,9 @@ TEST_F(DrmMemoryManagerTest, givenDrmMemoryManagerWhenLockUnlockIsCalledOnAlloca
26262626

26272627
TEST_F(DrmMemoryManagerTest, givenDrmMemoryManagerWhenLockUnlockIsCalledOnAllocationWithoutCpuPtrThenReturnLockedPtrAndSetCpuDomain) {
26282628
mock->ioctl_expected.gemCreate = 1;
2629-
mock->ioctl_expected.gemMmap = 1;
2630-
mock->ioctl_expected.gemSetDomain = 1;
2629+
mock->ioctl_expected.gemMmapOffset = 1;
2630+
mock->ioctl_expected.gemMmap = 0;
2631+
mock->ioctl_expected.gemSetDomain = 0;
26312632
mock->ioctl_expected.gemSetTiling = 1;
26322633
mock->ioctl_expected.gemWait = 1;
26332634
mock->ioctl_expected.gemClose = 1;
@@ -2656,17 +2657,12 @@ TEST_F(DrmMemoryManagerTest, givenDrmMemoryManagerWhenLockUnlockIsCalledOnAlloca
26562657
EXPECT_NE(nullptr, drmAllocation->getBO()->peekLockedAddress());
26572658

26582659
// check DRM_IOCTL_I915_GEM_MMAP input params
2659-
EXPECT_EQ((uint32_t)drmAllocation->getBO()->peekHandle(), mock->mmapHandle);
2660+
EXPECT_EQ((uint32_t)drmAllocation->getBO()->peekHandle(), mock->mmapOffsetHandle);
26602661
EXPECT_EQ(0u, mock->mmapPad);
26612662
EXPECT_EQ(0u, mock->mmapOffset);
2662-
EXPECT_EQ(drmAllocation->getBO()->peekSize(), mock->mmapSize);
2663+
EXPECT_EQ(0u, mock->mmapSize);
26632664
EXPECT_EQ(0u, mock->mmapFlags);
26642665

2665-
// check DRM_IOCTL_I915_GEM_SET_DOMAIN input params
2666-
EXPECT_EQ((uint32_t)drmAllocation->getBO()->peekHandle(), mock->setDomainHandle);
2667-
EXPECT_EQ((uint32_t)I915_GEM_DOMAIN_CPU, mock->setDomainReadDomains);
2668-
EXPECT_EQ(0u, mock->setDomainWriteDomain);
2669-
26702666
memoryManager->unlockResource(allocation);
26712667
EXPECT_EQ(nullptr, drmAllocation->getBO()->peekLockedAddress());
26722668

@@ -2693,15 +2689,11 @@ TEST_F(DrmMemoryManagerTest, givenDrmMemoryManagerWhenLockUnlockIsCalledOnAlloca
26932689
}
26942690

26952691
TEST_F(DrmMemoryManagerTest, givenDrmMemoryManagerWhenLockUnlockIsCalledButFailsOnIoctlMmapThenReturnNullPtr) {
2696-
mock->ioctl_expected.gemMmap = 1;
2692+
mock->ioctl_expected.gemMmapOffset = 1;
26972693
this->ioctlResExt = {mock->ioctl_cnt.total, -1};
26982694
mock->ioctl_res_ext = &ioctlResExt;
26992695

2700-
DrmMockCustom drmMock(*executionEnvironment->rootDeviceEnvironments[0]);
2701-
struct BufferObjectMock : public BufferObject {
2702-
BufferObjectMock(Drm *drm) : BufferObject(drm, 3, 1, 0, 1) {}
2703-
};
2704-
BufferObjectMock bo(&drmMock);
2696+
BufferObject bo(mock, 3, 1, 0, 1);
27052697
DrmAllocation drmAllocation(rootDeviceIndex, AllocationType::UNKNOWN, &bo, nullptr, 0u, static_cast<osHandle>(0u), MemoryPool::MemoryNull);
27062698
EXPECT_NE(nullptr, drmAllocation.getBO());
27072699

@@ -2718,7 +2710,7 @@ TEST_F(DrmMemoryManagerTest, givenDrmMemoryManagerWhenUnlockResourceIsCalledOnAl
27182710
DrmMemoryManagerToTestUnlockResource(ExecutionEnvironment &executionEnvironment, bool localMemoryEnabled, size_t lockableLocalMemorySize)
27192711
: DrmMemoryManager(gemCloseWorkerMode::gemCloseWorkerInactive, false, false, executionEnvironment) {
27202712
}
2721-
void unlockResourceInLocalMemoryImpl(BufferObject *bo) override {
2713+
void unlockBufferObject(BufferObject *bo) override {
27222714
unlockResourceInLocalMemoryImplParam.bo = bo;
27232715
unlockResourceInLocalMemoryImplParam.called = true;
27242716
}
@@ -4727,11 +4719,11 @@ TEST_F(DrmMemoryManagerTest, givenDrmManagerWithoutLocalMemoryWhenGettingGlobalM
47274719
}
47284720

47294721
struct DrmMemoryManagerToTestLockInLocalMemory : public TestedDrmMemoryManager {
4730-
using TestedDrmMemoryManager::lockResourceInLocalMemoryImpl;
4722+
using TestedDrmMemoryManager::lockResourceImpl;
47314723
DrmMemoryManagerToTestLockInLocalMemory(ExecutionEnvironment &executionEnvironment)
47324724
: TestedDrmMemoryManager(true, false, false, executionEnvironment) {}
47334725

4734-
void *lockResourceInLocalMemoryImpl(BufferObject *bo) override {
4726+
void *lockBufferObject(BufferObject *bo) override {
47354727
lockedLocalMemory.reset(new uint8_t[bo->peekSize()]);
47364728
return lockedLocalMemory.get();
47374729
}
@@ -4745,26 +4737,12 @@ TEST_F(DrmMemoryManagerTest, givenDrmManagerWithLocalMemoryWhenLockResourceIsCal
47454737
DrmAllocation drmAllocation(0, AllocationType::WRITE_COMBINED, &bo, nullptr, 0u, 0u, MemoryPool::LocalMemory);
47464738
EXPECT_EQ(&bo, drmAllocation.getBO());
47474739

4748-
auto ptr = memoryManager.lockResourceInLocalMemoryImpl(drmAllocation);
4740+
auto ptr = memoryManager.lockResourceImpl(drmAllocation);
47494741
EXPECT_NE(nullptr, ptr);
47504742
EXPECT_EQ(ptr, bo.peekLockedAddress());
47514743
EXPECT_TRUE(isAligned<MemoryConstants::pageSize64k>(ptr));
47524744

4753-
memoryManager.unlockResourceInLocalMemoryImpl(&bo);
4754-
EXPECT_EQ(nullptr, bo.peekLockedAddress());
4755-
}
4756-
4757-
TEST_F(DrmMemoryManagerTest, givenDrmManagerWithoutLocalMemoryWhenLockResourceIsCalledOnWriteCombinedAllocationThenReturnNullptr) {
4758-
TestedDrmMemoryManager memoryManager(false, false, false, *executionEnvironment);
4759-
BufferObject bo(mock, 3, 1, 1024, 0);
4760-
4761-
DrmAllocation drmAllocation(0, AllocationType::WRITE_COMBINED, &bo, nullptr, 0u, 0u, MemoryPool::LocalMemory);
4762-
EXPECT_EQ(&bo, drmAllocation.getBO());
4763-
4764-
auto ptr = memoryManager.lockResourceInLocalMemoryImpl(drmAllocation);
4765-
EXPECT_EQ(nullptr, ptr);
4766-
4767-
memoryManager.unlockResourceInLocalMemoryImpl(&bo);
4745+
memoryManager.unlockBufferObject(&bo);
47684746
EXPECT_EQ(nullptr, bo.peekLockedAddress());
47694747
}
47704748

@@ -4844,10 +4822,10 @@ TEST(DrmMemoryManagerSimpleTest, givenDrmMemoryManagerWhenLockResourceIsCalledOn
48444822
TestedDrmMemoryManager memoryManager(executionEnvironment);
48454823
DrmAllocation drmAllocation(0, AllocationType::UNKNOWN, nullptr, nullptr, 0u, 0u, MemoryPool::LocalMemory);
48464824

4847-
auto ptr = memoryManager.lockResourceInLocalMemoryImpl(drmAllocation.getBO());
4825+
auto ptr = memoryManager.lockBufferObject(drmAllocation.getBO());
48484826
EXPECT_EQ(nullptr, ptr);
48494827

4850-
memoryManager.unlockResourceInLocalMemoryImpl(drmAllocation.getBO());
4828+
memoryManager.unlockBufferObject(drmAllocation.getBO());
48514829
}
48524830

48534831
TEST(DrmMemoryManagerSimpleTest, givenDrmMemoryManagerWhenFreeGraphicsMemoryIsCalledOnAllocationWithNullBufferObjectThenEarlyReturn) {
@@ -5677,7 +5655,7 @@ struct DrmMemoryManagerToTestCopyMemoryToAllocationBanks : public DrmMemoryManag
56775655
: DrmMemoryManager(gemCloseWorkerMode::gemCloseWorkerInactive, false, false, executionEnvironment) {
56785656
lockedLocalMemorySize = lockableLocalMemorySize;
56795657
}
5680-
void *lockResourceInLocalMemoryImpl(BufferObject *bo) override {
5658+
void *lockBufferObject(BufferObject *bo) override {
56815659
if (lockedLocalMemorySize > 0) {
56825660
if (static_cast<uint32_t>(bo->peekHandle()) < lockedLocalMemory.size()) {
56835661
lockedLocalMemory[bo->peekHandle()].reset(new uint8_t[lockedLocalMemorySize]);
@@ -5686,7 +5664,7 @@ struct DrmMemoryManagerToTestCopyMemoryToAllocationBanks : public DrmMemoryManag
56865664
}
56875665
return nullptr;
56885666
}
5689-
void unlockResourceInLocalMemoryImpl(BufferObject *bo) override {
5667+
void unlockBufferObject(BufferObject *bo) override {
56905668
}
56915669
std::array<std::unique_ptr<uint8_t[]>, 4> lockedLocalMemory;
56925670
size_t lockedLocalMemorySize = 0;

shared/source/os_interface/linux/drm_memory_manager.cpp

Lines changed: 15 additions & 54 deletions
Original file line numberDiff line numberDiff line change
@@ -1090,10 +1090,6 @@ bool DrmMemoryManager::setDomainCpu(GraphicsAllocation &graphicsAllocation, bool
10901090
}
10911091

10921092
void *DrmMemoryManager::lockResourceImpl(GraphicsAllocation &graphicsAllocation) {
1093-
if (MemoryPool::LocalMemory == graphicsAllocation.getMemoryPool()) {
1094-
return lockResourceInLocalMemoryImpl(graphicsAllocation);
1095-
}
1096-
10971093
auto cpuPtr = graphicsAllocation.getUnderlyingBuffer();
10981094
if (cpuPtr != nullptr) {
10991095
[[maybe_unused]] auto success = setDomainCpu(graphicsAllocation, false);
@@ -1102,41 +1098,23 @@ void *DrmMemoryManager::lockResourceImpl(GraphicsAllocation &graphicsAllocation)
11021098
}
11031099

11041100
auto bo = static_cast<DrmAllocation &>(graphicsAllocation).getBO();
1105-
if (bo == nullptr)
1106-
return nullptr;
11071101

1108-
GemMmap mmapArg = {};
1109-
mmapArg.handle = bo->peekHandle();
1110-
mmapArg.size = bo->peekSize();
1111-
if (getDrm(graphicsAllocation.getRootDeviceIndex()).ioctl(DrmIoctl::GemMmap, &mmapArg) != 0) {
1112-
return nullptr;
1102+
if (graphicsAllocation.getAllocationType() == AllocationType::WRITE_COMBINED) {
1103+
auto addr = lockBufferObject(bo);
1104+
auto alignedAddr = alignUp(addr, MemoryConstants::pageSize64k);
1105+
auto notUsedSize = ptrDiff(alignedAddr, addr);
1106+
// call unmap to free the unaligned pages preceding the BO allocation and
1107+
// adjust the pointer in the CPU mapping to the beginning of the BO allocation
1108+
munmapFunction(addr, notUsedSize);
1109+
bo->setLockedAddress(alignedAddr);
1110+
return bo->peekLockedAddress();
11131111
}
11141112

1115-
bo->setLockedAddress(reinterpret_cast<void *>(mmapArg.addrPtr));
1116-
1117-
[[maybe_unused]] auto success = setDomainCpu(graphicsAllocation, false);
1118-
DEBUG_BREAK_IF(!success);
1119-
1120-
return bo->peekLockedAddress();
1113+
return lockBufferObject(bo);
11211114
}
11221115

11231116
void DrmMemoryManager::unlockResourceImpl(GraphicsAllocation &graphicsAllocation) {
1124-
if (MemoryPool::LocalMemory == graphicsAllocation.getMemoryPool()) {
1125-
return unlockResourceInLocalMemoryImpl(static_cast<DrmAllocation &>(graphicsAllocation).getBO());
1126-
}
1127-
1128-
auto cpuPtr = graphicsAllocation.getUnderlyingBuffer();
1129-
if (cpuPtr != nullptr) {
1130-
return;
1131-
}
1132-
1133-
auto bo = static_cast<DrmAllocation &>(graphicsAllocation).getBO();
1134-
if (bo == nullptr)
1135-
return;
1136-
1137-
releaseReservedCpuAddressRange(bo->peekLockedAddress(), bo->peekSize(), graphicsAllocation.getRootDeviceIndex());
1138-
1139-
bo->setLockedAddress(nullptr);
1117+
return unlockBufferObject(static_cast<DrmAllocation &>(graphicsAllocation).getBO());
11401118
}
11411119

11421120
int DrmMemoryManager::obtainFdFromHandle(int boHandle, uint32_t rootDeviceindex) {
@@ -1277,23 +1255,6 @@ uint64_t DrmMemoryManager::getLocalMemorySize(uint32_t rootDeviceIndex, uint32_t
12771255

12781256
return size;
12791257
}
1280-
void *DrmMemoryManager::lockResourceInLocalMemoryImpl(GraphicsAllocation &graphicsAllocation) {
1281-
if (!isLocalMemorySupported(graphicsAllocation.getRootDeviceIndex())) {
1282-
return nullptr;
1283-
}
1284-
auto bo = static_cast<DrmAllocation &>(graphicsAllocation).getBO();
1285-
if (graphicsAllocation.getAllocationType() == AllocationType::WRITE_COMBINED) {
1286-
auto addr = lockResourceInLocalMemoryImpl(bo);
1287-
auto alignedAddr = alignUp(addr, MemoryConstants::pageSize64k);
1288-
auto notUsedSize = ptrDiff(alignedAddr, addr);
1289-
// call unmap to free the unaligned pages preceding the BO allocation and
1290-
// adjust the pointer in the CPU mapping to the beginning of the BO allocation
1291-
munmapFunction(addr, notUsedSize);
1292-
bo->setLockedAddress(alignedAddr);
1293-
return bo->peekLockedAddress();
1294-
}
1295-
return lockResourceInLocalMemoryImpl(bo);
1296-
}
12971258

12981259
bool DrmMemoryManager::copyMemoryToAllocation(GraphicsAllocation *graphicsAllocation, size_t destinationOffset, const void *memoryToCopy, size_t sizeToCopy) {
12991260
if (graphicsAllocation->getUnderlyingBuffer() || !isLocalMemorySupported(graphicsAllocation->getRootDeviceIndex())) {
@@ -1310,17 +1271,17 @@ bool DrmMemoryManager::copyMemoryToAllocationBanks(GraphicsAllocation *graphicsA
13101271
if (!handleMask.test(handleId)) {
13111272
continue;
13121273
}
1313-
auto ptr = lockResourceInLocalMemoryImpl(drmAllocation->getBOs()[handleId]);
1274+
auto ptr = lockBufferObject(drmAllocation->getBOs()[handleId]);
13141275
if (!ptr) {
13151276
return false;
13161277
}
13171278
memcpy_s(ptrOffset(ptr, destinationOffset), graphicsAllocation->getUnderlyingBufferSize() - destinationOffset, memoryToCopy, sizeToCopy);
1318-
this->unlockResourceInLocalMemoryImpl(drmAllocation->getBOs()[handleId]);
1279+
this->unlockBufferObject(drmAllocation->getBOs()[handleId]);
13191280
}
13201281
return true;
13211282
}
13221283

1323-
void DrmMemoryManager::unlockResourceInLocalMemoryImpl(BufferObject *bo) {
1284+
void DrmMemoryManager::unlockBufferObject(BufferObject *bo) {
13241285
if (bo == nullptr)
13251286
return;
13261287

@@ -1765,7 +1726,7 @@ DrmAllocation *DrmMemoryManager::createAllocWithAlignment(const AllocationData &
17651726
}
17661727
}
17671728

1768-
void *DrmMemoryManager::lockResourceInLocalMemoryImpl(BufferObject *bo) {
1729+
void *DrmMemoryManager::lockBufferObject(BufferObject *bo) {
17691730
if (bo == nullptr) {
17701731
return nullptr;
17711732
}

shared/source/os_interface/linux/drm_memory_manager.h

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -117,9 +117,8 @@ class DrmMemoryManager : public MemoryManager {
117117
GraphicsAllocation *createSharedUnifiedMemoryAllocation(const AllocationData &allocationData);
118118

119119
void *lockResourceImpl(GraphicsAllocation &graphicsAllocation) override;
120-
void *lockResourceInLocalMemoryImpl(GraphicsAllocation &graphicsAllocation);
121-
MOCKABLE_VIRTUAL void *lockResourceInLocalMemoryImpl(BufferObject *bo);
122-
MOCKABLE_VIRTUAL void unlockResourceInLocalMemoryImpl(BufferObject *bo);
120+
MOCKABLE_VIRTUAL void *lockBufferObject(BufferObject *bo);
121+
MOCKABLE_VIRTUAL void unlockBufferObject(BufferObject *bo);
123122
void unlockResourceImpl(GraphicsAllocation &graphicsAllocation) override;
124123
DrmAllocation *allocate32BitGraphicsMemoryImpl(const AllocationData &allocationData, bool useLocalMemory) override;
125124
void cleanupBeforeReturn(const AllocationData &allocationData, GfxPartition *gfxPartition, DrmAllocation *drmAllocation, GraphicsAllocation *graphicsAllocation, uint64_t &gpuAddress, size_t &sizeAllocated);

shared/test/common/mocks/linux/mock_drm_memory_manager.h

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,8 @@ class TestedDrmMemoryManager : public MemoryManagerCreate<DrmMemoryManager> {
8383
using DrmMemoryManager::getUserptrAlignment;
8484
using DrmMemoryManager::gfxPartitions;
8585
using DrmMemoryManager::handleFenceCompletion;
86-
using DrmMemoryManager::lockResourceInLocalMemoryImpl;
86+
using DrmMemoryManager::lockBufferObject;
87+
using DrmMemoryManager::lockResourceImpl;
8788
using DrmMemoryManager::memoryForPinBBs;
8889
using DrmMemoryManager::mmapFunction;
8990
using DrmMemoryManager::munmapFunction;
@@ -96,7 +97,7 @@ class TestedDrmMemoryManager : public MemoryManagerCreate<DrmMemoryManager> {
9697
using DrmMemoryManager::setDomainCpu;
9798
using DrmMemoryManager::sharingBufferObjects;
9899
using DrmMemoryManager::supportsMultiStorageResources;
99-
using DrmMemoryManager::unlockResourceInLocalMemoryImpl;
100+
using DrmMemoryManager::unlockBufferObject;
100101
using DrmMemoryManager::waitOnCompletionFence;
101102
using MemoryManager::allocateGraphicsMemoryInDevicePool;
102103
using MemoryManager::heapAssigner;

shared/test/common/os_interface/linux/device_command_stream_fixture.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -179,7 +179,7 @@ int DrmMockCustom::ioctl(DrmIoctl request, void *arg) {
179179
} break;
180180
case DrmIoctl::GemMmapOffset: {
181181
auto mmapOffsetParams = reinterpret_cast<NEO::GemMmapOffset *>(arg);
182-
mmapOffsetParams->handle = mmapOffsetHandle;
182+
mmapOffsetHandle = mmapOffsetParams->handle;
183183
mmapOffsetParams->offset = mmapOffsetExpected;
184184
mmapOffsetFlags = mmapOffsetParams->flags;
185185
ioctl_cnt.gemMmapOffset++;

shared/test/unit_test/os_interface/linux/drm_memory_manager_localmem_prelim_tests.cpp

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -31,11 +31,11 @@ TEST_F(DrmMemoryManagerLocalMemoryWithCustomPrelimMockTest, givenDrmMemoryManage
3131
DrmAllocation drmAllocation(0, AllocationType::UNKNOWN, &bo, nullptr, 0u, 0u, MemoryPool::LocalMemory);
3232
EXPECT_EQ(&bo, drmAllocation.getBO());
3333

34-
auto ptr = memoryManager->lockResourceInLocalMemoryImpl(&bo);
34+
auto ptr = memoryManager->lockBufferObject(&bo);
3535
EXPECT_NE(nullptr, ptr);
3636
EXPECT_EQ(ptr, bo.peekLockedAddress());
3737

38-
memoryManager->unlockResourceInLocalMemoryImpl(&bo);
38+
memoryManager->unlockBufferObject(&bo);
3939
EXPECT_EQ(nullptr, bo.peekLockedAddress());
4040
}
4141

@@ -1223,10 +1223,10 @@ TEST_F(DrmMemoryManagerLocalMemoryPrelimTest, givenSupportedTypeWhenAllocatingIn
12231223
}
12241224

12251225
TEST_F(DrmMemoryManagerLocalMemoryPrelimTest, givenDrmMemoryManagerWithLocalMemoryWhenLockResourceIsCalledOnNullBufferObjectThenReturnNullPtr) {
1226-
auto ptr = memoryManager->lockResourceInLocalMemoryImpl(nullptr);
1226+
auto ptr = memoryManager->lockBufferObject(nullptr);
12271227
EXPECT_EQ(nullptr, ptr);
12281228

1229-
memoryManager->unlockResourceInLocalMemoryImpl(nullptr);
1229+
memoryManager->unlockBufferObject(nullptr);
12301230
}
12311231

12321232
TEST_F(DrmMemoryManagerLocalMemoryPrelimTest, givenPrintBOCreateDestroyResultFlagSetWhileCreatingBufferObjectInMemoryRegionThenDebugInformationIsPrinted) {
@@ -1455,15 +1455,15 @@ struct DrmMemoryManagerToTestCopyMemoryToAllocation : public DrmMemoryManager {
14551455
}
14561456
return nullptr;
14571457
}
1458-
void *lockResourceInLocalMemoryImpl(BufferObject *bo) override {
1458+
void *lockBufferObject(BufferObject *bo) override {
14591459
if (lockedLocalMemorySize > 0) {
14601460
deviceIndex = (deviceIndex < 3) ? deviceIndex + 1u : 0u;
14611461
lockedLocalMemory[deviceIndex].reset(new uint8_t[lockedLocalMemorySize]);
14621462
return lockedLocalMemory[deviceIndex].get();
14631463
}
14641464
return nullptr;
14651465
}
1466-
void unlockResourceInLocalMemoryImpl(BufferObject *bo) override {
1466+
void unlockBufferObject(BufferObject *bo) override {
14671467
}
14681468
void unlockResourceImpl(GraphicsAllocation &graphicsAllocation) override {
14691469
}

0 commit comments

Comments
 (0)