mirror of
https://github.com/intel/compute-runtime.git
synced 2026-01-22 19:29:06 +08:00
refactor: reduce the number of DrmAllocation constructors
Signed-off-by: Jaroslaw Warchulski <jaroslaw.warchulski@intel.com>
This commit is contained in:
committed by
Compute-Runtime-Automation
parent
4f52fd504a
commit
ca70bb99b2
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (C) 2022-2023 Intel Corporation
|
||||
* Copyright (C) 2022-2024 Intel Corporation
|
||||
*
|
||||
* SPDX-License-Identifier: MIT
|
||||
*
|
||||
@@ -272,7 +272,7 @@ HWTEST_TEMPLATED_F(DrmCommandStreamEnhancedTest, givenDrmCsrCreatedWithInactiveG
|
||||
|
||||
HWTEST_TEMPLATED_F(DrmCommandStreamEnhancedTest, givenDrmAllocationWhenGetBufferObjectToModifyIsCalledForAGivenHandleIdThenTheCorrespondingBufferObjectGetsModified) {
|
||||
auto size = 1024u;
|
||||
auto allocation = new DrmAllocation(0, AllocationType::unknown, nullptr, nullptr, size, static_cast<osHandle>(0u), MemoryPool::memoryNull);
|
||||
auto allocation = new DrmAllocation(0, 1u /*num gmms*/, AllocationType::unknown, nullptr, nullptr, size, static_cast<osHandle>(0u), MemoryPool::memoryNull);
|
||||
|
||||
auto &bos = allocation->getBOs();
|
||||
for (auto handleId = 0u; handleId < EngineLimits::maxHandleCount; handleId++) {
|
||||
@@ -292,7 +292,7 @@ HWTEST_TEMPLATED_F(DrmCommandStreamEnhancedTest, givenDrmAllocationWhenGetBuffer
|
||||
|
||||
HWTEST_TEMPLATED_F(DrmCommandStreamEnhancedTest, WhenMakingResidentThenSucceeds) {
|
||||
auto buffer = this->createBO(1024);
|
||||
auto allocation = new DrmAllocation(0, AllocationType::unknown, buffer, nullptr, buffer->peekSize(), static_cast<osHandle>(0u), MemoryPool::memoryNull);
|
||||
auto allocation = new DrmAllocation(0, 1u /*num gmms*/, AllocationType::unknown, buffer, nullptr, buffer->peekSize(), static_cast<osHandle>(0u), MemoryPool::memoryNull);
|
||||
EXPECT_EQ(nullptr, allocation->getUnderlyingBuffer());
|
||||
|
||||
csr->makeResident(*allocation);
|
||||
@@ -310,8 +310,8 @@ HWTEST_TEMPLATED_F(DrmCommandStreamEnhancedTest, WhenMakingResidentThenSucceeds)
|
||||
HWTEST_TEMPLATED_F(DrmCommandStreamEnhancedTest, GivenMultipleAllocationsWhenMakingResidentThenEachSucceeds) {
|
||||
BufferObject *buffer1 = this->createBO(4096);
|
||||
BufferObject *buffer2 = this->createBO(4096);
|
||||
auto allocation1 = new DrmAllocation(0, AllocationType::unknown, buffer1, nullptr, buffer1->peekSize(), static_cast<osHandle>(0u), MemoryPool::memoryNull);
|
||||
auto allocation2 = new DrmAllocation(0, AllocationType::unknown, buffer2, nullptr, buffer2->peekSize(), static_cast<osHandle>(0u), MemoryPool::memoryNull);
|
||||
auto allocation1 = new DrmAllocation(0, 1u /*num gmms*/, AllocationType::unknown, buffer1, nullptr, buffer1->peekSize(), static_cast<osHandle>(0u), MemoryPool::memoryNull);
|
||||
auto allocation2 = new DrmAllocation(0, 1u /*num gmms*/, AllocationType::unknown, buffer2, nullptr, buffer2->peekSize(), static_cast<osHandle>(0u), MemoryPool::memoryNull);
|
||||
EXPECT_EQ(nullptr, allocation1->getUnderlyingBuffer());
|
||||
EXPECT_EQ(nullptr, allocation2->getUnderlyingBuffer());
|
||||
|
||||
@@ -334,7 +334,7 @@ HWTEST_TEMPLATED_F(DrmCommandStreamEnhancedTest, GivenMultipleAllocationsWhenMak
|
||||
|
||||
HWTEST_TEMPLATED_F(DrmCommandStreamEnhancedTest, WhenMakingResidentTwiceThenRefCountIsOne) {
|
||||
auto buffer = this->createBO(1024);
|
||||
auto allocation = new DrmAllocation(0, AllocationType::unknown, buffer, nullptr, buffer->peekSize(), static_cast<osHandle>(0u), MemoryPool::memoryNull);
|
||||
auto allocation = new DrmAllocation(0, 1u /*num gmms*/, AllocationType::unknown, buffer, nullptr, buffer->peekSize(), static_cast<osHandle>(0u), MemoryPool::memoryNull);
|
||||
|
||||
csr->makeResident(*allocation);
|
||||
csr->processResidency(csr->getResidencyAllocations(), 0u);
|
||||
@@ -831,7 +831,7 @@ HWTEST_TEMPLATED_F(DrmCommandStreamEnhancedTest, givenDrmCommandStreamReceiverWh
|
||||
|
||||
struct MockDrmAllocationBindBO : public DrmAllocation {
|
||||
MockDrmAllocationBindBO(uint32_t rootDeviceIndex, AllocationType allocationType, BufferObjects &bos, void *ptrIn, uint64_t gpuAddress, size_t sizeIn, MemoryPool pool)
|
||||
: DrmAllocation(rootDeviceIndex, allocationType, bos, ptrIn, gpuAddress, sizeIn, pool) {
|
||||
: DrmAllocation(rootDeviceIndex, 1u /*num gmms*/, allocationType, bos, ptrIn, gpuAddress, sizeIn, pool) {
|
||||
}
|
||||
|
||||
ADDMETHOD_NOBASE(bindBO, int, 0,
|
||||
@@ -840,7 +840,7 @@ struct MockDrmAllocationBindBO : public DrmAllocation {
|
||||
|
||||
struct MockDrmAllocationBindBOs : public DrmAllocation {
|
||||
MockDrmAllocationBindBOs(uint32_t rootDeviceIndex, AllocationType allocationType, BufferObjects &bos, void *ptrIn, uint64_t gpuAddress, size_t sizeIn, MemoryPool pool)
|
||||
: DrmAllocation(rootDeviceIndex, allocationType, bos, ptrIn, gpuAddress, sizeIn, pool) {
|
||||
: DrmAllocation(rootDeviceIndex, 1u /*num gmms*/, allocationType, bos, ptrIn, gpuAddress, sizeIn, pool) {
|
||||
}
|
||||
|
||||
ADDMETHOD_NOBASE(bindBOs, int, 0,
|
||||
@@ -950,7 +950,7 @@ HWTEST_TEMPLATED_F(DrmCommandStreamEnhancedTest, givenAllocationWithSingleBuffer
|
||||
auto size = 1024u;
|
||||
auto bo = this->createBO(size);
|
||||
BufferObjects bos{bo};
|
||||
auto allocation = new DrmAllocation(0, AllocationType::unknown, bos, nullptr, 0u, size, MemoryPool::localMemory);
|
||||
auto allocation = new DrmAllocation(0, 1u /*num gmms*/, AllocationType::unknown, bos, nullptr, 0u, size, MemoryPool::localMemory);
|
||||
EXPECT_EQ(bo, allocation->getBO());
|
||||
|
||||
makeResidentBufferObjects<FamilyType>(&csr->getOsContext(), allocation);
|
||||
|
||||
@@ -125,7 +125,7 @@ HWTEST_TEMPLATED_F(DrmCommandStreamTest, givenDebugFlagSetWhenSubmittingThenCall
|
||||
}
|
||||
|
||||
HWTEST_TEMPLATED_F(DrmCommandStreamTest, WhenMakingResidentThenSucceeds) {
|
||||
DrmAllocation graphicsAllocation(0, AllocationType::unknown, nullptr, nullptr, 1024, static_cast<osHandle>(1u), MemoryPool::memoryNull);
|
||||
DrmAllocation graphicsAllocation(0, 1u /*num gmms*/, AllocationType::unknown, nullptr, nullptr, 1024, static_cast<osHandle>(1u), MemoryPool::memoryNull);
|
||||
csr->makeResident(graphicsAllocation);
|
||||
|
||||
EXPECT_EQ(0, mock->ioctlCount.gemUserptr);
|
||||
@@ -137,7 +137,7 @@ HWTEST_TEMPLATED_F(DrmCommandStreamTest, WhenMakingResidentThenSucceeds) {
|
||||
}
|
||||
|
||||
HWTEST_TEMPLATED_F(DrmCommandStreamTest, WhenMakingResidentTwiceThenSucceeds) {
|
||||
DrmAllocation graphicsAllocation(0, AllocationType::unknown, nullptr, nullptr, 1024, static_cast<osHandle>(1u), MemoryPool::memoryNull);
|
||||
DrmAllocation graphicsAllocation(0, 1u /*num gmms*/, AllocationType::unknown, nullptr, nullptr, 1024, static_cast<osHandle>(1u), MemoryPool::memoryNull);
|
||||
|
||||
csr->makeResident(graphicsAllocation);
|
||||
csr->makeResident(graphicsAllocation);
|
||||
@@ -151,7 +151,7 @@ HWTEST_TEMPLATED_F(DrmCommandStreamTest, WhenMakingResidentTwiceThenSucceeds) {
|
||||
}
|
||||
|
||||
HWTEST_TEMPLATED_F(DrmCommandStreamTest, GivenSizeZeroWhenMakingResidentTwiceThenSucceeds) {
|
||||
DrmAllocation graphicsAllocation(0, AllocationType::unknown, nullptr, nullptr, 0, static_cast<osHandle>(1u), MemoryPool::memoryNull);
|
||||
DrmAllocation graphicsAllocation(0, 1u /*num gmms*/, AllocationType::unknown, nullptr, nullptr, 0, static_cast<osHandle>(1u), MemoryPool::memoryNull);
|
||||
|
||||
csr->makeResident(graphicsAllocation);
|
||||
|
||||
@@ -164,8 +164,8 @@ HWTEST_TEMPLATED_F(DrmCommandStreamTest, GivenSizeZeroWhenMakingResidentTwiceThe
|
||||
}
|
||||
|
||||
HWTEST_TEMPLATED_F(DrmCommandStreamTest, GivenResizedWhenMakingResidentTwiceThenSucceeds) {
|
||||
DrmAllocation graphicsAllocation(0, AllocationType::unknown, nullptr, nullptr, 1024, static_cast<osHandle>(1u), MemoryPool::memoryNull);
|
||||
DrmAllocation graphicsAllocation2(0, AllocationType::unknown, nullptr, nullptr, 8192, static_cast<osHandle>(1u), MemoryPool::memoryNull);
|
||||
DrmAllocation graphicsAllocation(0, 1u /*num gmms*/, AllocationType::unknown, nullptr, nullptr, 1024, static_cast<osHandle>(1u), MemoryPool::memoryNull);
|
||||
DrmAllocation graphicsAllocation2(0, 1u /*num gmms*/, AllocationType::unknown, nullptr, nullptr, 8192, static_cast<osHandle>(1u), MemoryPool::memoryNull);
|
||||
|
||||
csr->makeResident(graphicsAllocation);
|
||||
csr->makeResident(graphicsAllocation2);
|
||||
@@ -302,7 +302,7 @@ HWTEST_TEMPLATED_F(DrmCommandStreamTest, GivenInvalidAddressWhenFlushingThenSucc
|
||||
ASSERT_NE(nullptr, commandBuffer); // NOLINT(clang-analyzer-cplusplus.NewDeleteLeaks)
|
||||
|
||||
auto canonizedGpuAddress = gmmHelper->canonize(castToUint64(commandBuffer));
|
||||
DrmAllocation commandBufferAllocation(0, AllocationType::commandBuffer, nullptr, commandBuffer, 1024, static_cast<osHandle>(1u), MemoryPool::memoryNull, canonizedGpuAddress);
|
||||
DrmAllocation commandBufferAllocation(0, 1u /*num gmms*/, AllocationType::commandBuffer, nullptr, commandBuffer, 1024, static_cast<osHandle>(1u), MemoryPool::memoryNull, canonizedGpuAddress);
|
||||
LinearStream cs(&commandBufferAllocation);
|
||||
|
||||
CommandStreamReceiverHw<FamilyType>::addBatchBufferEnd(cs, nullptr);
|
||||
@@ -395,8 +395,8 @@ HWTEST_TEMPLATED_F(DrmCommandStreamTest, GivenNotAlignedWhenFlushingThenSucceeds
|
||||
HWTEST_TEMPLATED_F(DrmCommandStreamTest, GivenCheckFlagsWhenFlushingThenSucceeds) {
|
||||
auto &cs = csr->getCS();
|
||||
|
||||
DrmAllocation allocation(0, AllocationType::unknown, nullptr, (void *)0x7FFFFFFF, 1024, static_cast<osHandle>(0u), MemoryPool::memoryNull);
|
||||
DrmAllocation allocation2(0, AllocationType::unknown, nullptr, (void *)0x307FFFFFFF, 1024, static_cast<osHandle>(0u), MemoryPool::memoryNull);
|
||||
DrmAllocation allocation(0, 1u /*num gmms*/, AllocationType::unknown, nullptr, (void *)0x7FFFFFFF, 1024, static_cast<osHandle>(0u), MemoryPool::memoryNull);
|
||||
DrmAllocation allocation2(0, 1u /*num gmms*/, AllocationType::unknown, nullptr, (void *)0x307FFFFFFF, 1024, static_cast<osHandle>(0u), MemoryPool::memoryNull);
|
||||
csr->makeResident(allocation);
|
||||
csr->makeResident(allocation2);
|
||||
CommandStreamReceiverHw<FamilyType>::addBatchBufferEnd(cs, nullptr);
|
||||
@@ -420,7 +420,7 @@ HWTEST_TEMPLATED_F(DrmCommandStreamTest, GivenCheckDrmFreeWhenFlushingThenSuccee
|
||||
auto expectedBatchStartOffset = (reinterpret_cast<uintptr_t>(commandBuffer->getUnderlyingBuffer()) + 4) & (this->alignment - 1);
|
||||
auto expectedSize = alignUp(8u, MemoryConstants::cacheLineSize); // bbEnd
|
||||
|
||||
DrmAllocation allocation(0, AllocationType::unknown, nullptr, nullptr, 1024, static_cast<osHandle>(0u), MemoryPool::memoryNull);
|
||||
DrmAllocation allocation(0, 1u /*num gmms*/, AllocationType::unknown, nullptr, nullptr, 1024, static_cast<osHandle>(0u), MemoryPool::memoryNull);
|
||||
|
||||
csr->makeResident(allocation);
|
||||
CommandStreamReceiverHw<FamilyType>::addBatchBufferEnd(cs, nullptr);
|
||||
@@ -463,7 +463,7 @@ HWTEST_TEMPLATED_F(DrmCommandStreamTest, GivenCheckDrmFreeCloseFailedWhenFlushin
|
||||
|
||||
mock->storedRetValForGemClose = -1;
|
||||
|
||||
DrmAllocation allocation(0, AllocationType::unknown, nullptr, nullptr, 1024, static_cast<osHandle>(0u), MemoryPool::memoryNull);
|
||||
DrmAllocation allocation(0, 1u /*num gmms*/, AllocationType::unknown, nullptr, nullptr, 1024, static_cast<osHandle>(0u), MemoryPool::memoryNull);
|
||||
|
||||
csr->makeResident(allocation);
|
||||
CommandStreamReceiverHw<FamilyType>::addBatchBufferEnd(cs, nullptr);
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (C) 2022-2023 Intel Corporation
|
||||
* Copyright (C) 2022-2024 Intel Corporation
|
||||
*
|
||||
* SPDX-License-Identifier: MIT
|
||||
*
|
||||
@@ -32,7 +32,7 @@ HWTEST_TEMPLATED_F(DrmCommandStreamEnhancedTest, givenAllocationWithMultipleBuff
|
||||
auto bo2 = this->createBO(size);
|
||||
auto bo3 = this->createBO(size);
|
||||
BufferObjects bos{bo0, bo1, bo2, bo3};
|
||||
auto allocation = new DrmAllocation(0, AllocationType::unknown, bos, nullptr, 0u, size, MemoryPool::localMemory);
|
||||
auto allocation = new DrmAllocation(0, 1u /*num gmms*/, AllocationType::unknown, bos, nullptr, 0u, size, MemoryPool::localMemory);
|
||||
allocation->storageInfo.memoryBanks = maxNBitValue(MemoryBanks::getBankForLocalMemory(3));
|
||||
|
||||
csr->CommandStreamReceiver::makeResident(*allocation);
|
||||
@@ -258,7 +258,7 @@ HWTEST_TEMPLATED_F(DrmCommandStreamEnhancedTest, givenAllocationWithMultipleBuff
|
||||
auto bo2 = this->createBO(size);
|
||||
auto bo3 = this->createBO(size);
|
||||
BufferObjects bos{bo0, bo1, bo2, bo3};
|
||||
auto allocation = new DrmAllocation(0, AllocationType::unknown, bos, nullptr, 0u, size, MemoryPool::localMemory);
|
||||
auto allocation = new DrmAllocation(0, 1u /*num gmms*/, AllocationType::unknown, bos, nullptr, 0u, size, MemoryPool::localMemory);
|
||||
allocation->storageInfo.memoryBanks = maxNBitValue(MemoryBanks::getBankForLocalMemory(3));
|
||||
allocation->storageInfo.tileInstanced = true;
|
||||
|
||||
@@ -466,14 +466,14 @@ HWCMDTEST_F(IGFX_XE_HP_CORE, DrmImplicitScalingCommandStreamTest, givenTwoTilesW
|
||||
auto multiStorageBo0 = new BufferObject(0u, drm, 3, 30, 0, 1);
|
||||
auto multiStorageBo1 = new BufferObject(0u, drm, 3, 31, 0, 1);
|
||||
BufferObjects multiStorageBos{multiStorageBo0, multiStorageBo1};
|
||||
auto multiStorageAllocation = new DrmAllocation(0, AllocationType::unknown, multiStorageBos, nullptr, 0u, size, MemoryPool::localMemory);
|
||||
auto multiStorageAllocation = new DrmAllocation(0, 1u /*num gmms*/, AllocationType::unknown, multiStorageBos, nullptr, 0u, size, MemoryPool::localMemory);
|
||||
multiStorageAllocation->storageInfo.memoryBanks = 0b11;
|
||||
csr->CommandStreamReceiver::makeResident(*multiStorageAllocation);
|
||||
|
||||
auto tileInstancedBo0 = new BufferObject(0u, drm, 3, 40, 0, 1);
|
||||
auto tileInstancedBo1 = new BufferObject(0u, drm, 3, 41, 0, 1);
|
||||
BufferObjects tileInstancedBos{tileInstancedBo0, tileInstancedBo1};
|
||||
auto tileInstancedAllocation = new DrmAllocation(0, AllocationType::unknown, tileInstancedBos, nullptr, 0u, size, MemoryPool::localMemory);
|
||||
auto tileInstancedAllocation = new DrmAllocation(0, 1u /*num gmms*/, AllocationType::unknown, tileInstancedBos, nullptr, 0u, size, MemoryPool::localMemory);
|
||||
tileInstancedAllocation->storageInfo.memoryBanks = 0b11;
|
||||
tileInstancedAllocation->storageInfo.tileInstanced = true;
|
||||
csr->CommandStreamReceiver::makeResident(*tileInstancedAllocation);
|
||||
@@ -540,7 +540,7 @@ HWCMDTEST_F(IGFX_XE_HP_CORE, DrmImplicitScalingCommandStreamTest, whenForceExecu
|
||||
auto tileInstancedBo2 = new BufferObject(0u, drm, 3, 42, 0, 1);
|
||||
auto tileInstancedBo3 = new BufferObject(0u, drm, 3, 43, 0, 1);
|
||||
BufferObjects tileInstancedBos{tileInstancedBo0, tileInstancedBo1, tileInstancedBo2, tileInstancedBo3};
|
||||
auto tileInstancedAllocation = new DrmAllocation(0, AllocationType::unknown, tileInstancedBos, nullptr, 0u, 1024u, MemoryPool::localMemory);
|
||||
auto tileInstancedAllocation = new DrmAllocation(0, 1u /*num gmms*/, AllocationType::unknown, tileInstancedBos, nullptr, 0u, 1024u, MemoryPool::localMemory);
|
||||
tileInstancedAllocation->storageInfo.memoryBanks = 0b11;
|
||||
tileInstancedAllocation->storageInfo.tileInstanced = true;
|
||||
csr->CommandStreamReceiver::makeResident(*tileInstancedAllocation);
|
||||
@@ -583,7 +583,7 @@ HWCMDTEST_F(IGFX_XE_HP_CORE, DrmImplicitScalingCommandStreamTest, whenForceExecu
|
||||
auto tileInstancedBo2 = new BufferObject(0u, drm, 3, 42, 0, 1);
|
||||
auto tileInstancedBo3 = new BufferObject(0u, drm, 3, 43, 0, 1);
|
||||
BufferObjects tileInstancedBos{tileInstancedBo0, tileInstancedBo1, tileInstancedBo2, tileInstancedBo3};
|
||||
auto tileInstancedAllocation = new DrmAllocation(0, AllocationType::unknown, tileInstancedBos, nullptr, 0u, 1024u, MemoryPool::localMemory);
|
||||
auto tileInstancedAllocation = new DrmAllocation(0, 1u /*num gmms*/, AllocationType::unknown, tileInstancedBos, nullptr, 0u, 1024u, MemoryPool::localMemory);
|
||||
tileInstancedAllocation->storageInfo.memoryBanks = 0b11;
|
||||
tileInstancedAllocation->storageInfo.tileInstanced = true;
|
||||
csr->CommandStreamReceiver::makeResident(*tileInstancedAllocation);
|
||||
@@ -629,7 +629,7 @@ HWCMDTEST_F(IGFX_XE_HP_CORE, DrmImplicitScalingCommandStreamTest, givenDisabledI
|
||||
const auto size = 1024u;
|
||||
BufferObject *bufferObject = new BufferObject(0u, drm, 3, 30, 0, 1);
|
||||
BufferObjects bufferObjects{bufferObject};
|
||||
auto allocation = new DrmAllocation(0, AllocationType::unknown, bufferObjects, nullptr, 0u, size, MemoryPool::localMemory);
|
||||
auto allocation = new DrmAllocation(0, 1u /*num gmms*/, AllocationType::unknown, bufferObjects, nullptr, 0u, size, MemoryPool::localMemory);
|
||||
csr->CommandStreamReceiver::makeResident(*allocation);
|
||||
|
||||
auto &cs = csr->getCS();
|
||||
@@ -663,7 +663,7 @@ HWCMDTEST_F(IGFX_XE_HP_CORE, DrmImplicitScalingCommandStreamTest, givenMultiTile
|
||||
const auto size = 1024u;
|
||||
BufferObject *bufferObject = new BufferObject(0u, drm, 3, 30, 0, 1);
|
||||
BufferObjects bufferObjects{bufferObject};
|
||||
auto allocation = new DrmAllocation(0, AllocationType::unknown, bufferObjects, nullptr, 0u, size, MemoryPool::localMemory);
|
||||
auto allocation = new DrmAllocation(0, 1u /*num gmms*/, AllocationType::unknown, bufferObjects, nullptr, 0u, size, MemoryPool::localMemory);
|
||||
csr->CommandStreamReceiver::makeResident(*allocation);
|
||||
|
||||
auto &cs = csr->getCS();
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (C) 2018-2023 Intel Corporation
|
||||
* Copyright (C) 2018-2024 Intel Corporation
|
||||
*
|
||||
* SPDX-License-Identifier: MIT
|
||||
*
|
||||
@@ -90,7 +90,7 @@ class DrmGemCloseWorkerFixture {
|
||||
class DrmAllocationWrapper : public DrmAllocation {
|
||||
public:
|
||||
DrmAllocationWrapper(BufferObject *bo)
|
||||
: DrmAllocation(0, AllocationType::unknown, bo, nullptr, 0, static_cast<osHandle>(0u), MemoryPool::memoryNull) {
|
||||
: DrmAllocation(0, 1u /*num gmms*/, AllocationType::unknown, bo, nullptr, 0, static_cast<osHandle>(0u), MemoryPool::memoryNull) {
|
||||
}
|
||||
};
|
||||
MockExecutionEnvironment executionEnvironment;
|
||||
|
||||
@@ -31,7 +31,7 @@
|
||||
TEST_F(DrmMemoryManagerLocalMemoryWithCustomPrelimMockTest, givenDrmMemoryManagerWithLocalMemoryWhenLockResourceIsCalledOnBufferObjectThenReturnPtr) {
|
||||
BufferObject bo(0, mock, 3, 1, 1024, 1);
|
||||
|
||||
DrmAllocation drmAllocation(0, AllocationType::unknown, &bo, nullptr, 0u, 0u, MemoryPool::localMemory);
|
||||
DrmAllocation drmAllocation(0, 1u /*num gmms*/, AllocationType::unknown, &bo, nullptr, 0u, 0u, MemoryPool::localMemory);
|
||||
EXPECT_EQ(&bo, drmAllocation.getBO());
|
||||
|
||||
auto ptr = memoryManager->lockBufferObject(&bo);
|
||||
@@ -2599,7 +2599,7 @@ TEST_F(DrmMemoryManagerTestPrelim, givenDrmMemoryManagerWhenLockUnlockIsCalledOn
|
||||
mock->ioctlResExt = &ioctlResExt;
|
||||
|
||||
BufferObject bo(0, mock, 3, 1, 0, 1);
|
||||
DrmAllocation drmAllocation(0, AllocationType::unknown, &bo, nullptr, 0u, 0u, MemoryPool::localMemory);
|
||||
DrmAllocation drmAllocation(0, 1u /*num gmms*/, AllocationType::unknown, &bo, nullptr, 0u, 0u, MemoryPool::localMemory);
|
||||
EXPECT_NE(nullptr, drmAllocation.getBO());
|
||||
|
||||
auto ptr = memoryManager->lockResource(&drmAllocation);
|
||||
@@ -2614,7 +2614,7 @@ TEST_F(DrmMemoryManagerTestPrelim, givenDrmMemoryManagerWhenLockUnlockIsCalledOn
|
||||
mock->failOnMmapOffset = true;
|
||||
|
||||
BufferObject bo(0, mock, 3, 1, 0, 1);
|
||||
DrmAllocation drmAllocation(0, AllocationType::unknown, &bo, nullptr, 0u, 0u, MemoryPool::localMemory);
|
||||
DrmAllocation drmAllocation(0, 1u /*num gmms*/, AllocationType::unknown, &bo, nullptr, 0u, 0u, MemoryPool::localMemory);
|
||||
EXPECT_NE(nullptr, drmAllocation.getBO());
|
||||
|
||||
auto ptr = memoryManager->lockResource(&drmAllocation);
|
||||
@@ -2838,7 +2838,7 @@ TEST_F(DrmMemoryManagerTestPrelim, MmapFailWhenUSMHostAllocationFromSharedHandle
|
||||
}
|
||||
|
||||
TEST_F(DrmMemoryManagerTestPrelim, givenDrmMemoryManagerWhenLockUnlockIsCalledOnAllocationInLocalMemoryButBufferObjectIsNullThenReturnNullPtr) {
|
||||
DrmAllocation drmAllocation(0, AllocationType::unknown, nullptr, nullptr, 0u, 0u, MemoryPool::localMemory);
|
||||
DrmAllocation drmAllocation(0, 1u /*num gmms*/, AllocationType::unknown, nullptr, nullptr, 0u, 0u, MemoryPool::localMemory);
|
||||
|
||||
auto ptr = memoryManager->lockResource(&drmAllocation);
|
||||
EXPECT_EQ(nullptr, ptr);
|
||||
@@ -2995,7 +2995,7 @@ TEST(AllocationInfoLogging, givenDrmGraphicsAllocationWithMultipleBOsWhenGetting
|
||||
BufferObject bo0(0, &drm, 3, 0, 0, 1), bo1(0, &drm, 3, 1, 0, 1),
|
||||
bo2(0, &drm, 3, 2, 0, 1), bo3(0, &drm, 3, 3, 0, 1);
|
||||
BufferObjects bos{&bo0, &bo1, &bo2, &bo3};
|
||||
DrmAllocation drmAllocation(0, AllocationType::unknown, bos, nullptr, 0u, 0u, MemoryPool::localMemory);
|
||||
DrmAllocation drmAllocation(0, 1u /*num gmms*/, AllocationType::unknown, bos, nullptr, 0u, 0u, MemoryPool::localMemory);
|
||||
|
||||
EXPECT_STREQ(drmAllocation.getAllocationInfoString().c_str(), " Handle: 0 Handle: 1 Handle: 2 Handle: 3");
|
||||
}
|
||||
|
||||
@@ -645,7 +645,7 @@ TEST_F(DrmMemoryManagerLocalMemoryTest, givenDrmMemoryManagerWithLocalMemoryWhen
|
||||
TEST_F(DrmMemoryManagerLocalMemoryWithCustomMockTest, givenDrmMemoryManagerWithLocalMemoryWhenLockResourceIsCalledOnBufferObjectThenReturnPtr) {
|
||||
BufferObject bo(0, mock, 3, 1, 1024, 0);
|
||||
|
||||
DrmAllocation drmAllocation(0, AllocationType::unknown, &bo, nullptr, 0u, 0u, MemoryPool::localMemory);
|
||||
DrmAllocation drmAllocation(0, 1u /*num gmms*/, AllocationType::unknown, &bo, nullptr, 0u, 0u, MemoryPool::localMemory);
|
||||
EXPECT_EQ(&bo, drmAllocation.getBO());
|
||||
|
||||
auto ptr = memoryManager->lockBufferObject(&bo);
|
||||
@@ -848,7 +848,7 @@ TEST_F(DrmMemoryManagerTestImpl, givenDrmMemoryManagerWhenLockUnlockIsCalledOnAl
|
||||
mockExp->ioctlResExt = &ioctlResExt;
|
||||
|
||||
BufferObject bo(0, mockExp, 3, 1, 0, 0);
|
||||
DrmAllocation drmAllocation(0, AllocationType::unknown, &bo, nullptr, 0u, 0u, MemoryPool::localMemory);
|
||||
DrmAllocation drmAllocation(0, 1u /*num gmms*/, AllocationType::unknown, &bo, nullptr, 0u, 0u, MemoryPool::localMemory);
|
||||
EXPECT_NE(nullptr, drmAllocation.getBO());
|
||||
|
||||
auto ptr = memoryManager->lockResource(&drmAllocation);
|
||||
@@ -864,7 +864,7 @@ TEST_F(DrmMemoryManagerTestImpl, givenDrmMemoryManagerWhenLockUnlockIsCalledOnAl
|
||||
mockExp->failOnMmapOffset = true;
|
||||
|
||||
BufferObject bo(0, mockExp, 3, 1, 0, 0);
|
||||
DrmAllocation drmAllocation(0, AllocationType::unknown, &bo, nullptr, 0u, 0u, MemoryPool::localMemory);
|
||||
DrmAllocation drmAllocation(0, 1u /*num gmms*/, AllocationType::unknown, &bo, nullptr, 0u, 0u, MemoryPool::localMemory);
|
||||
EXPECT_NE(nullptr, drmAllocation.getBO());
|
||||
|
||||
auto ptr = memoryManager->lockResource(&drmAllocation);
|
||||
@@ -875,7 +875,7 @@ TEST_F(DrmMemoryManagerTestImpl, givenDrmMemoryManagerWhenLockUnlockIsCalledOnAl
|
||||
}
|
||||
|
||||
TEST_F(DrmMemoryManagerTestImpl, givenDrmMemoryManagerWhenLockUnlockIsCalledOnAllocationInLocalMemoryButBufferObjectIsNullThenReturnNullPtr) {
|
||||
DrmAllocation drmAllocation(0, AllocationType::unknown, nullptr, nullptr, 0u, 0u, MemoryPool::localMemory);
|
||||
DrmAllocation drmAllocation(0, 1u /*num gmms*/, AllocationType::unknown, nullptr, nullptr, 0u, 0u, MemoryPool::localMemory);
|
||||
|
||||
auto ptr = memoryManager->lockResource(&drmAllocation);
|
||||
EXPECT_EQ(nullptr, ptr);
|
||||
|
||||
@@ -278,7 +278,7 @@ TEST_F(DrmMemoryManagerTest, GivenGraphicsAllocationWhenAddAndRemoveAllocationTo
|
||||
size_t size = 0x1000;
|
||||
|
||||
const uint32_t rootDeviceIndex = 0u;
|
||||
DrmAllocation gfxAllocation(rootDeviceIndex, AllocationType::unknown, nullptr, cpuPtr, size, static_cast<osHandle>(1u), MemoryPool::memoryNull);
|
||||
DrmAllocation gfxAllocation(rootDeviceIndex, 1u /*num gmms*/, AllocationType::unknown, nullptr, cpuPtr, size, static_cast<osHandle>(1u), MemoryPool::memoryNull);
|
||||
memoryManager->addAllocationToHostPtrManager(&gfxAllocation);
|
||||
auto fragment = memoryManager->getHostPtrManager()->getFragment({gfxAllocation.getUnderlyingBuffer(), rootDeviceIndex});
|
||||
EXPECT_NE(fragment, nullptr);
|
||||
@@ -2475,7 +2475,7 @@ TEST_F(DrmMemoryManagerTest, givenDrmMemoryManagerWhenLockUnlockIsCalledOnNullAl
|
||||
}
|
||||
|
||||
TEST_F(DrmMemoryManagerTest, givenDrmMemoryManagerWhenLockUnlockIsCalledOnAllocationWithoutBufferObjectThenReturnNullPtr) {
|
||||
DrmAllocation drmAllocation(rootDeviceIndex, AllocationType::unknown, nullptr, nullptr, 0, static_cast<osHandle>(0u), MemoryPool::memoryNull);
|
||||
DrmAllocation drmAllocation(rootDeviceIndex, 1u /*num gmms*/, AllocationType::unknown, nullptr, nullptr, 0, static_cast<osHandle>(0u), MemoryPool::memoryNull);
|
||||
EXPECT_EQ(nullptr, drmAllocation.getBO());
|
||||
|
||||
auto ptr = memoryManager->lockResource(&drmAllocation);
|
||||
@@ -2490,7 +2490,7 @@ TEST_F(DrmMemoryManagerTest, givenDrmMemoryManagerWhenLockUnlockIsCalledButFails
|
||||
mock->ioctlResExt = &ioctlResExt;
|
||||
|
||||
BufferObject bo(rootDeviceIndex, mock, 3, 1, 0, 1);
|
||||
DrmAllocation drmAllocation(rootDeviceIndex, AllocationType::unknown, &bo, nullptr, 0u, static_cast<osHandle>(0u), MemoryPool::memoryNull);
|
||||
DrmAllocation drmAllocation(rootDeviceIndex, 1u /*num gmms*/, AllocationType::unknown, &bo, nullptr, 0u, static_cast<osHandle>(0u), MemoryPool::memoryNull);
|
||||
EXPECT_NE(nullptr, drmAllocation.getBO());
|
||||
|
||||
auto ptr = memoryManager->lockResource(&drmAllocation);
|
||||
@@ -2520,7 +2520,7 @@ TEST_F(DrmMemoryManagerTest, givenDrmMemoryManagerWhenUnlockResourceIsCalledOnAl
|
||||
|
||||
DrmMockCustom drmMock(*executionEnvironment->rootDeviceEnvironments[1]);
|
||||
auto bo = new BufferObject(rootDeviceIndex, &drmMock, 3, 1, 0, 1);
|
||||
auto drmAllocation = new DrmAllocation(rootDeviceIndex, AllocationType::unknown, bo, nullptr, 0u, static_cast<osHandle>(0u), MemoryPool::localMemory);
|
||||
auto drmAllocation = new DrmAllocation(rootDeviceIndex, 1u /*num gmms*/, AllocationType::unknown, bo, nullptr, 0u, static_cast<osHandle>(0u), MemoryPool::localMemory);
|
||||
|
||||
drmMemoryManager.unlockResourceImpl(*drmAllocation);
|
||||
EXPECT_TRUE(drmMemoryManager.unlockResourceInLocalMemoryImplParam.called);
|
||||
@@ -2530,7 +2530,7 @@ TEST_F(DrmMemoryManagerTest, givenDrmMemoryManagerWhenUnlockResourceIsCalledOnAl
|
||||
}
|
||||
|
||||
TEST_F(DrmMemoryManagerTest, givenDrmMemoryManagerWhenSetDomainCpuIsCalledOnAllocationWithoutBufferObjectThenReturnFalse) {
|
||||
DrmAllocation drmAllocation(rootDeviceIndex, AllocationType::unknown, nullptr, nullptr, 0, static_cast<osHandle>(0u), MemoryPool::memoryNull);
|
||||
DrmAllocation drmAllocation(rootDeviceIndex, 1u /*num gmms*/, AllocationType::unknown, nullptr, nullptr, 0, static_cast<osHandle>(0u), MemoryPool::memoryNull);
|
||||
EXPECT_EQ(nullptr, drmAllocation.getBO());
|
||||
|
||||
auto success = memoryManager->setDomainCpu(drmAllocation, false);
|
||||
@@ -2544,7 +2544,7 @@ TEST_F(DrmMemoryManagerTest, givenDrmMemoryManagerWhenSetDomainCpuIsCalledButFai
|
||||
|
||||
DrmMockCustom drmMock(*executionEnvironment->rootDeviceEnvironments[0]);
|
||||
BufferObject bo(0u, &drmMock, 3, 1, 0, 1);
|
||||
DrmAllocation drmAllocation(rootDeviceIndex, AllocationType::unknown, &bo, nullptr, 0u, static_cast<osHandle>(0u), MemoryPool::memoryNull);
|
||||
DrmAllocation drmAllocation(rootDeviceIndex, 1u /*num gmms*/, AllocationType::unknown, &bo, nullptr, 0u, static_cast<osHandle>(0u), MemoryPool::memoryNull);
|
||||
EXPECT_NE(nullptr, drmAllocation.getBO());
|
||||
|
||||
auto success = memoryManager->setDomainCpu(drmAllocation, false);
|
||||
@@ -2557,7 +2557,7 @@ TEST_F(DrmMemoryManagerTest, givenDrmMemoryManagerWhenSetDomainCpuIsCalledOnAllo
|
||||
|
||||
DrmMockCustom drmMock(*executionEnvironment->rootDeviceEnvironments[0]);
|
||||
BufferObject bo(rootDeviceIndex, &drmMock, 3, 1, 0, 1);
|
||||
DrmAllocation drmAllocation(rootDeviceIndex, AllocationType::unknown, &bo, nullptr, 0u, static_cast<osHandle>(0u), MemoryPool::memoryNull);
|
||||
DrmAllocation drmAllocation(rootDeviceIndex, 1u /*num gmms*/, AllocationType::unknown, &bo, nullptr, 0u, static_cast<osHandle>(0u), MemoryPool::memoryNull);
|
||||
EXPECT_NE(nullptr, drmAllocation.getBO());
|
||||
|
||||
auto success = memoryManager->setDomainCpu(drmAllocation, true);
|
||||
@@ -3719,18 +3719,18 @@ struct DrmAllocationTests : public ::testing::Test {
|
||||
};
|
||||
|
||||
TEST_F(DrmAllocationTests, givenAllocationTypeWhenPassedToDrmAllocationConstructorThenAllocationTypeIsStored) {
|
||||
DrmAllocation allocation{0, AllocationType::commandBuffer, nullptr, nullptr, static_cast<size_t>(0), 0u, MemoryPool::memoryNull};
|
||||
DrmAllocation allocation{0, 1u /*num gmms*/, AllocationType::commandBuffer, nullptr, nullptr, static_cast<size_t>(0), 0u, MemoryPool::memoryNull};
|
||||
EXPECT_EQ(AllocationType::commandBuffer, allocation.getAllocationType());
|
||||
|
||||
DrmAllocation allocation2{0, AllocationType::unknown, nullptr, nullptr, 0ULL, static_cast<size_t>(0), MemoryPool::memoryNull};
|
||||
DrmAllocation allocation2{0, 1u /*num gmms*/, AllocationType::unknown, nullptr, nullptr, 0ULL, static_cast<size_t>(0), MemoryPool::memoryNull};
|
||||
EXPECT_EQ(AllocationType::unknown, allocation2.getAllocationType());
|
||||
}
|
||||
|
||||
TEST_F(DrmAllocationTests, givenMemoryPoolWhenPassedToDrmAllocationConstructorThenMemoryPoolIsStored) {
|
||||
DrmAllocation allocation{0, AllocationType::commandBuffer, nullptr, nullptr, static_cast<size_t>(0), 0u, MemoryPool::system64KBPages};
|
||||
DrmAllocation allocation{0, 1u /*num gmms*/, AllocationType::commandBuffer, nullptr, nullptr, static_cast<size_t>(0), 0u, MemoryPool::system64KBPages};
|
||||
EXPECT_EQ(MemoryPool::system64KBPages, allocation.getMemoryPool());
|
||||
|
||||
DrmAllocation allocation2{0, AllocationType::unknown, nullptr, nullptr, 0ULL, static_cast<size_t>(0), MemoryPool::systemCpuInaccessible};
|
||||
DrmAllocation allocation2{0, 1u /*num gmms*/, AllocationType::unknown, nullptr, nullptr, 0ULL, static_cast<size_t>(0), MemoryPool::systemCpuInaccessible};
|
||||
EXPECT_EQ(MemoryPool::systemCpuInaccessible, allocation2.getMemoryPool());
|
||||
}
|
||||
|
||||
@@ -4902,7 +4902,7 @@ TEST_F(DrmMemoryManagerTest, givenDrmAllocationWithHostPtrWhenItIsCreatedWithCac
|
||||
|
||||
memoryManager->populateOsHandles(storage, rootDeviceIndex);
|
||||
|
||||
auto allocation = std::make_unique<DrmAllocation>(rootDeviceIndex, AllocationType::bufferHostMemory,
|
||||
auto allocation = std::make_unique<DrmAllocation>(rootDeviceIndex, 1u /*num gmms*/, AllocationType::bufferHostMemory,
|
||||
nullptr, ptr, castToUint64(ptr), size, MemoryPool::system4KBPages);
|
||||
allocation->fragmentsStorage = storage;
|
||||
|
||||
@@ -5033,7 +5033,7 @@ TEST_F(DrmMemoryManagerTest, whenDebugFlagToNotFreeResourcesIsSpecifiedThenFreeI
|
||||
TestedDrmMemoryManager memoryManager(false, false, false, *executionEnvironment);
|
||||
size_t sizeIn = 1024llu;
|
||||
uint64_t gpuAddress = 0x1337llu;
|
||||
DrmAllocation stackDrmAllocation(0u, AllocationType::buffer, nullptr, nullptr, gpuAddress, sizeIn, MemoryPool::system64KBPages);
|
||||
DrmAllocation stackDrmAllocation(0u, 1u /*num gmms*/, AllocationType::buffer, nullptr, nullptr, gpuAddress, sizeIn, MemoryPool::system64KBPages);
|
||||
memoryManager.freeGraphicsMemoryImpl(&stackDrmAllocation);
|
||||
}
|
||||
|
||||
@@ -5103,7 +5103,7 @@ TEST_F(DrmMemoryManagerTest, givenDrmManagerWithLocalMemoryWhenLockResourceIsCal
|
||||
DrmMemoryManagerToTestLockInLocalMemory memoryManager(*executionEnvironment);
|
||||
BufferObject bo(rootDeviceIndex, mock, 3, 1, 1024, 0);
|
||||
|
||||
DrmAllocation drmAllocation(0, AllocationType::writeCombined, &bo, nullptr, 0u, 0u, MemoryPool::localMemory);
|
||||
DrmAllocation drmAllocation(0, 1u /*num gmms*/, AllocationType::writeCombined, &bo, nullptr, 0u, 0u, MemoryPool::localMemory);
|
||||
EXPECT_EQ(&bo, drmAllocation.getBO());
|
||||
|
||||
auto ptr = memoryManager.lockResourceImpl(drmAllocation);
|
||||
@@ -5235,7 +5235,7 @@ TEST(DrmMemoryManagerSimpleTest, givenDrmMemoryManagerWhenLockResourceIsCalledOn
|
||||
executionEnvironment.rootDeviceEnvironments[0]->osInterface->setDriverModel(std::unique_ptr<DriverModel>(drm));
|
||||
executionEnvironment.rootDeviceEnvironments[0]->memoryOperationsInterface = DrmMemoryOperationsHandler::create(*drm, 0u, false);
|
||||
TestedDrmMemoryManager memoryManager(executionEnvironment);
|
||||
DrmAllocation drmAllocation(0, AllocationType::unknown, nullptr, nullptr, 0u, 0u, MemoryPool::localMemory);
|
||||
DrmAllocation drmAllocation(0, 1u /*num gmms*/, AllocationType::unknown, nullptr, nullptr, 0u, 0u, MemoryPool::localMemory);
|
||||
|
||||
auto ptr = memoryManager.lockBufferObject(drmAllocation.getBO());
|
||||
EXPECT_EQ(nullptr, ptr);
|
||||
@@ -5251,7 +5251,7 @@ TEST(DrmMemoryManagerSimpleTest, givenDrmMemoryManagerWhenFreeGraphicsMemoryIsCa
|
||||
executionEnvironment.rootDeviceEnvironments[0]->memoryOperationsInterface = DrmMemoryOperationsHandler::create(*drm, 0u, false);
|
||||
TestedDrmMemoryManager memoryManager(executionEnvironment);
|
||||
|
||||
auto drmAllocation = new DrmAllocation(0, AllocationType::unknown, nullptr, nullptr, 0u, 0u, MemoryPool::localMemory);
|
||||
auto drmAllocation = new DrmAllocation(0, 1u /*num gmms*/, AllocationType::unknown, nullptr, nullptr, 0u, 0u, MemoryPool::localMemory);
|
||||
EXPECT_NE(nullptr, drmAllocation);
|
||||
|
||||
memoryManager.freeGraphicsMemoryImpl(drmAllocation);
|
||||
@@ -5268,7 +5268,7 @@ TEST(DrmMemoryManagerSimpleTest, WhenDrmIsCreatedThenQueryPageFaultSupportIsCall
|
||||
using DrmMemoryManagerWithLocalMemoryTest = Test<DrmMemoryManagerWithLocalMemoryFixture>;
|
||||
|
||||
TEST_F(DrmMemoryManagerWithLocalMemoryTest, givenDrmMemoryManagerWithLocalMemoryWhenLockResourceIsCalledOnAllocationInLocalMemoryThenReturnNullPtr) {
|
||||
DrmAllocation drmAllocation(rootDeviceIndex, AllocationType::unknown, nullptr, nullptr, 0u, 0u, MemoryPool::localMemory);
|
||||
DrmAllocation drmAllocation(rootDeviceIndex, 1u /*num gmms*/, AllocationType::unknown, nullptr, nullptr, 0u, 0u, MemoryPool::localMemory);
|
||||
|
||||
auto ptr = memoryManager->lockResource(&drmAllocation);
|
||||
EXPECT_EQ(nullptr, ptr);
|
||||
@@ -5334,7 +5334,7 @@ TEST_F(DrmMemoryManagerTest, givenDrmMemoryManagerWhenSetMemAdviseIsCalledThenUp
|
||||
TestedDrmMemoryManager memoryManager(false, false, false, *executionEnvironment);
|
||||
BufferObject bo(rootDeviceIndex, mock, 3, 1, 1024, 0);
|
||||
|
||||
DrmAllocation drmAllocation(rootDeviceIndex, AllocationType::unifiedSharedMemory, &bo, nullptr, 0u, 0u, MemoryPool::localMemory);
|
||||
DrmAllocation drmAllocation(rootDeviceIndex, 1u /*num gmms*/, AllocationType::unifiedSharedMemory, &bo, nullptr, 0u, 0u, MemoryPool::localMemory);
|
||||
EXPECT_EQ(&bo, drmAllocation.getBO());
|
||||
|
||||
for (auto isCached : {false, true}) {
|
||||
@@ -5350,7 +5350,7 @@ TEST_F(DrmMemoryManagerTest, givenDrmMemoryManagerWhenSetAtomicAccessIsCalledThe
|
||||
TestedDrmMemoryManager memoryManager(false, false, false, *executionEnvironment);
|
||||
BufferObject bo(rootDeviceIndex, mock, 3, 1, 1024, 0);
|
||||
|
||||
DrmAllocation drmAllocation(rootDeviceIndex, AllocationType::unifiedSharedMemory, &bo, nullptr, 0u, 0u, MemoryPool::localMemory);
|
||||
DrmAllocation drmAllocation(rootDeviceIndex, 1u /*num gmms*/, AllocationType::unifiedSharedMemory, &bo, nullptr, 0u, 0u, MemoryPool::localMemory);
|
||||
EXPECT_EQ(&bo, drmAllocation.getBO());
|
||||
|
||||
size_t size = 16;
|
||||
|
||||
@@ -536,7 +536,7 @@ TEST_F(DrmMemoryOperationsHandlerBindTest, givenEvictImplFailsThenEvictWithinOsC
|
||||
TEST_F(DrmMemoryOperationsHandlerBindTest, givenMakeBOsResidentFailsThenMakeResidentWithinOsContextReturnsError) {
|
||||
struct MockDrmAllocationBOsResident : public DrmAllocation {
|
||||
MockDrmAllocationBOsResident(uint32_t rootDeviceIndex, AllocationType allocationType, BufferObjects &bos, void *ptrIn, uint64_t gpuAddress, size_t sizeIn, MemoryPool pool)
|
||||
: DrmAllocation(rootDeviceIndex, allocationType, bos, ptrIn, gpuAddress, sizeIn, pool) {
|
||||
: DrmAllocation(rootDeviceIndex, 1u /*num gmms*/, allocationType, bos, ptrIn, gpuAddress, sizeIn, pool) {
|
||||
}
|
||||
|
||||
int makeBOsResident(OsContext *osContext, uint32_t vmHandleId, std::vector<BufferObject *> *bufferObjects, bool bind) override {
|
||||
@@ -560,7 +560,7 @@ TEST_F(DrmMemoryOperationsHandlerBindTest,
|
||||
givenDrmAllocationWithChunkingAndmakeResidentWithinOsContextCalledThenprefetchBOWithChunkingCalled) {
|
||||
struct MockDrmAllocationBOsResident : public DrmAllocation {
|
||||
MockDrmAllocationBOsResident(uint32_t rootDeviceIndex, AllocationType allocationType, BufferObjects &bos, void *ptrIn, uint64_t gpuAddress, size_t sizeIn, MemoryPool pool)
|
||||
: DrmAllocation(rootDeviceIndex, allocationType, bos, ptrIn, gpuAddress, sizeIn, pool) {
|
||||
: DrmAllocation(rootDeviceIndex, 1u /*num gmms*/, allocationType, bos, ptrIn, gpuAddress, sizeIn, pool) {
|
||||
}
|
||||
};
|
||||
DebugManagerStateRestore restore;
|
||||
@@ -1242,7 +1242,7 @@ HWTEST_F(DrmMemoryOperationsHandlerBindTest, givenDebugFlagSetWhenVmBindCalledTh
|
||||
EXPECT_EQ(2u, patIndex);
|
||||
|
||||
MockBufferObject bo(0, mock, patIndex, 0, 0, 1);
|
||||
DrmAllocation allocation(0, AllocationType::buffer, &bo, nullptr, 0x1234000, 1, MemoryPool::localMemory);
|
||||
DrmAllocation allocation(0, 1u /*num gmms*/, AllocationType::buffer, &bo, nullptr, 0x1234000, 1, MemoryPool::localMemory);
|
||||
|
||||
GraphicsAllocation *allocPtr = &allocation;
|
||||
|
||||
@@ -1273,7 +1273,7 @@ HWTEST_F(DrmMemoryOperationsHandlerBindTest, givenDebugFlagSetWhenVmBindCalledTh
|
||||
EXPECT_EQ(3u, patIndex);
|
||||
|
||||
MockBufferObject bo(0, mock, patIndex, 0, 0, 1);
|
||||
DrmAllocation allocation(0, AllocationType::buffer, &bo, nullptr, 0x1234000, 1, MemoryPool::system4KBPages);
|
||||
DrmAllocation allocation(0, 1u /*num gmms*/, AllocationType::buffer, &bo, nullptr, 0x1234000, 1, MemoryPool::system4KBPages);
|
||||
|
||||
GraphicsAllocation *allocPtr = &allocation;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user