Do not initiate limited range allocator if range above max64 bit address.

Change-Id: If7b0a83c5e5326f2b16d32533d8631ff6ff877cc
Signed-off-by: Mrozek, Michal <michal.mrozek@intel.com>
This commit is contained in:
Mrozek, Michal
2019-06-26 09:56:24 +02:00
committed by sys_ocldev
parent 1bc5f7b142
commit 840d81c9fc
3 changed files with 18 additions and 1 deletions

View File

@@ -3115,6 +3115,22 @@ TEST_F(DrmMemoryManagerBasic, ifLimitedRangeAllocatorAvailableWhenAskedForAlloca
limitedRangeAllocator->free(ptr, size);
}
TEST_F(DrmMemoryManagerBasic, givenAddressRangeBelowMax64BitAddressThenLimitedRangeAllocatorIsInitialized) {
std::unique_ptr<TestedDrmMemoryManager> memoryManager(new (std::nothrow) TestedDrmMemoryManager(false, false, false, executionEnvironment));
memoryManager->releaseLimitedAddressRangeAllocator();
EXPECT_EQ(nullptr, memoryManager->getDrmLimitedRangeAllocator());
memoryManager->forceLimitedRangeAllocator(MemoryConstants::max64BitAppAddress - 1);
EXPECT_NE(nullptr, memoryManager->getDrmLimitedRangeAllocator());
}
TEST_F(DrmMemoryManagerBasic, givenAddressRangeMax64BitWhenMemoryManagerIsCreatedThenLimitedRangeAllocatorIsNotInitialized) {
std::unique_ptr<TestedDrmMemoryManager> memoryManager(new (std::nothrow) TestedDrmMemoryManager(false, false, false, executionEnvironment));
memoryManager->releaseLimitedAddressRangeAllocator();
EXPECT_EQ(nullptr, memoryManager->getDrmLimitedRangeAllocator());
memoryManager->forceLimitedRangeAllocator(MemoryConstants::max64BitAppAddress);
EXPECT_EQ(nullptr, memoryManager->getDrmLimitedRangeAllocator());
}
TEST_F(DrmMemoryManagerTest, givenLimitedRangeAllocatorWithNonZeroBaseAndSizeWhenAskedForBaseThenCorrectBaseIsReturned) {
uint64_t size = 100u;
uint64_t base = 0x23000;