mirror of
https://github.com/intel/compute-runtime.git
synced 2025-12-20 08:53:55 +08:00
Cleanup includes in drm_memory_manager.h
Signed-off-by: Mateusz Jablonski <mateusz.jablonski@intel.com>
This commit is contained in:
committed by
Compute-Runtime-Automation
parent
c94b6581c2
commit
db2d1a53b9
@@ -11,6 +11,7 @@
|
||||
#define _I915_DRM_H_
|
||||
#define _UAPI_I915_DRM_H_
|
||||
|
||||
#include "shared/source/gmm_helper/gmm_helper.h"
|
||||
#include "shared/source/os_interface/linux/drm_debug.h"
|
||||
#include "shared/source/os_interface/os_interface.h"
|
||||
#include "shared/test/common/helpers/debug_manager_state_restore.h"
|
||||
|
||||
@@ -6,6 +6,8 @@
|
||||
*/
|
||||
|
||||
#include "shared/source/memory_manager/unified_memory_manager.h"
|
||||
#include "shared/source/os_interface/linux/drm_allocation.h"
|
||||
#include "shared/source/os_interface/linux/drm_buffer_object.h"
|
||||
#include "shared/test/common/mocks/mock_allocation_properties.h"
|
||||
#include "shared/test/common/os_interface/linux/drm_memory_manager_prelim_fixtures.h"
|
||||
#include "shared/test/common/os_interface/linux/drm_mock_cache_info.h"
|
||||
|
||||
@@ -8,6 +8,7 @@
|
||||
#include "shared/source/command_stream/device_command_stream.h"
|
||||
#include "shared/source/execution_environment/execution_environment.h"
|
||||
#include "shared/source/helpers/aligned_memory.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_command_stream.h"
|
||||
#include "shared/source/os_interface/linux/drm_gem_close_worker.h"
|
||||
|
||||
@@ -11,6 +11,7 @@
|
||||
#include "shared/source/os_interface/linux/cache_info.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_neo.h"
|
||||
#include "shared/source/os_interface/linux/ioctl_helper.h"
|
||||
#include "shared/source/os_interface/os_context.h"
|
||||
|
||||
|
||||
@@ -26,7 +26,11 @@
|
||||
#include "shared/source/memory_manager/memory_pool.h"
|
||||
#include "shared/source/memory_manager/residency.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_gem_close_worker.h"
|
||||
#include "shared/source/os_interface/linux/drm_memory_operations_handler.h"
|
||||
#include "shared/source/os_interface/linux/drm_neo.h"
|
||||
#include "shared/source/os_interface/linux/drm_wrappers.h"
|
||||
#include "shared/source/os_interface/linux/os_context_linux.h"
|
||||
#include "shared/source/os_interface/os_interface.h"
|
||||
@@ -271,7 +275,7 @@ void DrmMemoryManager::emitPinningRequest(BufferObject *bo, const AllocationData
|
||||
}
|
||||
}
|
||||
|
||||
DrmAllocation *DrmMemoryManager::createGraphicsAllocation(OsHandleStorage &handleStorage, const AllocationData &allocationData) {
|
||||
GraphicsAllocation *DrmMemoryManager::createGraphicsAllocation(OsHandleStorage &handleStorage, const AllocationData &allocationData) {
|
||||
auto hostPtr = const_cast<void *>(allocationData.hostPtr);
|
||||
auto gmmHelper = getGmmHelper(allocationData.rootDeviceIndex);
|
||||
auto canonizedGpuAddress = gmmHelper->canonize(castToUint64(hostPtr));
|
||||
@@ -283,7 +287,7 @@ DrmAllocation *DrmMemoryManager::createGraphicsAllocation(OsHandleStorage &handl
|
||||
return allocation.release();
|
||||
}
|
||||
|
||||
DrmAllocation *DrmMemoryManager::allocateGraphicsMemoryWithAlignment(const AllocationData &allocationData) {
|
||||
GraphicsAllocation *DrmMemoryManager::allocateGraphicsMemoryWithAlignment(const AllocationData &allocationData) {
|
||||
if (allocationData.type == NEO::AllocationType::DEBUG_CONTEXT_SAVE_AREA ||
|
||||
(allocationData.type == NEO::AllocationType::DEBUG_SBA_TRACKING_BUFFER &&
|
||||
allocationData.storageInfo.subDeviceBitfield.count() > 1)) {
|
||||
@@ -370,7 +374,7 @@ void DrmMemoryManager::obtainGpuAddress(const AllocationData &allocationData, Bu
|
||||
}
|
||||
}
|
||||
|
||||
DrmAllocation *DrmMemoryManager::allocateUSMHostGraphicsMemory(const AllocationData &allocationData) {
|
||||
GraphicsAllocation *DrmMemoryManager::allocateUSMHostGraphicsMemory(const AllocationData &allocationData) {
|
||||
const size_t minAlignment = getUserptrAlignment();
|
||||
// When size == 0 allocate allocationAlignment
|
||||
// It's needed to prevent overlapping pages with user pointers
|
||||
@@ -412,7 +416,7 @@ DrmAllocation *DrmMemoryManager::allocateUSMHostGraphicsMemory(const AllocationD
|
||||
return allocation;
|
||||
}
|
||||
|
||||
DrmAllocation *DrmMemoryManager::allocateGraphicsMemoryWithHostPtr(const AllocationData &allocationData) {
|
||||
GraphicsAllocation *DrmMemoryManager::allocateGraphicsMemoryWithHostPtr(const AllocationData &allocationData) {
|
||||
auto res = static_cast<DrmAllocation *>(MemoryManager::allocateGraphicsMemoryWithHostPtr(allocationData));
|
||||
|
||||
if (res != nullptr && !validateHostPtrMemory) {
|
||||
@@ -459,7 +463,7 @@ GraphicsAllocation *DrmMemoryManager::allocateGraphicsMemoryWithGpuVa(const Allo
|
||||
return allocation;
|
||||
}
|
||||
|
||||
DrmAllocation *DrmMemoryManager::allocateGraphicsMemoryForNonSvmHostPtr(const AllocationData &allocationData) {
|
||||
GraphicsAllocation *DrmMemoryManager::allocateGraphicsMemoryForNonSvmHostPtr(const AllocationData &allocationData) {
|
||||
if (allocationData.size == 0 || !allocationData.hostPtr)
|
||||
return nullptr;
|
||||
|
||||
@@ -502,7 +506,7 @@ DrmAllocation *DrmMemoryManager::allocateGraphicsMemoryForNonSvmHostPtr(const Al
|
||||
return allocation;
|
||||
}
|
||||
|
||||
DrmAllocation *DrmMemoryManager::allocateGraphicsMemory64kb(const AllocationData &allocationData) {
|
||||
GraphicsAllocation *DrmMemoryManager::allocateGraphicsMemory64kb(const AllocationData &allocationData) {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
@@ -577,7 +581,7 @@ GraphicsAllocation *DrmMemoryManager::allocateGraphicsMemoryForImageImpl(const A
|
||||
return allocation;
|
||||
}
|
||||
|
||||
DrmAllocation *DrmMemoryManager::allocate32BitGraphicsMemoryImpl(const AllocationData &allocationData, bool useLocalMemory) {
|
||||
GraphicsAllocation *DrmMemoryManager::allocate32BitGraphicsMemoryImpl(const AllocationData &allocationData, bool useLocalMemory) {
|
||||
auto hwInfo = executionEnvironment.rootDeviceEnvironments[allocationData.rootDeviceIndex]->getHardwareInfo();
|
||||
auto allocatorToUse = heapAssigner.get32BitHeapIndex(allocationData.type, useLocalMemory, *hwInfo, allocationData.flags.use32BitFrontWindow);
|
||||
|
||||
@@ -1923,5 +1927,8 @@ DrmAllocation *DrmMemoryManager::createUSMHostAllocationFromSharedHandle(osHandl
|
||||
return new DrmAllocation(properties.rootDeviceIndex, properties.allocationType, bo, reinterpret_cast<void *>(bo->peekAddress()), bo->peekSize(),
|
||||
handle, MemoryPool::SystemCpuInaccessible, canonizedGpuAddress);
|
||||
}
|
||||
bool DrmMemoryManager::allowIndirectAllocationsAsPack(uint32_t rootDeviceIndex) {
|
||||
return this->getDrm(rootDeviceIndex).isVmBindAvailable();
|
||||
}
|
||||
|
||||
} // namespace NEO
|
||||
|
||||
@@ -7,19 +7,19 @@
|
||||
|
||||
#pragma once
|
||||
#include "shared/source/memory_manager/memory_manager.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_neo.h"
|
||||
|
||||
#include "drm_gem_close_worker.h"
|
||||
|
||||
#include <limits>
|
||||
#include <map>
|
||||
#include <sys/mman.h>
|
||||
#include <unistd.h>
|
||||
|
||||
namespace NEO {
|
||||
class BufferObject;
|
||||
class Drm;
|
||||
class DrmGemCloseWorker;
|
||||
class DrmAllocation;
|
||||
|
||||
enum class gemCloseWorkerMode;
|
||||
|
||||
class DrmMemoryManager : public MemoryManager {
|
||||
public:
|
||||
@@ -84,9 +84,7 @@ class DrmMemoryManager : public MemoryManager {
|
||||
DrmAllocation *createUSMHostAllocationFromSharedHandle(osHandle handle, const AllocationProperties &properties, bool hasMappedPtr);
|
||||
void releaseDeviceSpecificMemResources(uint32_t rootDeviceIndex) override;
|
||||
void createDeviceSpecificMemResources(uint32_t rootDeviceIndex) override;
|
||||
bool allowIndirectAllocationsAsPack(uint32_t rootDeviceIndex) override {
|
||||
return this->getDrm(rootDeviceIndex).isVmBindAvailable();
|
||||
}
|
||||
bool allowIndirectAllocationsAsPack(uint32_t rootDeviceIndex) override;
|
||||
|
||||
protected:
|
||||
MOCKABLE_VIRTUAL BufferObject *findAndReferenceSharedBufferObject(int boHandle, uint32_t rootDeviceIndex);
|
||||
@@ -100,17 +98,17 @@ class DrmMemoryManager : public MemoryManager {
|
||||
uint32_t getDefaultDrmContextId(uint32_t rootDeviceIndex) const;
|
||||
size_t getUserptrAlignment();
|
||||
|
||||
DrmAllocation *createGraphicsAllocation(OsHandleStorage &handleStorage, const AllocationData &allocationData) override;
|
||||
DrmAllocation *allocateGraphicsMemoryForNonSvmHostPtr(const AllocationData &allocationData) override;
|
||||
DrmAllocation *allocateGraphicsMemoryWithAlignment(const AllocationData &allocationData) override;
|
||||
GraphicsAllocation *createGraphicsAllocation(OsHandleStorage &handleStorage, const AllocationData &allocationData) override;
|
||||
GraphicsAllocation *allocateGraphicsMemoryForNonSvmHostPtr(const AllocationData &allocationData) override;
|
||||
GraphicsAllocation *allocateGraphicsMemoryWithAlignment(const AllocationData &allocationData) override;
|
||||
DrmAllocation *allocateGraphicsMemoryWithAlignmentImpl(const AllocationData &allocationData);
|
||||
DrmAllocation *createAllocWithAlignmentFromUserptr(const AllocationData &allocationData, size_t size, size_t alignment, size_t alignedSVMSize, uint64_t gpuAddress);
|
||||
DrmAllocation *createAllocWithAlignment(const AllocationData &allocationData, size_t size, size_t alignment, size_t alignedSize, uint64_t gpuAddress);
|
||||
DrmAllocation *createMultiHostAllocation(const AllocationData &allocationData);
|
||||
void obtainGpuAddress(const AllocationData &allocationData, BufferObject *bo, uint64_t gpuAddress);
|
||||
DrmAllocation *allocateUSMHostGraphicsMemory(const AllocationData &allocationData) override;
|
||||
DrmAllocation *allocateGraphicsMemoryWithHostPtr(const AllocationData &allocationData) override;
|
||||
DrmAllocation *allocateGraphicsMemory64kb(const AllocationData &allocationData) override;
|
||||
GraphicsAllocation *allocateUSMHostGraphicsMemory(const AllocationData &allocationData) override;
|
||||
GraphicsAllocation *allocateGraphicsMemoryWithHostPtr(const AllocationData &allocationData) override;
|
||||
GraphicsAllocation *allocateGraphicsMemory64kb(const AllocationData &allocationData) override;
|
||||
GraphicsAllocation *allocateMemoryByKMD(const AllocationData &allocationData) override;
|
||||
GraphicsAllocation *allocateGraphicsMemoryForImageImpl(const AllocationData &allocationData, std::unique_ptr<Gmm> gmm) override;
|
||||
GraphicsAllocation *allocateGraphicsMemoryWithGpuVa(const AllocationData &allocationData) override;
|
||||
@@ -120,7 +118,7 @@ class DrmMemoryManager : public MemoryManager {
|
||||
MOCKABLE_VIRTUAL void *lockBufferObject(BufferObject *bo);
|
||||
MOCKABLE_VIRTUAL void unlockBufferObject(BufferObject *bo);
|
||||
void unlockResourceImpl(GraphicsAllocation &graphicsAllocation) override;
|
||||
DrmAllocation *allocate32BitGraphicsMemoryImpl(const AllocationData &allocationData, bool useLocalMemory) override;
|
||||
GraphicsAllocation *allocate32BitGraphicsMemoryImpl(const AllocationData &allocationData, bool useLocalMemory) override;
|
||||
void cleanupBeforeReturn(const AllocationData &allocationData, GfxPartition *gfxPartition, DrmAllocation *drmAllocation, GraphicsAllocation *graphicsAllocation, uint64_t &gpuAddress, size_t &sizeAllocated);
|
||||
GraphicsAllocation *allocateGraphicsMemoryInDevicePool(const AllocationData &allocationData, AllocationStatus &status) override;
|
||||
bool createDrmAllocation(Drm *drm, DrmAllocation *allocation, uint64_t gpuAddress, size_t maxOsContextCount);
|
||||
|
||||
@@ -8,6 +8,8 @@
|
||||
#include "shared/source/gmm_helper/gmm.h"
|
||||
#include "shared/source/gmm_helper/gmm_helper.h"
|
||||
#include "shared/source/memory_manager/memory_pool.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"
|
||||
|
||||
namespace NEO {
|
||||
|
||||
@@ -20,6 +20,7 @@
|
||||
#include "shared/source/helpers/ptr_math.h"
|
||||
#include "shared/source/os_interface/driver_info.h"
|
||||
#include "shared/source/os_interface/linux/cache_info.h"
|
||||
#include "shared/source/os_interface/linux/drm_buffer_object.h"
|
||||
#include "shared/source/os_interface/linux/drm_engine_mapper.h"
|
||||
#include "shared/source/os_interface/linux/drm_gem_close_worker.h"
|
||||
#include "shared/source/os_interface/linux/drm_memory_manager.h"
|
||||
|
||||
@@ -5,6 +5,7 @@
|
||||
*
|
||||
*/
|
||||
|
||||
#include "shared/source/os_interface/linux/drm_buffer_object.h"
|
||||
#include "shared/test/common/fixtures/memory_allocator_multi_device_fixture.h"
|
||||
#include "shared/test/common/mocks/linux/mock_drm_memory_manager.h"
|
||||
|
||||
|
||||
@@ -8,6 +8,8 @@
|
||||
#include "shared/test/common/mocks/linux/mock_drm_memory_manager.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/test/common/mocks/mock_allocation_properties.h"
|
||||
#include "shared/test/common/mocks/mock_host_ptr_manager.h"
|
||||
@@ -56,6 +58,15 @@ TestedDrmMemoryManager::TestedDrmMemoryManager(bool enableLocalMemory,
|
||||
this->executionEnvironment = &executionEnvironment;
|
||||
}
|
||||
|
||||
BufferObject *TestedDrmMemoryManager::findAndReferenceSharedBufferObject(int boHandle, uint32_t rootDeviceIndex) {
|
||||
if (failOnfindAndReferenceSharedBufferObject) {
|
||||
DrmMockCustom drmMock(*executionEnvironment->rootDeviceEnvironments[rootDeviceIndex]);
|
||||
auto patIndex = drmMock.getPatIndex(nullptr, AllocationType::BUFFER, CacheRegion::Default, CachePolicy::WriteBack, false);
|
||||
return new (std::nothrow) BufferObject(&drmMock, patIndex, boHandle, 4096u, 2u);
|
||||
}
|
||||
return MemoryManagerCreate<DrmMemoryManager>::findAndReferenceSharedBufferObject(boHandle, rootDeviceIndex);
|
||||
}
|
||||
|
||||
void TestedDrmMemoryManager::injectPinBB(BufferObject *newPinBB, uint32_t rootDeviceIndex) {
|
||||
BufferObject *currentPinBB = pinBBs[rootDeviceIndex];
|
||||
pinBBs[rootDeviceIndex] = nullptr;
|
||||
@@ -77,7 +88,7 @@ DrmAllocation *TestedDrmMemoryManager::allocate32BitGraphicsMemory(uint32_t root
|
||||
MockAllocationProperties properties(rootDeviceIndex, allocateMemory, size, allocationType);
|
||||
getAllocationData(allocationData, properties, ptr, createStorageInfoFromProperties(properties));
|
||||
bool useLocalMemory = !allocationData.flags.useSystemMemory && this->localMemorySupported[rootDeviceIndex];
|
||||
return allocate32BitGraphicsMemoryImpl(allocationData, useLocalMemory);
|
||||
return static_cast<DrmAllocation *>(allocate32BitGraphicsMemoryImpl(allocationData, useLocalMemory));
|
||||
}
|
||||
|
||||
void TestedDrmMemoryManager::closeSharedHandle(GraphicsAllocation *gfxAllocation) {
|
||||
|
||||
@@ -6,6 +6,7 @@
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
#include "shared/source/os_interface/linux/drm_gem_close_worker.h"
|
||||
#include "shared/source/os_interface/linux/drm_memory_manager.h"
|
||||
#include "shared/test/common/mocks/mock_memory_manager.h"
|
||||
#include "shared/test/common/os_interface/linux/device_command_stream_fixture.h"
|
||||
@@ -114,14 +115,7 @@ class TestedDrmMemoryManager : public MemoryManagerCreate<DrmMemoryManager> {
|
||||
void forceLimitedRangeAllocator(uint64_t range);
|
||||
void overrideGfxPartition(GfxPartition *newGfxPartition);
|
||||
|
||||
BufferObject *findAndReferenceSharedBufferObject(int boHandle, uint32_t rootDeviceIndex) override {
|
||||
if (failOnfindAndReferenceSharedBufferObject) {
|
||||
DrmMockCustom drmMock(*executionEnvironment->rootDeviceEnvironments[rootDeviceIndex]);
|
||||
auto patIndex = drmMock.getPatIndex(nullptr, AllocationType::BUFFER, CacheRegion::Default, CachePolicy::WriteBack, false);
|
||||
return new (std::nothrow) BufferObject(&drmMock, patIndex, boHandle, 4096u, 2u);
|
||||
}
|
||||
return MemoryManagerCreate<DrmMemoryManager>::findAndReferenceSharedBufferObject(boHandle, rootDeviceIndex);
|
||||
}
|
||||
BufferObject *findAndReferenceSharedBufferObject(int boHandle, uint32_t rootDeviceIndex) override;
|
||||
|
||||
DrmAllocation *allocate32BitGraphicsMemory(uint32_t rootDeviceIndex, size_t size, const void *ptr, AllocationType allocationType);
|
||||
~TestedDrmMemoryManager() override;
|
||||
|
||||
@@ -7,6 +7,8 @@
|
||||
|
||||
#pragma once
|
||||
#include "shared/source/command_stream/preemption.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/source/os_interface/linux/os_context_linux.h"
|
||||
#include "shared/test/common/helpers/debug_manager_state_restore.h"
|
||||
|
||||
@@ -9,6 +9,7 @@
|
||||
#include "shared/source/direct_submission/dispatchers/blitter_dispatcher.h"
|
||||
#include "shared/source/direct_submission/dispatchers/render_dispatcher.h"
|
||||
#include "shared/source/direct_submission/linux/drm_direct_submission.h"
|
||||
#include "shared/source/os_interface/linux/drm_gem_close_worker.h"
|
||||
#include "shared/source/os_interface/linux/os_context_linux.h"
|
||||
#include "shared/test/common/cmd_parse/hw_parse.h"
|
||||
#include "shared/test/common/helpers/debug_manager_state_restore.h"
|
||||
|
||||
@@ -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"
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
|
||||
@@ -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"
|
||||
|
||||
Reference in New Issue
Block a user