Add debug flag for BO mmap creation

Change-Id: I1b0dc8b9328bf3aab64ceeaf9f1c5aeb4199eb08
Signed-off-by: Lukasz Jobczyk <lukasz.jobczyk@intel.com>
This commit is contained in:
Lukasz Jobczyk
2020-10-12 10:50:16 +02:00
committed by sys_ocldev
parent 9e463ab45f
commit 99f0d2b1db
4 changed files with 40 additions and 1 deletions

View File

@ -244,6 +244,9 @@ TEST_F(DrmMemoryManagerLocalMemoryTest, givenDrmMemoryManagerWhenCreateBufferObj
}
TEST_F(DrmMemoryManagerLocalMemoryTest, givenMemoryInfoWhenAllocateWithAlignmentThenGemCreateExtIsUsed) {
DebugManagerStateRestore restorer;
DebugManager.flags.EnableBOMmapCreate.set(-1);
drm_i915_memory_region_info regionInfo[2] = {};
regionInfo[0].region = {I915_MEMORY_CLASS_SYSTEM, 0};
regionInfo[1].region = {I915_MEMORY_CLASS_DEVICE, 0};
@ -263,6 +266,9 @@ TEST_F(DrmMemoryManagerLocalMemoryTest, givenMemoryInfoWhenAllocateWithAlignment
}
TEST_F(DrmMemoryManagerLocalMemoryTest, givenMemoryInfoAndFailedMmapOffsetWhenAllocateWithAlignmentThenNullptr) {
DebugManagerStateRestore restorer;
DebugManager.flags.EnableBOMmapCreate.set(-1);
drm_i915_memory_region_info regionInfo[2] = {};
regionInfo[0].region = {I915_MEMORY_CLASS_SYSTEM, 0};
regionInfo[1].region = {I915_MEMORY_CLASS_DEVICE, 0};
@ -279,7 +285,32 @@ TEST_F(DrmMemoryManagerLocalMemoryTest, givenMemoryInfoAndFailedMmapOffsetWhenAl
mock->mmapOffsetRetVal = 0;
}
TEST_F(DrmMemoryManagerLocalMemoryTest, givenMemoryInfoAndDisabledMmapBOCreationtWhenAllocateWithAlignmentThenUserptrIsUsed) {
DebugManagerStateRestore restorer;
DebugManager.flags.EnableBOMmapCreate.set(0);
drm_i915_memory_region_info regionInfo[2] = {};
regionInfo[0].region = {I915_MEMORY_CLASS_SYSTEM, 0};
regionInfo[1].region = {I915_MEMORY_CLASS_DEVICE, 0};
mock->memoryInfo.reset(new MemoryInfoImpl(regionInfo, 2));
mock->mmapOffsetRetVal = -1;
AllocationData allocationData;
allocationData.size = MemoryConstants::pageSize64k;
auto allocation = memoryManager->allocateGraphicsMemoryWithAlignment(allocationData);
EXPECT_NE(allocation, nullptr);
EXPECT_EQ(static_cast<int>(mock->returnHandle), allocation->getBO()->peekHandle() + 1);
memoryManager->freeGraphicsMemory(allocation);
}
TEST_F(DrmMemoryManagerLocalMemoryTest, givenMemoryInfoAndFailedGemCreateExtWhenAllocateWithAlignmentThenNullptr) {
DebugManagerStateRestore restorer;
DebugManager.flags.EnableBOMmapCreate.set(-1);
drm_i915_memory_region_info regionInfo[2] = {};
regionInfo[0].region = {I915_MEMORY_CLASS_SYSTEM, 0};
regionInfo[1].region = {I915_MEMORY_CLASS_DEVICE, 0};

View File

@ -101,6 +101,7 @@ UseNoRingFlushesKmdMode = 1
DisableZeroCopyForUseHostPtr = 0
DisableZeroCopyForBuffers = 0
DisableDcFlushInEpilogue = 0
EnableBOMmapCreate = 0
EnableHostPtrTracking = -1
EnableNV12 = 1
EnablePackedYuv = 1