Cleanup includes in drm_memory_manager.h

Signed-off-by: Mateusz Jablonski <mateusz.jablonski@intel.com>
This commit is contained in:
Mateusz Jablonski
2022-07-26 18:39:17 +02:00
committed by Compute-Runtime-Automation
parent c94b6581c2
commit db2d1a53b9
18 changed files with 78 additions and 50 deletions

View File

@@ -7,6 +7,8 @@
#include "shared/source/execution_environment/execution_environment.h"
#include "shared/source/gmm_helper/gmm_helper.h"
#include "shared/source/os_interface/linux/drm_allocation.h"
#include "shared/source/os_interface/linux/drm_buffer_object.h"
#include "shared/source/os_interface/linux/drm_memory_operations_handler.h"
#include "shared/test/common/helpers/debug_manager_state_restore.h"
#include "shared/test/common/libult/linux/drm_query_mock.h"

View File

@@ -689,7 +689,7 @@ TEST_F(DrmMemoryManagerLocalMemoryPrelimTest, givenMemoryInfoWhenAllocateWithAli
AllocationData allocationData;
allocationData.size = MemoryConstants::pageSize64k;
auto allocation = memoryManager->allocateGraphicsMemoryWithAlignment(allocationData);
auto allocation = static_cast<DrmAllocation *>(memoryManager->allocateGraphicsMemoryWithAlignment(allocationData));
EXPECT_NE(allocation, nullptr);
EXPECT_NE(allocation->getMmapPtr(), nullptr);
@@ -861,7 +861,7 @@ TEST_F(DrmMemoryManagerLocalMemoryPrelimTest, givenMemoryInfoAndDisabledMmapBOCr
AllocationData allocationData;
allocationData.size = MemoryConstants::pageSize64k;
auto allocation = memoryManager->allocateGraphicsMemoryWithAlignment(allocationData);
auto allocation = static_cast<DrmAllocation *>(memoryManager->allocateGraphicsMemoryWithAlignment(allocationData));
EXPECT_NE(allocation, nullptr);
EXPECT_EQ(static_cast<int>(mock->returnHandle), allocation->getBO()->peekHandle() + 1);
@@ -885,7 +885,7 @@ TEST_F(DrmMemoryManagerLocalMemoryPrelimTest, givenMemoryInfoAndNotUseObjectMmap
allocationData.size = MemoryConstants::pageSize64k;
allocationData.useMmapObject = false;
auto allocation = memoryManager->allocateGraphicsMemoryWithAlignment(allocationData);
auto allocation = static_cast<DrmAllocation *>(memoryManager->allocateGraphicsMemoryWithAlignment(allocationData));
EXPECT_NE(allocation, nullptr);
EXPECT_EQ(static_cast<int>(mock->returnHandle), allocation->getBO()->peekHandle() + 1);

View File

@@ -9,6 +9,8 @@
#include "shared/source/gmm_helper/gmm_helper.h"
#include "shared/source/helpers/heap_assigner.h"
#include "shared/source/os_interface/linux/allocator_helper.h"
#include "shared/source/os_interface/linux/drm_allocation.h"
#include "shared/source/os_interface/linux/drm_buffer_object.h"
#include "shared/source/os_interface/linux/drm_memory_manager.h"
#include "shared/source/os_interface/linux/drm_memory_operations_handler.h"
#include "shared/source/os_interface/os_interface.h"
@@ -329,7 +331,7 @@ HWTEST2_F(DrmMemoryManagerLocalMemoryTest, givenMemoryInfoWhenAllocateWithAlignm
AllocationData allocationData;
allocationData.size = MemoryConstants::pageSize64k;
auto allocation = memoryManager->allocateGraphicsMemoryWithAlignment(allocationData);
auto allocation = static_cast<DrmAllocation *>(memoryManager->allocateGraphicsMemoryWithAlignment(allocationData));
EXPECT_NE(allocation, nullptr);
EXPECT_NE(allocation->getMmapPtr(), nullptr);
@@ -355,7 +357,7 @@ TEST_F(DrmMemoryManagerLocalMemoryTest, givenMemoryInfoAndNotUseObjectMmapProper
allocationData.size = MemoryConstants::pageSize64k;
allocationData.useMmapObject = false;
auto allocation = memoryManager->allocateGraphicsMemoryWithAlignment(allocationData);
auto allocation = static_cast<DrmAllocation *>(memoryManager->allocateGraphicsMemoryWithAlignment(allocationData));
EXPECT_NE(allocation, nullptr);
EXPECT_EQ(static_cast<int>(mock->returnHandle), allocation->getBO()->peekHandle() + 1);
@@ -397,7 +399,7 @@ TEST_F(DrmMemoryManagerLocalMemoryTest, givenMemoryInfoAndDisabledMmapBOCreation
AllocationData allocationData;
allocationData.size = MemoryConstants::pageSize64k;
auto allocation = memoryManager->allocateGraphicsMemoryWithAlignment(allocationData);
auto allocation = static_cast<DrmAllocation *>(memoryManager->allocateGraphicsMemoryWithAlignment(allocationData));
EXPECT_NE(allocation, nullptr);
EXPECT_EQ(static_cast<int>(mock->returnHandle), allocation->getBO()->peekHandle() + 1);

View File

@@ -559,7 +559,7 @@ TEST_F(DrmMemoryManagerTest, WhenAskedAndAllowedAndBigAllocationHostPtrThenPinAf
allocationData.size = 10 * MB;
allocationData.hostPtr = ::alignedMalloc(allocationData.size, 4096);
allocationData.flags.forcePin = true;
auto alloc = memoryManager->allocateGraphicsMemoryWithHostPtr(allocationData);
auto alloc = static_cast<DrmAllocation *>(memoryManager->allocateGraphicsMemoryWithHostPtr(allocationData));
ASSERT_NE(nullptr, alloc);
EXPECT_NE(nullptr, alloc->getBO());
@@ -583,7 +583,7 @@ TEST_F(DrmMemoryManagerTest, givenSmallAllocationHostPtrAllocationWhenForcePinIs
allocationData.size = 4 * 1024;
allocationData.hostPtr = ::alignedMalloc(allocationData.size, 4096);
allocationData.flags.forcePin = true;
auto alloc = memoryManager->allocateGraphicsMemoryWithHostPtr(allocationData);
auto alloc = static_cast<DrmAllocation *>(memoryManager->allocateGraphicsMemoryWithHostPtr(allocationData));
ASSERT_NE(nullptr, alloc);
EXPECT_NE(nullptr, alloc->getBO());
@@ -602,7 +602,7 @@ TEST_F(DrmMemoryManagerTest, WhenNotAskedButAllowedHostPtrThendoNotPinAfterAlloc
allocationData.size = 4 * 1024;
allocationData.hostPtr = ::alignedMalloc(allocationData.size, 4096);
auto alloc = memoryManager->allocateGraphicsMemoryWithHostPtr(allocationData);
auto alloc = static_cast<DrmAllocation *>(memoryManager->allocateGraphicsMemoryWithHostPtr(allocationData));
ASSERT_NE(nullptr, alloc);
EXPECT_NE(nullptr, alloc->getBO());
@@ -621,7 +621,7 @@ TEST_F(DrmMemoryManagerTest, WhenAskedButNotAllowedHostPtrThenDoNotPinAfterAlloc
allocationData.size = 4 * 1024;
allocationData.hostPtr = ::alignedMalloc(allocationData.size, 4096);
allocationData.flags.forcePin = true;
auto alloc = memoryManager->allocateGraphicsMemoryWithHostPtr(allocationData);
auto alloc = static_cast<DrmAllocation *>(memoryManager->allocateGraphicsMemoryWithHostPtr(allocationData));
ASSERT_NE(nullptr, alloc);
EXPECT_NE(nullptr, alloc->getBO());
@@ -2149,7 +2149,7 @@ TEST_F(DrmMemoryManagerUSMHostAllocationTests, givenCallToAllocateGraphicsMemory
AllocationData allocationData;
allocationData.size = 16384;
allocationData.rootDeviceIndex = rootDeviceIndex;
NEO::DrmAllocation *alloc = memoryManager->allocateGraphicsMemoryWithAlignment(allocationData);
auto alloc = memoryManager->allocateGraphicsMemoryWithAlignment(allocationData);
EXPECT_NE(nullptr, alloc);
memoryManager->freeGraphicsMemoryImpl(alloc);
}
@@ -2552,7 +2552,7 @@ TEST_F(DrmMemoryManagerTest, givenForcePinAndHostMemoryValidationEnabledWhenSmal
// one page is too small for early pinning but pinning is used for host memory validation
allocationData.size = 4 * 1024;
allocationData.hostPtr = ::alignedMalloc(allocationData.size, 4096);
auto alloc = memoryManager->allocateGraphicsMemoryWithHostPtr(allocationData);
auto alloc = static_cast<DrmAllocation *>(memoryManager->allocateGraphicsMemoryWithHostPtr(allocationData));
ASSERT_NE(nullptr, alloc);
EXPECT_NE(nullptr, alloc->getBO());
@@ -2648,7 +2648,7 @@ TEST_F(DrmMemoryManagerBasic, givenDrmMemoryManagerWhenAllocateGraphicsMemoryFor
allocationData.size = 4 * MB + 16 * 1024;
allocationData.hostPtr = reinterpret_cast<const void *>(0x10000000);
auto allocation0 = memoryManager->allocateGraphicsMemoryForNonSvmHostPtr(allocationData);
auto allocation0 = static_cast<DrmAllocation *>(memoryManager->allocateGraphicsMemoryForNonSvmHostPtr(allocationData));
allocationData.hostPtr = reinterpret_cast<const void *>(0x20000000);
auto allocation1 = memoryManager->allocateGraphicsMemoryForNonSvmHostPtr(allocationData);
@@ -2657,9 +2657,9 @@ TEST_F(DrmMemoryManagerBasic, givenDrmMemoryManagerWhenAllocateGraphicsMemoryFor
allocationData.size = 4 * MB + 12 * 1024;
allocationData.hostPtr = reinterpret_cast<const void *>(0x30000000);
allocation0 = memoryManager->allocateGraphicsMemoryForNonSvmHostPtr(allocationData);
allocation0 = static_cast<DrmAllocation *>(memoryManager->allocateGraphicsMemoryForNonSvmHostPtr(allocationData));
EXPECT_EQ((uint64_t)(allocation0->getBO()->peekSize()), 4 * MB + 12 * 1024);
EXPECT_EQ(static_cast<uint64_t>(allocation0->getBO()->peekSize()), 4 * MB + 12 * 1024);
memoryManager->freeGraphicsMemory(allocation0);
memoryManager->freeGraphicsMemory(allocation1);
@@ -2719,7 +2719,7 @@ TEST_F(DrmMemoryManagerWithExplicitExpectationsTest, givenForcePinNotAllowedAndH
allocationData.hostPtr = ::alignedMalloc(allocationData.size, 4096);
allocationData.flags.forcePin = true;
allocationData.rootDeviceIndex = device->getRootDeviceIndex();
auto alloc = memoryManager->allocateGraphicsMemoryWithHostPtr(allocationData);
auto alloc = static_cast<DrmAllocation *>(memoryManager->allocateGraphicsMemoryWithHostPtr(allocationData));
ASSERT_NE(nullptr, alloc);
EXPECT_NE(nullptr, alloc->getBO());
@@ -2745,7 +2745,7 @@ TEST_F(DrmMemoryManagerWithExplicitExpectationsTest, givenForcePinNotAllowedAndH
allocationData.hostPtr = ::alignedMalloc(allocationData.size, 4096);
allocationData.flags.forcePin = true;
allocationData.rootDeviceIndex = device->getRootDeviceIndex();
auto alloc = memoryManager->allocateGraphicsMemoryWithHostPtr(allocationData);
auto alloc = static_cast<DrmAllocation *>(memoryManager->allocateGraphicsMemoryWithHostPtr(allocationData));
ASSERT_NE(nullptr, alloc);
EXPECT_NE(nullptr, alloc->getBO());
@@ -3109,7 +3109,7 @@ TEST_F(DrmMemoryManagerTest, givenSvmCpuAllocationWhenSizeAndAlignmentProvidedTh
allocationData.type = AllocationType::SVM_CPU;
allocationData.rootDeviceIndex = rootDeviceIndex;
DrmAllocation *allocation = memoryManager->allocateGraphicsMemoryWithAlignment(allocationData);
auto allocation = static_cast<DrmAllocation *>(memoryManager->allocateGraphicsMemoryWithAlignment(allocationData));
ASSERT_NE(nullptr, allocation);
EXPECT_EQ(AllocationType::SVM_CPU, allocation->getAllocationType());
@@ -3151,7 +3151,7 @@ TEST_F(DrmMemoryManagerTest, givenSvmCpuAllocationWhenSizeAndAlignmentProvidedBu
allocationData.type = AllocationType::SVM_CPU;
allocationData.rootDeviceIndex = rootDeviceIndex;
DrmAllocation *allocation = memoryManager->allocateGraphicsMemoryWithAlignment(allocationData);
auto allocation = memoryManager->allocateGraphicsMemoryWithAlignment(allocationData);
EXPECT_EQ(nullptr, allocation);
}

View File

@@ -12,6 +12,8 @@
#include "shared/source/helpers/timestamp_packet.h"
#include "shared/source/os_interface/hw_info_config.h"
#include "shared/source/os_interface/linux/cache_info.h"
#include "shared/source/os_interface/linux/drm_allocation.h"
#include "shared/source/os_interface/linux/drm_buffer_object.h"
#include "shared/source/os_interface/linux/drm_memory_operations_handler_bind.h"
#include "shared/source/os_interface/linux/os_context_linux.h"
#include "shared/source/os_interface/os_interface.h"