mirror of
https://github.com/intel/compute-runtime.git
synced 2026-01-03 23:03:02 +08:00
Simplify Memory Manager API [3/4]
- remove method allocateGraphicsMemory(size_t size) - pass allocation type in allocation properties - set allocation type in allocateGraphicsMemoryInPreferredPool Change-Id: Ia9296d0ab2f711b7d78aff615cb56b3a246b60ec Signed-off-by: Mateusz Jablonski <mateusz.jablonski@intel.com>
This commit is contained in:
committed by
sys_ocldev
parent
686785ce5d
commit
8ec072d39c
@@ -621,7 +621,7 @@ TEST_F(DrmCommandStreamGemWorkerTests, givenDefaultDrmCSRWhenItIsCreatedThenGemC
|
||||
}
|
||||
|
||||
TEST_F(DrmCommandStreamGemWorkerTests, givenCommandStreamWhenItIsFlushedWithGemCloseWorkerInDefaultModeThenWorkerDecreasesTheRefCount) {
|
||||
auto commandBuffer = mm->allocateGraphicsMemory(static_cast<size_t>(1024));
|
||||
auto commandBuffer = mm->allocateGraphicsMemoryWithProperties(MockAllocationProperties{MemoryConstants::pageSize});
|
||||
ASSERT_NE(nullptr, commandBuffer);
|
||||
LinearStream cs(commandBuffer);
|
||||
|
||||
@@ -654,11 +654,11 @@ TEST_F(DrmCommandStreamGemWorkerTests, givenTaskThatRequiresLargeResourceCountWh
|
||||
execStorage.resize(0);
|
||||
|
||||
for (auto id = 0; id < 10; id++) {
|
||||
auto graphicsAllocation = mm->allocateGraphicsMemory(1);
|
||||
auto graphicsAllocation = mm->allocateGraphicsMemoryWithProperties(MockAllocationProperties{MemoryConstants::pageSize});
|
||||
csr->makeResident(*graphicsAllocation);
|
||||
graphicsAllocations.push_back(graphicsAllocation);
|
||||
}
|
||||
auto commandBuffer = mm->allocateGraphicsMemory(1024);
|
||||
auto commandBuffer = mm->allocateGraphicsMemoryWithProperties(MockAllocationProperties{MemoryConstants::pageSize});
|
||||
|
||||
LinearStream cs(commandBuffer);
|
||||
|
||||
@@ -676,7 +676,7 @@ TEST_F(DrmCommandStreamGemWorkerTests, givenTaskThatRequiresLargeResourceCountWh
|
||||
}
|
||||
|
||||
TEST_F(DrmCommandStreamGemWorkerTests, givenGemCloseWorkerInactiveModeWhenMakeResidentIsCalledThenRefCountsAreNotUpdated) {
|
||||
auto dummyAllocation = static_cast<DrmAllocation *>(mm->allocateGraphicsMemory(1024));
|
||||
auto dummyAllocation = static_cast<DrmAllocation *>(mm->allocateGraphicsMemoryWithProperties(MockAllocationProperties{MemoryConstants::pageSize}));
|
||||
|
||||
auto bo = dummyAllocation->getBO();
|
||||
EXPECT_EQ(1u, bo->getRefCount());
|
||||
@@ -693,8 +693,8 @@ TEST_F(DrmCommandStreamGemWorkerTests, givenGemCloseWorkerInactiveModeWhenMakeRe
|
||||
}
|
||||
|
||||
TEST_F(DrmCommandStreamGemWorkerTests, GivenTwoAllocationsWhenBackingStorageIsDifferentThenMakeResidentShouldAddTwoLocations) {
|
||||
auto allocation = static_cast<DrmAllocation *>(mm->allocateGraphicsMemory(1024));
|
||||
auto allocation2 = static_cast<DrmAllocation *>(mm->allocateGraphicsMemory(1024));
|
||||
auto allocation = static_cast<DrmAllocation *>(mm->allocateGraphicsMemoryWithProperties(MockAllocationProperties{MemoryConstants::pageSize}));
|
||||
auto allocation2 = static_cast<DrmAllocation *>(mm->allocateGraphicsMemoryWithProperties(MockAllocationProperties{MemoryConstants::pageSize}));
|
||||
|
||||
csr->makeResident(*allocation);
|
||||
csr->makeResident(*allocation2);
|
||||
@@ -723,8 +723,8 @@ TEST_F(DrmCommandStreamGemWorkerTests, GivenTwoAllocationsWhenBackingStorageIsDi
|
||||
}
|
||||
|
||||
TEST_F(DrmCommandStreamGemWorkerTests, givenCommandStreamWithDuplicatesWhenItIsFlushedWithGemCloseWorkerInactiveModeThenCsIsNotNulled) {
|
||||
auto commandBuffer = static_cast<DrmAllocation *>(mm->allocateGraphicsMemory(1024));
|
||||
auto dummyAllocation = static_cast<DrmAllocation *>(mm->allocateGraphicsMemory(1024));
|
||||
auto commandBuffer = static_cast<DrmAllocation *>(mm->allocateGraphicsMemoryWithProperties(MockAllocationProperties{MemoryConstants::pageSize}));
|
||||
auto dummyAllocation = static_cast<DrmAllocation *>(mm->allocateGraphicsMemoryWithProperties(MockAllocationProperties{MemoryConstants::pageSize}));
|
||||
ASSERT_NE(nullptr, commandBuffer);
|
||||
ASSERT_EQ(0u, reinterpret_cast<uintptr_t>(commandBuffer->getUnderlyingBuffer()) & 0xFFF);
|
||||
LinearStream cs(commandBuffer);
|
||||
@@ -768,7 +768,7 @@ class DrmCommandStreamBatchingTests : public Test<DrmCommandStreamEnhancedFixtur
|
||||
DrmCommandStreamEnhancedFixture::SetUp();
|
||||
if (PreemptionHelper::getDefaultPreemptionMode(*platformDevices[0]) == PreemptionMode::MidThread) {
|
||||
tmpAllocation = GlobalMockSipProgram::sipProgram->getAllocation();
|
||||
GlobalMockSipProgram::sipProgram->resetAllocation(device->getMemoryManager()->allocateGraphicsMemory(1024));
|
||||
GlobalMockSipProgram::sipProgram->resetAllocation(device->getMemoryManager()->allocateGraphicsMemoryWithProperties(MockAllocationProperties{MemoryConstants::pageSize}));
|
||||
}
|
||||
tagAllocation = static_cast<DrmAllocation *>(device->getDefaultEngine().commandStreamReceiver->getTagAllocation());
|
||||
preemptionAllocation = static_cast<DrmAllocation *>(device->getPreemptionAllocation());
|
||||
@@ -784,8 +784,8 @@ class DrmCommandStreamBatchingTests : public Test<DrmCommandStreamEnhancedFixtur
|
||||
|
||||
TEST_F(DrmCommandStreamBatchingTests, givenCSRWhenFlushIsCalledThenProperFlagsArePassed) {
|
||||
mock->reset();
|
||||
auto commandBuffer = mm->allocateGraphicsMemory(1024);
|
||||
auto dummyAllocation = mm->allocateGraphicsMemory(1024);
|
||||
auto commandBuffer = mm->allocateGraphicsMemoryWithProperties(MockAllocationProperties{MemoryConstants::pageSize});
|
||||
auto dummyAllocation = mm->allocateGraphicsMemoryWithProperties(MockAllocationProperties{MemoryConstants::pageSize});
|
||||
ASSERT_NE(nullptr, commandBuffer);
|
||||
ASSERT_EQ(0u, reinterpret_cast<uintptr_t>(commandBuffer->getUnderlyingBuffer()) & 0xFFF);
|
||||
LinearStream cs(commandBuffer);
|
||||
@@ -819,8 +819,8 @@ TEST_F(DrmCommandStreamBatchingTests, givenCsrWhenDispatchPolicyIsSetToBatchingT
|
||||
auto mockedSubmissionsAggregator = new mockSubmissionsAggregator();
|
||||
tCsr->overrideSubmissionAggregator(mockedSubmissionsAggregator);
|
||||
|
||||
auto commandBuffer = mm->allocateGraphicsMemory(1024);
|
||||
auto dummyAllocation = mm->allocateGraphicsMemory(1024);
|
||||
auto commandBuffer = mm->allocateGraphicsMemoryWithProperties(MockAllocationProperties{MemoryConstants::pageSize});
|
||||
auto dummyAllocation = mm->allocateGraphicsMemoryWithProperties(MockAllocationProperties{MemoryConstants::pageSize});
|
||||
ASSERT_NE(nullptr, commandBuffer);
|
||||
ASSERT_EQ(0u, reinterpret_cast<uintptr_t>(commandBuffer->getUnderlyingBuffer()) & 0xFFF);
|
||||
IndirectHeap cs(commandBuffer);
|
||||
@@ -876,7 +876,7 @@ TEST_F(DrmCommandStreamBatchingTests, givenRecordedCommandBufferWhenItIsSubmitte
|
||||
auto mockedSubmissionsAggregator = new mockSubmissionsAggregator();
|
||||
tCsr->overrideSubmissionAggregator(mockedSubmissionsAggregator);
|
||||
|
||||
auto commandBuffer = mm->allocateGraphicsMemory(1024);
|
||||
auto commandBuffer = mm->allocateGraphicsMemoryWithProperties(MockAllocationProperties{MemoryConstants::pageSize});
|
||||
IndirectHeap cs(commandBuffer);
|
||||
|
||||
tCsr->setTagAllocation(tagAllocation);
|
||||
@@ -1288,8 +1288,8 @@ TEST_F(DrmCommandStreamLeaksTest, Flush) {
|
||||
}
|
||||
|
||||
TEST_F(DrmCommandStreamLeaksTest, ClearResidencyWhenFlushNotCalled) {
|
||||
auto allocation1 = static_cast<DrmAllocation *>(mm->allocateGraphicsMemory(1024));
|
||||
auto allocation2 = static_cast<DrmAllocation *>(mm->allocateGraphicsMemory(1024));
|
||||
auto allocation1 = static_cast<DrmAllocation *>(mm->allocateGraphicsMemoryWithProperties(MockAllocationProperties{MemoryConstants::pageSize}));
|
||||
auto allocation2 = static_cast<DrmAllocation *>(mm->allocateGraphicsMemoryWithProperties(MockAllocationProperties{MemoryConstants::pageSize}));
|
||||
ASSERT_NE(nullptr, allocation1);
|
||||
ASSERT_NE(nullptr, allocation2);
|
||||
|
||||
@@ -1335,9 +1335,9 @@ TEST_F(DrmCommandStreamLeaksTest, FlushMultipleTimes) {
|
||||
BatchBuffer batchBuffer2{cs.getGraphicsAllocation(), 8, 0, nullptr, false, false, QueueThrottle::MEDIUM, cs.getUsed(), &cs};
|
||||
csr->flush(batchBuffer2, csr->getResidencyAllocations());
|
||||
|
||||
auto allocation = mm->allocateGraphicsMemory(1024);
|
||||
auto allocation = mm->allocateGraphicsMemoryWithProperties(MockAllocationProperties{MemoryConstants::pageSize});
|
||||
ASSERT_NE(nullptr, allocation);
|
||||
auto allocation2 = mm->allocateGraphicsMemory(1024);
|
||||
auto allocation2 = mm->allocateGraphicsMemoryWithProperties(MockAllocationProperties{MemoryConstants::pageSize});
|
||||
ASSERT_NE(nullptr, allocation2);
|
||||
|
||||
csr->makeResident(*allocation);
|
||||
@@ -1345,7 +1345,7 @@ TEST_F(DrmCommandStreamLeaksTest, FlushMultipleTimes) {
|
||||
|
||||
csr->getInternalAllocationStorage()->storeAllocation(std::unique_ptr<GraphicsAllocation>(commandBuffer), REUSABLE_ALLOCATION);
|
||||
|
||||
auto commandBuffer2 = mm->allocateGraphicsMemory(1024);
|
||||
auto commandBuffer2 = mm->allocateGraphicsMemoryWithProperties(MockAllocationProperties{MemoryConstants::pageSize});
|
||||
ASSERT_NE(nullptr, commandBuffer2);
|
||||
cs.replaceBuffer(commandBuffer2->getUnderlyingBuffer(), commandBuffer2->getUnderlyingBufferSize());
|
||||
cs.replaceGraphicsAllocation(commandBuffer2);
|
||||
@@ -1358,7 +1358,7 @@ TEST_F(DrmCommandStreamLeaksTest, FlushMultipleTimes) {
|
||||
mm->freeGraphicsMemory(allocation2);
|
||||
|
||||
csr->getInternalAllocationStorage()->storeAllocation(std::unique_ptr<GraphicsAllocation>(commandBuffer2), REUSABLE_ALLOCATION);
|
||||
commandBuffer2 = mm->allocateGraphicsMemory(1024);
|
||||
commandBuffer2 = mm->allocateGraphicsMemoryWithProperties(MockAllocationProperties{MemoryConstants::pageSize});
|
||||
ASSERT_NE(nullptr, commandBuffer2);
|
||||
cs.replaceBuffer(commandBuffer2->getUnderlyingBuffer(), commandBuffer2->getUnderlyingBufferSize());
|
||||
cs.replaceGraphicsAllocation(commandBuffer2);
|
||||
@@ -1416,7 +1416,7 @@ TEST_F(DrmCommandStreamLeaksTest, CheckDrmFree) {
|
||||
ASSERT_NE(0u, (reinterpret_cast<uintptr_t>(commandBuffer->getUnderlyingBuffer()) + 4) & 0xFFF);
|
||||
ASSERT_EQ(4u, (reinterpret_cast<uintptr_t>(commandBuffer->getUnderlyingBuffer()) + 4) & 0x7F);
|
||||
|
||||
auto allocation = mm->allocateGraphicsMemory(1024);
|
||||
auto allocation = mm->allocateGraphicsMemoryWithProperties(MockAllocationProperties{MemoryConstants::pageSize});
|
||||
|
||||
csr->makeResident(*allocation);
|
||||
csr->addBatchBufferEnd(cs, nullptr);
|
||||
@@ -1428,8 +1428,8 @@ TEST_F(DrmCommandStreamLeaksTest, CheckDrmFree) {
|
||||
}
|
||||
|
||||
TEST_F(DrmCommandStreamLeaksTest, MakeResidentClearResidencyAllocationsInCommandStreamReceiver) {
|
||||
auto allocation1 = mm->allocateGraphicsMemory(1024);
|
||||
auto allocation2 = mm->allocateGraphicsMemory(1024);
|
||||
auto allocation1 = mm->allocateGraphicsMemoryWithProperties(MockAllocationProperties{MemoryConstants::pageSize});
|
||||
auto allocation2 = mm->allocateGraphicsMemoryWithProperties(MockAllocationProperties{MemoryConstants::pageSize});
|
||||
|
||||
ASSERT_NE(nullptr, allocation1);
|
||||
ASSERT_NE(nullptr, allocation2);
|
||||
@@ -1447,7 +1447,7 @@ TEST_F(DrmCommandStreamLeaksTest, MakeResidentClearResidencyAllocationsInCommand
|
||||
}
|
||||
|
||||
TEST_F(DrmCommandStreamLeaksTest, givenMultipleMakeResidentWhenMakeNonResidentIsCalledOnlyOnceThenSurfaceIsMadeNonResident) {
|
||||
auto allocation1 = mm->allocateGraphicsMemory(1024);
|
||||
auto allocation1 = mm->allocateGraphicsMemoryWithProperties(MockAllocationProperties{MemoryConstants::pageSize});
|
||||
|
||||
ASSERT_NE(nullptr, allocation1);
|
||||
|
||||
@@ -1466,7 +1466,7 @@ TEST_F(DrmCommandStreamLeaksTest, givenMultipleMakeResidentWhenMakeNonResidentIs
|
||||
}
|
||||
|
||||
TEST_F(DrmCommandStreamLeaksTest, makeNonResidentOnMemObjectCallsDrmCSMakeNonResidentWithGraphicsAllocation) {
|
||||
auto allocation1 = mm->allocateGraphicsMemory(0x1000);
|
||||
auto allocation1 = mm->allocateGraphicsMemoryWithProperties(MockAllocationProperties{0x1000});
|
||||
ASSERT_NE(nullptr, allocation1);
|
||||
|
||||
tCsr->makeResident(*allocation1);
|
||||
|
||||
@@ -48,7 +48,7 @@
|
||||
using namespace OCLRT;
|
||||
|
||||
AllocationProperties createAllocationProperties(size_t size, bool forcePin) {
|
||||
AllocationProperties properties(true, size);
|
||||
MockAllocationProperties properties(size);
|
||||
properties.alignment = MemoryConstants::preferredAlignment;
|
||||
properties.flags.forcePin = forcePin;
|
||||
return properties;
|
||||
@@ -371,7 +371,7 @@ TEST_F(DrmMemoryManagerTest, AllocateThenFree) {
|
||||
mock->ioctl_expected.gemWait = 1;
|
||||
mock->ioctl_expected.gemClose = 1;
|
||||
|
||||
auto alloc = static_cast<DrmAllocation *>(memoryManager->allocateGraphicsMemory(1024));
|
||||
auto alloc = static_cast<DrmAllocation *>(memoryManager->allocateGraphicsMemoryWithProperties(MockAllocationProperties{MemoryConstants::pageSize}));
|
||||
ASSERT_NE(nullptr, alloc);
|
||||
EXPECT_NE(nullptr, alloc->getBO());
|
||||
|
||||
@@ -383,7 +383,7 @@ TEST_F(DrmMemoryManagerTest, AllocateNewFail) {
|
||||
mock->ioctl_expected.total = -1; //don't care
|
||||
|
||||
InjectedFunction method = [this](size_t failureIndex) {
|
||||
auto ptr = memoryManager->allocateGraphicsMemory(1024);
|
||||
auto ptr = memoryManager->allocateGraphicsMemoryWithProperties(MockAllocationProperties{MemoryConstants::pageSize});
|
||||
|
||||
if (nonfailingAllocation != failureIndex) {
|
||||
EXPECT_EQ(nullptr, ptr);
|
||||
@@ -400,7 +400,7 @@ TEST_F(DrmMemoryManagerTest, Allocate0Bytes) {
|
||||
mock->ioctl_expected.gemWait = 1;
|
||||
mock->ioctl_expected.gemClose = 1;
|
||||
|
||||
auto ptr = memoryManager->allocateGraphicsMemory(static_cast<size_t>(0));
|
||||
auto ptr = memoryManager->allocateGraphicsMemoryWithProperties(MockAllocationProperties{0u});
|
||||
ASSERT_NE(nullptr, ptr);
|
||||
EXPECT_NE(nullptr, ptr->getUnderlyingBuffer());
|
||||
|
||||
@@ -412,7 +412,7 @@ TEST_F(DrmMemoryManagerTest, Allocate3Bytes) {
|
||||
mock->ioctl_expected.gemWait = 1;
|
||||
mock->ioctl_expected.gemClose = 1;
|
||||
|
||||
auto ptr = memoryManager->allocateGraphicsMemory(3);
|
||||
auto ptr = memoryManager->allocateGraphicsMemoryWithProperties(MockAllocationProperties{MemoryConstants::pageSize});
|
||||
ASSERT_NE(nullptr, ptr);
|
||||
EXPECT_NE(nullptr, ptr->getUnderlyingBuffer());
|
||||
|
||||
@@ -423,7 +423,7 @@ TEST_F(DrmMemoryManagerTest, AllocateUserptrFail) {
|
||||
mock->ioctl_expected.gemUserptr = 1;
|
||||
mock->ioctl_res = -1;
|
||||
|
||||
auto ptr = memoryManager->allocateGraphicsMemory(3);
|
||||
auto ptr = memoryManager->allocateGraphicsMemoryWithProperties(MockAllocationProperties{MemoryConstants::pageSize});
|
||||
EXPECT_EQ(nullptr, ptr);
|
||||
mock->ioctl_res = 0;
|
||||
}
|
||||
@@ -1693,7 +1693,7 @@ TEST_F(DrmMemoryManagerTest, givenDrmMemoryManagerWhenLockUnlockIsCalledThenRetu
|
||||
mock->ioctl_expected.gemWait = 1;
|
||||
mock->ioctl_expected.gemClose = 1;
|
||||
|
||||
auto allocation = memoryManager->allocateGraphicsMemory(1);
|
||||
auto allocation = memoryManager->allocateGraphicsMemoryWithProperties(MockAllocationProperties{MemoryConstants::pageSize});
|
||||
ASSERT_NE(nullptr, allocation);
|
||||
|
||||
auto ptr = memoryManager->lockResource(allocation);
|
||||
@@ -1709,7 +1709,7 @@ TEST_F(DrmMemoryManagerTest, givenDrmMemoryManagerWhenLockUnlockIsCalledOnAlloca
|
||||
mock->ioctl_expected.gemWait = 1;
|
||||
mock->ioctl_expected.gemClose = 1;
|
||||
|
||||
auto allocation = memoryManager->allocateGraphicsMemory(1);
|
||||
auto allocation = memoryManager->allocateGraphicsMemoryWithProperties(MockAllocationProperties{MemoryConstants::pageSize});
|
||||
ASSERT_NE(nullptr, allocation);
|
||||
EXPECT_NE(nullptr, allocation->getUnderlyingBuffer());
|
||||
|
||||
@@ -1866,7 +1866,7 @@ TEST_F(DrmMemoryManagerTest, givenDrmMemoryManagerAndUnifiedAuxCapableAllocation
|
||||
mock->ioctl_expected.gemClose = 1;
|
||||
|
||||
auto gmm = new Gmm(nullptr, 123, false);
|
||||
auto allocation = memoryManager->allocateGraphicsMemory(123);
|
||||
auto allocation = memoryManager->allocateGraphicsMemoryWithProperties(MockAllocationProperties{MemoryConstants::pageSize});
|
||||
allocation->gmm = gmm;
|
||||
|
||||
auto mockGmmRes = reinterpret_cast<MockGmmResourceInfo *>(gmm->gmmResourceInfo.get());
|
||||
@@ -1940,7 +1940,7 @@ TEST_F(DrmMemoryManagerTest, givenMemoryManagerSupportingVirutalPaddingWhenItIsR
|
||||
mock->ioctl_expected.gemClose = 3;
|
||||
//first let's create normal buffer
|
||||
auto bufferSize = MemoryConstants::pageSize;
|
||||
auto buffer = memoryManager->allocateGraphicsMemory(bufferSize);
|
||||
auto buffer = memoryManager->allocateGraphicsMemoryWithProperties(MockAllocationProperties{bufferSize});
|
||||
|
||||
//buffer should have size 16
|
||||
EXPECT_EQ(bufferSize, buffer->getUnderlyingBufferSize());
|
||||
@@ -2054,7 +2054,7 @@ TEST_F(DrmMemoryManagerTest, givenMemoryManagerSupportingVirutalPaddingWhenAlloc
|
||||
|
||||
//first let's create normal buffer
|
||||
auto bufferSize = MemoryConstants::pageSize;
|
||||
auto buffer = memoryManager->allocateGraphicsMemory(bufferSize);
|
||||
auto buffer = memoryManager->allocateGraphicsMemoryWithProperties(MockAllocationProperties{bufferSize});
|
||||
|
||||
//buffer should have size 16
|
||||
EXPECT_EQ(bufferSize, buffer->getUnderlyingBufferSize());
|
||||
@@ -2414,14 +2414,8 @@ TEST(DrmMemoryManager, givenEnabledHostMemoryValidationAndForcePinWhenMemoryMana
|
||||
TEST(DrmMemoryManager, givenMemoryManagerWhenAllocateGraphicsMemoryIsCalledThenMemoryPoolIsSystem4KBPages) {
|
||||
ExecutionEnvironment executionEnvironment;
|
||||
std::unique_ptr<TestedDrmMemoryManager> memoryManager(new (std::nothrow) TestedDrmMemoryManager(Drm::get(0), false, true, executionEnvironment));
|
||||
auto size = 4096u;
|
||||
|
||||
auto allocation = memoryManager->allocateGraphicsMemory(size);
|
||||
EXPECT_NE(nullptr, allocation);
|
||||
EXPECT_EQ(MemoryPool::System4KBPages, allocation->getMemoryPool());
|
||||
memoryManager->freeGraphicsMemory(allocation);
|
||||
|
||||
allocation = memoryManager->allocateGraphicsMemoryWithProperties(createAllocationProperties(size, false));
|
||||
auto allocation = memoryManager->allocateGraphicsMemoryWithProperties(createAllocationProperties(MemoryConstants::pageSize, false));
|
||||
EXPECT_NE(nullptr, allocation);
|
||||
EXPECT_EQ(MemoryPool::System4KBPages, allocation->getMemoryPool());
|
||||
memoryManager->freeGraphicsMemory(allocation);
|
||||
|
||||
@@ -134,7 +134,7 @@ class WddmCommandStreamWithMockGdiFixture {
|
||||
ASSERT_NE(nullptr, device);
|
||||
this->csr->overrideRecorededCommandBuffer(*device);
|
||||
if (device->getPreemptionMode() == PreemptionMode::MidThread) {
|
||||
preemptionAllocation = memoryManager->allocateGraphicsMemory(1024);
|
||||
preemptionAllocation = memoryManager->allocateGraphicsMemoryWithProperties(MockAllocationProperties{MemoryConstants::pageSize});
|
||||
}
|
||||
}
|
||||
|
||||
@@ -182,7 +182,7 @@ TEST_F(WddmCommandStreamTest, givenFlushStampWhenWaitCalledThenWaitForSpecifiedM
|
||||
}
|
||||
|
||||
TEST_F(WddmCommandStreamTest, Flush) {
|
||||
GraphicsAllocation *commandBuffer = memoryManager->allocateGraphicsMemory(4096);
|
||||
GraphicsAllocation *commandBuffer = memoryManager->allocateGraphicsMemoryWithProperties(MockAllocationProperties{MemoryConstants::pageSize});
|
||||
ASSERT_NE(nullptr, commandBuffer);
|
||||
LinearStream cs(commandBuffer);
|
||||
BatchBuffer batchBuffer{cs.getGraphicsAllocation(), 0, 0, nullptr, false, false, QueueThrottle::MEDIUM, cs.getUsed(), &cs};
|
||||
@@ -196,7 +196,7 @@ TEST_F(WddmCommandStreamTest, Flush) {
|
||||
}
|
||||
|
||||
TEST_F(WddmCommandStreamTest, givenGraphicsAllocationWithDifferentGpuAddressThenCpuAddressWhenSubmitIsCalledThenGpuAddressIsUsed) {
|
||||
GraphicsAllocation *commandBuffer = memoryManager->allocateGraphicsMemory(4096);
|
||||
GraphicsAllocation *commandBuffer = memoryManager->allocateGraphicsMemoryWithProperties(MockAllocationProperties{MemoryConstants::pageSize});
|
||||
|
||||
auto cpuAddress = commandBuffer->getUnderlyingBuffer();
|
||||
uint64_t mockGpuAddres = 1337;
|
||||
@@ -210,7 +210,7 @@ TEST_F(WddmCommandStreamTest, givenGraphicsAllocationWithDifferentGpuAddressThen
|
||||
}
|
||||
TEST_F(WddmCommandStreamTest, FlushWithOffset) {
|
||||
auto offset = 128u;
|
||||
GraphicsAllocation *commandBuffer = memoryManager->allocateGraphicsMemory(4096);
|
||||
GraphicsAllocation *commandBuffer = memoryManager->allocateGraphicsMemoryWithProperties(MockAllocationProperties{MemoryConstants::pageSize});
|
||||
ASSERT_NE(nullptr, commandBuffer);
|
||||
LinearStream cs(commandBuffer);
|
||||
|
||||
@@ -224,7 +224,7 @@ TEST_F(WddmCommandStreamTest, FlushWithOffset) {
|
||||
}
|
||||
|
||||
TEST_F(WddmCommandStreamTest, givenWdmmWhenSubmitIsCalledThenCoherencyRequiredFlagIsSetToFalse) {
|
||||
GraphicsAllocation *commandBuffer = memoryManager->allocateGraphicsMemory(4096);
|
||||
GraphicsAllocation *commandBuffer = memoryManager->allocateGraphicsMemoryWithProperties(MockAllocationProperties{MemoryConstants::pageSize});
|
||||
ASSERT_NE(nullptr, commandBuffer);
|
||||
LinearStream cs(commandBuffer);
|
||||
|
||||
@@ -252,7 +252,7 @@ TEST(WddmPreemptionHeaderTests, givenWddmCommandStreamReceiverWhenPreemptionIsOf
|
||||
OsContext osContext(executionEnvironment->osInterface.get(), 0u, gpgpuEngineInstances[0], PreemptionHelper::getDefaultPreemptionMode(*hwInfo));
|
||||
executionEnvironment->commandStreamReceivers[0][0]->setOsContext(osContext);
|
||||
|
||||
auto commandBuffer = executionEnvironment->memoryManager->allocateGraphicsMemory(4096);
|
||||
auto commandBuffer = executionEnvironment->memoryManager->allocateGraphicsMemoryWithProperties(MockAllocationProperties{MemoryConstants::pageSize});
|
||||
LinearStream cs(commandBuffer);
|
||||
|
||||
BatchBuffer batchBuffer{cs.getGraphicsAllocation(), 0, 0, nullptr, false, false, QueueThrottle::MEDIUM, cs.getUsed(), &cs};
|
||||
@@ -277,7 +277,7 @@ TEST(WddmPreemptionHeaderTests, givenWddmCommandStreamReceiverWhenPreemptionIsOn
|
||||
OsContext osContext(executionEnvironment->osInterface.get(), 0u, gpgpuEngineInstances[0], PreemptionHelper::getDefaultPreemptionMode(*hwInfo));
|
||||
executionEnvironment->commandStreamReceivers[0][0]->setOsContext(osContext);
|
||||
|
||||
auto commandBuffer = executionEnvironment->memoryManager->allocateGraphicsMemory(4096);
|
||||
auto commandBuffer = executionEnvironment->memoryManager->allocateGraphicsMemoryWithProperties(MockAllocationProperties{MemoryConstants::pageSize});
|
||||
LinearStream cs(commandBuffer);
|
||||
|
||||
BatchBuffer batchBuffer{cs.getGraphicsAllocation(), 0, 0, nullptr, false, false, QueueThrottle::MEDIUM, cs.getUsed(), &cs};
|
||||
@@ -311,7 +311,7 @@ TEST(WddmPreemptionHeaderTests, givenDevicenotSupportingPreemptionWhenCommandStr
|
||||
}
|
||||
|
||||
TEST_F(WddmCommandStreamTest, givenWdmmWhenSubmitIsCalledAndThrottleIsToLowThenSetHeaderFieldsProperly) {
|
||||
GraphicsAllocation *commandBuffer = memoryManager->allocateGraphicsMemory(4096);
|
||||
GraphicsAllocation *commandBuffer = memoryManager->allocateGraphicsMemoryWithProperties(MockAllocationProperties{MemoryConstants::pageSize});
|
||||
ASSERT_NE(nullptr, commandBuffer);
|
||||
LinearStream cs(commandBuffer);
|
||||
|
||||
@@ -329,7 +329,7 @@ TEST_F(WddmCommandStreamTest, givenWdmmWhenSubmitIsCalledAndThrottleIsToLowThenS
|
||||
}
|
||||
|
||||
TEST_F(WddmCommandStreamTest, givenWdmmWhenSubmitIsCalledAndThrottleIsToMediumThenSetHeaderFieldsProperly) {
|
||||
GraphicsAllocation *commandBuffer = memoryManager->allocateGraphicsMemory(4096);
|
||||
GraphicsAllocation *commandBuffer = memoryManager->allocateGraphicsMemoryWithProperties(MockAllocationProperties{MemoryConstants::pageSize});
|
||||
ASSERT_NE(nullptr, commandBuffer);
|
||||
LinearStream cs(commandBuffer);
|
||||
|
||||
@@ -347,7 +347,7 @@ TEST_F(WddmCommandStreamTest, givenWdmmWhenSubmitIsCalledAndThrottleIsToMediumTh
|
||||
}
|
||||
|
||||
TEST_F(WddmCommandStreamTest, givenWdmmWhenSubmitIsCalledAndThrottleIsToHighThenSetHeaderFieldsProperly) {
|
||||
GraphicsAllocation *commandBuffer = memoryManager->allocateGraphicsMemory(4096);
|
||||
GraphicsAllocation *commandBuffer = memoryManager->allocateGraphicsMemoryWithProperties(MockAllocationProperties{MemoryConstants::pageSize});
|
||||
ASSERT_NE(nullptr, commandBuffer);
|
||||
LinearStream cs(commandBuffer);
|
||||
|
||||
@@ -365,12 +365,12 @@ TEST_F(WddmCommandStreamTest, givenWdmmWhenSubmitIsCalledAndThrottleIsToHighThen
|
||||
}
|
||||
|
||||
TEST_F(WddmCommandStreamTest, givenWddmWithKmDafDisabledWhenFlushIsCalledWithAllocationsForResidencyThenNoneAllocationShouldBeKmDafLocked) {
|
||||
GraphicsAllocation *commandBuffer = memoryManager->allocateGraphicsMemory(4096);
|
||||
GraphicsAllocation *commandBuffer = memoryManager->allocateGraphicsMemoryWithProperties(MockAllocationProperties{MemoryConstants::pageSize});
|
||||
ASSERT_NE(nullptr, commandBuffer);
|
||||
LinearStream cs(commandBuffer);
|
||||
BatchBuffer batchBuffer{cs.getGraphicsAllocation(), 0, 0, nullptr, false, false, QueueThrottle::MEDIUM, cs.getUsed(), &cs};
|
||||
|
||||
auto linearStreamAllocation = memoryManager->allocateGraphicsMemory(sizeof(uint32_t));
|
||||
auto linearStreamAllocation = memoryManager->allocateGraphicsMemoryWithProperties(MockAllocationProperties{MemoryConstants::pageSize});
|
||||
ASSERT_NE(nullptr, linearStreamAllocation);
|
||||
linearStreamAllocation->setAllocationType(GraphicsAllocation::AllocationType::LINEAR_STREAM);
|
||||
ResidencyContainer allocationsForResidency = {linearStreamAllocation};
|
||||
@@ -386,7 +386,7 @@ TEST_F(WddmCommandStreamTest, givenWddmWithKmDafDisabledWhenFlushIsCalledWithAll
|
||||
}
|
||||
|
||||
TEST_F(WddmCommandStreamTest, givenWddmWithKmDafEnabledWhenFlushIsCalledWithoutAllocationsForResidencyThenNoneAllocationShouldBeKmDafLocked) {
|
||||
GraphicsAllocation *commandBuffer = memoryManager->allocateGraphicsMemory(4096);
|
||||
GraphicsAllocation *commandBuffer = memoryManager->allocateGraphicsMemoryWithProperties(MockAllocationProperties{MemoryConstants::pageSize});
|
||||
ASSERT_NE(nullptr, commandBuffer);
|
||||
LinearStream cs(commandBuffer);
|
||||
BatchBuffer batchBuffer{cs.getGraphicsAllocation(), 0, 0, nullptr, false, false, QueueThrottle::MEDIUM, cs.getUsed(), &cs};
|
||||
@@ -401,12 +401,12 @@ TEST_F(WddmCommandStreamTest, givenWddmWithKmDafEnabledWhenFlushIsCalledWithoutA
|
||||
}
|
||||
|
||||
TEST_F(WddmCommandStreamTest, givenWddmWithKmDafEnabledWhenFlushIsCalledWithResidencyAllocationsInMemoryManagerThenLinearStreamAllocationsShouldBeKmDafLocked) {
|
||||
GraphicsAllocation *commandBuffer = memoryManager->allocateGraphicsMemory(4096);
|
||||
GraphicsAllocation *commandBuffer = memoryManager->allocateGraphicsMemoryWithProperties(MockAllocationProperties{MemoryConstants::pageSize});
|
||||
ASSERT_NE(nullptr, commandBuffer);
|
||||
LinearStream cs(commandBuffer);
|
||||
BatchBuffer batchBuffer{cs.getGraphicsAllocation(), 0, 0, nullptr, false, false, QueueThrottle::MEDIUM, cs.getUsed(), &cs};
|
||||
|
||||
auto linearStreamAllocation = memoryManager->allocateGraphicsMemory(sizeof(uint32_t));
|
||||
auto linearStreamAllocation = memoryManager->allocateGraphicsMemoryWithProperties(MockAllocationProperties{MemoryConstants::pageSize});
|
||||
ASSERT_NE(nullptr, linearStreamAllocation);
|
||||
linearStreamAllocation->setAllocationType(GraphicsAllocation::AllocationType::LINEAR_STREAM);
|
||||
|
||||
@@ -426,12 +426,12 @@ TEST_F(WddmCommandStreamTest, givenWddmWithKmDafEnabledWhenFlushIsCalledWithResi
|
||||
}
|
||||
|
||||
TEST_F(WddmCommandStreamTest, givenWddmWithKmDafEnabledWhenFlushIsCalledWithAllocationsForResidencyThenLinearStreamAllocationsShouldBeKmDafLocked) {
|
||||
GraphicsAllocation *commandBuffer = memoryManager->allocateGraphicsMemory(4096);
|
||||
GraphicsAllocation *commandBuffer = memoryManager->allocateGraphicsMemoryWithProperties(MockAllocationProperties{MemoryConstants::pageSize});
|
||||
ASSERT_NE(nullptr, commandBuffer);
|
||||
LinearStream cs(commandBuffer);
|
||||
BatchBuffer batchBuffer{cs.getGraphicsAllocation(), 0, 0, nullptr, false, false, QueueThrottle::MEDIUM, cs.getUsed(), &cs};
|
||||
|
||||
auto linearStreamAllocation = memoryManager->allocateGraphicsMemory(sizeof(uint32_t));
|
||||
auto linearStreamAllocation = memoryManager->allocateGraphicsMemoryWithProperties(MockAllocationProperties{MemoryConstants::pageSize});
|
||||
ASSERT_NE(nullptr, linearStreamAllocation);
|
||||
linearStreamAllocation->setAllocationType(GraphicsAllocation::AllocationType::LINEAR_STREAM);
|
||||
ResidencyContainer allocationsForResidency = {linearStreamAllocation};
|
||||
@@ -448,12 +448,12 @@ TEST_F(WddmCommandStreamTest, givenWddmWithKmDafEnabledWhenFlushIsCalledWithAllo
|
||||
}
|
||||
|
||||
TEST_F(WddmCommandStreamTest, givenWddmWithKmDafEnabledWhenFlushIsCalledWithAllocationsForResidencyThenFillPatternAllocationsShouldBeKmDafLocked) {
|
||||
GraphicsAllocation *commandBuffer = memoryManager->allocateGraphicsMemory(4096);
|
||||
GraphicsAllocation *commandBuffer = memoryManager->allocateGraphicsMemoryWithProperties(MockAllocationProperties{MemoryConstants::pageSize});
|
||||
ASSERT_NE(nullptr, commandBuffer);
|
||||
LinearStream cs(commandBuffer);
|
||||
BatchBuffer batchBuffer{cs.getGraphicsAllocation(), 0, 0, nullptr, false, false, QueueThrottle::MEDIUM, cs.getUsed(), &cs};
|
||||
|
||||
auto fillPatternAllocation = memoryManager->allocateGraphicsMemory(sizeof(uint32_t));
|
||||
auto fillPatternAllocation = memoryManager->allocateGraphicsMemoryWithProperties(MockAllocationProperties{MemoryConstants::pageSize});
|
||||
ASSERT_NE(nullptr, fillPatternAllocation);
|
||||
fillPatternAllocation->setAllocationType(GraphicsAllocation::AllocationType::FILL_PATTERN);
|
||||
ResidencyContainer allocationsForResidency = {fillPatternAllocation};
|
||||
@@ -470,12 +470,12 @@ TEST_F(WddmCommandStreamTest, givenWddmWithKmDafEnabledWhenFlushIsCalledWithAllo
|
||||
}
|
||||
|
||||
TEST_F(WddmCommandStreamTest, givenWddmWithKmDafEnabledWhenFlushIsCalledWithAllocationsForResidencyThenNonLinearStreamAllocationShouldNotBeKmDafLocked) {
|
||||
GraphicsAllocation *commandBuffer = memoryManager->allocateGraphicsMemory(4096);
|
||||
GraphicsAllocation *commandBuffer = memoryManager->allocateGraphicsMemoryWithProperties(MockAllocationProperties{MemoryConstants::pageSize});
|
||||
ASSERT_NE(nullptr, commandBuffer);
|
||||
LinearStream cs(commandBuffer);
|
||||
BatchBuffer batchBuffer{cs.getGraphicsAllocation(), 0, 0, nullptr, false, false, QueueThrottle::MEDIUM, cs.getUsed(), &cs};
|
||||
|
||||
auto nonLinearStreamAllocation = memoryManager->allocateGraphicsMemory(sizeof(uint32_t));
|
||||
auto nonLinearStreamAllocation = memoryManager->allocateGraphicsMemoryWithProperties(MockAllocationProperties{MemoryConstants::pageSize});
|
||||
ASSERT_NE(nullptr, nonLinearStreamAllocation);
|
||||
ResidencyContainer allocationsForResidency = {nonLinearStreamAllocation};
|
||||
|
||||
@@ -492,7 +492,7 @@ TEST_F(WddmCommandStreamTest, givenWddmWithKmDafEnabledWhenFlushIsCalledWithAllo
|
||||
TEST_F(WddmCommandStreamTest, makeResident) {
|
||||
WddmMemoryManager *wddmMM = reinterpret_cast<WddmMemoryManager *>(memoryManager);
|
||||
|
||||
GraphicsAllocation *commandBuffer = memoryManager->allocateGraphicsMemory(4096);
|
||||
GraphicsAllocation *commandBuffer = memoryManager->allocateGraphicsMemoryWithProperties(MockAllocationProperties{MemoryConstants::pageSize});
|
||||
ASSERT_NE(nullptr, commandBuffer);
|
||||
LinearStream cs(commandBuffer);
|
||||
|
||||
@@ -508,7 +508,7 @@ TEST_F(WddmCommandStreamTest, makeResident) {
|
||||
TEST_F(WddmCommandStreamTest, makeNonResidentPutsAllocationInEvictionAllocations) {
|
||||
WddmMemoryManager *wddmMM = reinterpret_cast<WddmMemoryManager *>(memoryManager);
|
||||
|
||||
GraphicsAllocation *commandBuffer = memoryManager->allocateGraphicsMemory(4096);
|
||||
GraphicsAllocation *commandBuffer = memoryManager->allocateGraphicsMemoryWithProperties(MockAllocationProperties{MemoryConstants::pageSize});
|
||||
ASSERT_NE(nullptr, commandBuffer);
|
||||
LinearStream cs(commandBuffer);
|
||||
|
||||
@@ -524,8 +524,8 @@ TEST_F(WddmCommandStreamTest, makeNonResidentPutsAllocationInEvictionAllocations
|
||||
TEST_F(WddmCommandStreamTest, processEvictionPlacesAllAllocationsOnTrimCandidateList) {
|
||||
WddmMemoryManager *wddmMM = reinterpret_cast<WddmMemoryManager *>(memoryManager);
|
||||
|
||||
GraphicsAllocation *allocation = memoryManager->allocateGraphicsMemory(4096);
|
||||
GraphicsAllocation *allocation2 = memoryManager->allocateGraphicsMemory(4096);
|
||||
GraphicsAllocation *allocation = memoryManager->allocateGraphicsMemoryWithProperties(MockAllocationProperties{MemoryConstants::pageSize});
|
||||
GraphicsAllocation *allocation2 = memoryManager->allocateGraphicsMemoryWithProperties(MockAllocationProperties{MemoryConstants::pageSize});
|
||||
ASSERT_NE(nullptr, allocation);
|
||||
ASSERT_NE(nullptr, allocation2);
|
||||
|
||||
@@ -545,7 +545,7 @@ TEST_F(WddmCommandStreamTest, processEvictionPlacesAllAllocationsOnTrimCandidate
|
||||
TEST_F(WddmCommandStreamTest, processEvictionClearsEvictionAllocations) {
|
||||
WddmMemoryManager *wddmMM = reinterpret_cast<WddmMemoryManager *>(memoryManager);
|
||||
|
||||
GraphicsAllocation *allocation = memoryManager->allocateGraphicsMemory(4096);
|
||||
GraphicsAllocation *allocation = memoryManager->allocateGraphicsMemoryWithProperties(MockAllocationProperties{MemoryConstants::pageSize});
|
||||
ASSERT_NE(nullptr, allocation);
|
||||
|
||||
csr->getEvictionAllocations().push_back(allocation);
|
||||
@@ -560,7 +560,7 @@ TEST_F(WddmCommandStreamTest, processEvictionClearsEvictionAllocations) {
|
||||
}
|
||||
|
||||
TEST_F(WddmCommandStreamTest, makeResidentNonResidentMemObj) {
|
||||
GraphicsAllocation *gfxAllocation = memoryManager->allocateGraphicsMemory(256);
|
||||
GraphicsAllocation *gfxAllocation = memoryManager->allocateGraphicsMemoryWithProperties(MockAllocationProperties{MemoryConstants::pageSize});
|
||||
Buffer *buffer = new AlignedBuffer(gfxAllocation);
|
||||
WddmMemoryManager *wddmMM = reinterpret_cast<WddmMemoryManager *>(memoryManager);
|
||||
|
||||
@@ -645,7 +645,7 @@ TEST_F(WddmCommandStreamTest, givenTwoTemporaryAllocationsWhenCleanTemporaryAllo
|
||||
}
|
||||
|
||||
TEST_F(WddmCommandStreamMockGdiTest, FlushCallsWddmMakeResidentForResidencyAllocations) {
|
||||
GraphicsAllocation *commandBuffer = memoryManager->allocateGraphicsMemory(4096);
|
||||
GraphicsAllocation *commandBuffer = memoryManager->allocateGraphicsMemoryWithProperties(MockAllocationProperties{MemoryConstants::pageSize});
|
||||
ASSERT_NE(nullptr, commandBuffer);
|
||||
LinearStream cs(commandBuffer);
|
||||
|
||||
@@ -664,7 +664,7 @@ TEST_F(WddmCommandStreamMockGdiTest, FlushCallsWddmMakeResidentForResidencyAlloc
|
||||
}
|
||||
|
||||
TEST_F(WddmCommandStreamMockGdiTest, makeResidentClearsResidencyAllocations) {
|
||||
GraphicsAllocation *commandBuffer = memoryManager->allocateGraphicsMemory(4096);
|
||||
GraphicsAllocation *commandBuffer = memoryManager->allocateGraphicsMemoryWithProperties(MockAllocationProperties{MemoryConstants::pageSize});
|
||||
ASSERT_NE(nullptr, commandBuffer);
|
||||
LinearStream cs(commandBuffer);
|
||||
|
||||
@@ -694,7 +694,7 @@ HWTEST_F(WddmCommandStreamMockGdiTest, givenRecordedCommandBufferWhenItIsSubmitt
|
||||
if (device->getPreemptionMode() == PreemptionMode::MidThread) {
|
||||
csrSurfaceCount = 2;
|
||||
tmpAllocation = GlobalMockSipProgram::sipProgram->getAllocation();
|
||||
GlobalMockSipProgram::sipProgram->resetAllocation(memoryManager->allocateGraphicsMemory(1024));
|
||||
GlobalMockSipProgram::sipProgram->resetAllocation(memoryManager->allocateGraphicsMemoryWithProperties(MockAllocationProperties{MemoryConstants::pageSize}));
|
||||
}
|
||||
|
||||
csr->overrideDispatchPolicy(DispatchMode::BatchedDispatch);
|
||||
@@ -702,10 +702,10 @@ HWTEST_F(WddmCommandStreamMockGdiTest, givenRecordedCommandBufferWhenItIsSubmitt
|
||||
auto mockedSubmissionsAggregator = new mockSubmissionsAggregator();
|
||||
csr->overrideSubmissionAggregator(mockedSubmissionsAggregator);
|
||||
|
||||
auto commandBuffer = memoryManager->allocateGraphicsMemory(1024);
|
||||
auto dshAlloc = memoryManager->allocateGraphicsMemory(1024);
|
||||
auto iohAlloc = memoryManager->allocateGraphicsMemory(1024);
|
||||
auto sshAlloc = memoryManager->allocateGraphicsMemory(1024);
|
||||
auto commandBuffer = memoryManager->allocateGraphicsMemoryWithProperties(MockAllocationProperties{MemoryConstants::pageSize});
|
||||
auto dshAlloc = memoryManager->allocateGraphicsMemoryWithProperties(MockAllocationProperties{MemoryConstants::pageSize});
|
||||
auto iohAlloc = memoryManager->allocateGraphicsMemoryWithProperties(MockAllocationProperties{MemoryConstants::pageSize});
|
||||
auto sshAlloc = memoryManager->allocateGraphicsMemoryWithProperties(MockAllocationProperties{MemoryConstants::pageSize});
|
||||
|
||||
auto tagAllocation = csr->getTagAllocation();
|
||||
csr->setPreemptionCsrAllocation(preemptionAllocation);
|
||||
@@ -890,7 +890,7 @@ HWTEST_F(WddmCsrCompressionTests, givenEnabledCompressionWhenFlushingThenInitTra
|
||||
|
||||
auto &csrCS = mockWddmCsr->getCS();
|
||||
|
||||
auto graphicsAllocation = memoryManager->allocateGraphicsMemory(1024);
|
||||
auto graphicsAllocation = memoryManager->allocateGraphicsMemoryWithProperties(MockAllocationProperties{MemoryConstants::pageSize});
|
||||
IndirectHeap cs(graphicsAllocation);
|
||||
|
||||
EXPECT_FALSE(mockWddmCsr->pageTableManagerInitialized);
|
||||
@@ -931,7 +931,7 @@ HWTEST_F(WddmCsrCompressionTests, givenDisabledCompressionWhenFlushingThenDontIn
|
||||
|
||||
EXPECT_EQ(nullptr, myMockWddm->getPageTableManager());
|
||||
|
||||
auto graphicsAllocation = memoryManager->allocateGraphicsMemory(1024);
|
||||
auto graphicsAllocation = memoryManager->allocateGraphicsMemoryWithProperties(MockAllocationProperties{MemoryConstants::pageSize});
|
||||
IndirectHeap cs(graphicsAllocation);
|
||||
|
||||
EXPECT_FALSE(mockWddmCsr->pageTableManagerInitialized);
|
||||
|
||||
@@ -15,6 +15,7 @@ class MockWddmMemoryManager : public WddmMemoryManager {
|
||||
using BaseClass = WddmMemoryManager;
|
||||
|
||||
public:
|
||||
using BaseClass::allocateGraphicsMemory;
|
||||
using BaseClass::allocateGraphicsMemory64kb;
|
||||
using BaseClass::createWddmAllocation;
|
||||
using BaseClass::WddmMemoryManager;
|
||||
|
||||
@@ -114,9 +114,8 @@ TEST(WddmMemoryManagerWithDeferredDeleterTest, givenWMMWhenAsyncDeleterIsEnabled
|
||||
|
||||
TEST_F(WddmMemoryManagerSimpleTest, givenMemoryManagerWhenAllocateGraphicsMemoryIsCalledThenMemoryPoolIsSystem4KBPages) {
|
||||
memoryManager.reset(new MockWddmMemoryManager(false, false, wddm, executionEnvironment));
|
||||
auto size = 4096u;
|
||||
|
||||
auto allocation = memoryManager->allocateGraphicsMemory(size);
|
||||
auto allocation = memoryManager->allocateGraphicsMemoryWithProperties(MockAllocationProperties{MemoryConstants::pageSize});
|
||||
EXPECT_NE(nullptr, allocation);
|
||||
EXPECT_EQ(MemoryPool::System4KBPages, allocation->getMemoryPool());
|
||||
EXPECT_TRUE(allocation->gmm->useSystemMemoryPool);
|
||||
@@ -225,12 +224,6 @@ TEST_F(WddmMemoryManagerTest,
|
||||
memoryManager->freeGraphicsMemory(allocation);
|
||||
}
|
||||
|
||||
TEST_F(WddmMemoryManagerTest, AllocateAndFree) {
|
||||
auto *ptr = memoryManager->allocateGraphicsMemory(0x1000);
|
||||
EXPECT_NE(nullptr, ptr);
|
||||
memoryManager->freeGraphicsMemory(ptr);
|
||||
}
|
||||
|
||||
TEST_F(WddmMemoryManagerTest, givenDefaultWddmMemoryManagerWhenAskedForVirtualPaddingSupportThenFalseIsReturned) {
|
||||
EXPECT_FALSE(memoryManager->peekVirtualPaddingSupport());
|
||||
}
|
||||
@@ -288,7 +281,7 @@ TEST_F(WddmMemoryManagerTest, AllocateGpuMemHostPtr) {
|
||||
}
|
||||
|
||||
TEST_F(WddmMemoryManagerTest, givenDefaultMemoryManagerWhenAllocateWithSizeIsCalledThenResourceHandleIsZero) {
|
||||
auto *gpuAllocation = memoryManager->allocateGraphicsMemory(0x1000);
|
||||
auto *gpuAllocation = memoryManager->allocateGraphicsMemoryWithProperties(MockAllocationProperties{MemoryConstants::pageSize});
|
||||
|
||||
auto wddmAllocation = static_cast<WddmAllocation *>(gpuAllocation);
|
||||
|
||||
@@ -331,7 +324,7 @@ TEST_F(WddmMemoryManagerTest, givenWddmMemoryManagerWhenCreateFromNTHandleIsCall
|
||||
}
|
||||
|
||||
TEST_F(WddmMemoryManagerTest, givenWddmMemoryManagerWhenLockUnlockIsCalledThenReturnPtr) {
|
||||
auto alloc = memoryManager->allocateGraphicsMemory(1);
|
||||
auto alloc = memoryManager->allocateGraphicsMemoryWithProperties(MockAllocationProperties{MemoryConstants::pageSize});
|
||||
|
||||
auto ptr = memoryManager->lockResource(alloc);
|
||||
EXPECT_NE(nullptr, ptr);
|
||||
@@ -1151,7 +1144,7 @@ TEST_F(MockWddmMemoryManagerTest, givenEnabled64kbpagesWhenCreatingGraphicsMemor
|
||||
WddmMemoryManager memoryManager64k(true, false, wddm.get(), executionEnvironment);
|
||||
EXPECT_EQ(0, wddm->createAllocationResult.called);
|
||||
|
||||
GraphicsAllocation *galloc = memoryManager64k.allocateGraphicsMemoryInPreferredPool(AllocationProperties(true, MemoryConstants::pageSize64k), 0, nullptr, GraphicsAllocation::AllocationType::BUFFER_HOST_MEMORY);
|
||||
GraphicsAllocation *galloc = memoryManager64k.allocateGraphicsMemoryWithProperties(MockAllocationProperties{MemoryConstants::pageSize64k, GraphicsAllocation::AllocationType::BUFFER_HOST_MEMORY});
|
||||
EXPECT_EQ(1, wddm->createAllocationResult.called);
|
||||
EXPECT_NE(nullptr, galloc);
|
||||
EXPECT_EQ(true, galloc->isLocked());
|
||||
@@ -1252,7 +1245,7 @@ TEST_F(MockWddmMemoryManagerTest, givenPageTableManagerWhenMapAuxGpuVaCalledThen
|
||||
auto mockMngr = new NiceMock<MockGmmPageTableMngr>();
|
||||
myWddm->resetPageTableManager(mockMngr);
|
||||
|
||||
auto allocation = memoryManager.allocateGraphicsMemory(4096);
|
||||
auto allocation = memoryManager.allocateGraphicsMemoryWithProperties(MockAllocationProperties{MemoryConstants::pageSize});
|
||||
|
||||
GMM_DDI_UPDATEAUXTABLE givenDdiUpdateAuxTable = {};
|
||||
GMM_DDI_UPDATEAUXTABLE expectedDdiUpdateAuxTable = {};
|
||||
@@ -1313,7 +1306,7 @@ TEST_F(MockWddmMemoryManagerTest, givenRenderCompressedAllocationWhenReleaseingT
|
||||
auto mockMngr = new NiceMock<MockGmmPageTableMngr>();
|
||||
wddm->resetPageTableManager(mockMngr);
|
||||
|
||||
auto wddmAlloc = static_cast<WddmAllocation *>(memoryManager.allocateGraphicsMemory(4096u));
|
||||
auto wddmAlloc = static_cast<WddmAllocation *>(memoryManager.allocateGraphicsMemoryWithProperties(MockAllocationProperties{MemoryConstants::pageSize}));
|
||||
wddmAlloc->gpuPtr = gpuVa;
|
||||
wddmAlloc->gmm->isRenderCompressed = true;
|
||||
|
||||
@@ -1338,7 +1331,7 @@ TEST_F(MockWddmMemoryManagerTest, givenNonRenderCompressedAllocationWhenReleasei
|
||||
auto mockMngr = new NiceMock<MockGmmPageTableMngr>();
|
||||
wddm->resetPageTableManager(mockMngr);
|
||||
|
||||
auto wddmAlloc = static_cast<WddmAllocation *>(memoryManager.allocateGraphicsMemory(4096u));
|
||||
auto wddmAlloc = static_cast<WddmAllocation *>(memoryManager.allocateGraphicsMemoryWithProperties(MockAllocationProperties{MemoryConstants::pageSize}));
|
||||
wddmAlloc->gmm->isRenderCompressed = false;
|
||||
|
||||
EXPECT_CALL(*mockMngr, updateAuxTable(_)).Times(0);
|
||||
@@ -1386,7 +1379,7 @@ TEST_F(MockWddmMemoryManagerTest, givenRenderCompressedFlagSetWhenInternalIsUnse
|
||||
myGmm->isRenderCompressed = false;
|
||||
myGmm->gmmResourceInfo->getResourceFlags()->Info.RenderCompressed = 1;
|
||||
|
||||
auto wddmAlloc = static_cast<WddmAllocation *>(memoryManager.allocateGraphicsMemory(4096u));
|
||||
auto wddmAlloc = static_cast<WddmAllocation *>(memoryManager.allocateGraphicsMemoryWithProperties(MockAllocationProperties{MemoryConstants::pageSize}));
|
||||
delete wddmAlloc->gmm;
|
||||
wddmAlloc->gmm = myGmm;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user