Remove handleId from DrmCommandStreamReceiver

pass it as a function argument

Resolves: NEO-3856
Change-Id: I796ca1236ead97d179aefa0684c1234452c94744
Signed-off-by: Jablonski, Mateusz <mateusz.jablonski@intel.com>
This commit is contained in:
Jablonski, Mateusz
2020-02-03 17:50:53 +01:00
committed by sys_ocldev
parent 124a598677
commit 5de70b9416
22 changed files with 64 additions and 65 deletions

View File

@@ -105,7 +105,7 @@ TEST_F(AUBcommandstreamTests, makeResident) {
auto &commandStreamReceiver = pDevice->getGpgpuCommandStreamReceiver();
auto graphicsAllocation = createResidentAllocationAndStoreItInCsr(buffer, size);
ResidencyContainer allocationsForResidency = {graphicsAllocation};
commandStreamReceiver.processResidency(allocationsForResidency);
commandStreamReceiver.processResidency(allocationsForResidency, 0u);
}
HWTEST_F(AUBcommandstreamTests, expectMemorySingle) {
@@ -113,7 +113,7 @@ HWTEST_F(AUBcommandstreamTests, expectMemorySingle) {
size_t size = sizeof(buffer);
auto graphicsAllocation = createResidentAllocationAndStoreItInCsr(&buffer, size);
ResidencyContainer allocationsForResidency = {graphicsAllocation};
pCommandStreamReceiver->processResidency(allocationsForResidency);
pCommandStreamReceiver->processResidency(allocationsForResidency, 0u);
AUBCommandStreamFixture::expectMemory<FamilyType>(&buffer, &buffer, size);
}
@@ -128,7 +128,7 @@ HWTEST_F(AUBcommandstreamTests, expectMemoryLarge) {
auto graphicsAllocation = createResidentAllocationAndStoreItInCsr(buffer, sizeBuffer);
ResidencyContainer allocationsForResidency = {graphicsAllocation};
pCommandStreamReceiver->processResidency(allocationsForResidency);
pCommandStreamReceiver->processResidency(allocationsForResidency, 0u);
AUBCommandStreamFixture::expectMemory<FamilyType>(buffer, buffer, sizeBuffer);
delete[] buffer;

View File

@@ -299,7 +299,7 @@ HWTEST_F(AubCommandStreamReceiverTests, givenAubCommandStreamReceiverInSubCaptur
MockGraphicsAllocation allocation(reinterpret_cast<void *>(0x1000), 0x1000);
ResidencyContainer allocationsForResidency = {&allocation};
aubCsr->processResidency(allocationsForResidency);
aubCsr->processResidency(allocationsForResidency, 0u);
EXPECT_FALSE(aubCsr->writeMemoryCalled);
}
@@ -322,7 +322,7 @@ HWTEST_F(AubCommandStreamReceiverTests, givenAubCommandStreamReceiverInSubCaptur
MockGraphicsAllocation allocation(reinterpret_cast<void *>(0x1000), 0);
ResidencyContainer allocationsForResidency = {&allocation};
aubCsr->processResidency(allocationsForResidency);
aubCsr->processResidency(allocationsForResidency, 0u);
EXPECT_FALSE(aubCsr->writeMemoryCalled);
}
@@ -708,7 +708,7 @@ HWTEST_F(AubCommandStreamReceiverTests, givenAubCommandStreamReceiverWhenProcess
auto gfxDefaultAllocation = memoryManager->allocateGraphicsMemoryWithProperties(MockAllocationProperties{MemoryConstants::pageSize});
ResidencyContainer allocationsForResidency = {gfxDefaultAllocation};
aubCsr->processResidency(allocationsForResidency);
aubCsr->processResidency(allocationsForResidency, 0u);
EXPECT_TRUE(aubCsr->isAubWritable(*gfxDefaultAllocation));
@@ -760,7 +760,7 @@ HWTEST_F(AubCommandStreamReceiverTests, givenAubCommandStreamReceiverWhenProcess
auto gfxImageAllocation = MockGmm::allocateImage2d(*memoryManager);
ResidencyContainer allocationsForResidency = {gfxBufferAllocation, gfxImageAllocation};
aubCsr->processResidency(allocationsForResidency);
aubCsr->processResidency(allocationsForResidency, 0u);
EXPECT_FALSE(aubCsr->isAubWritable(*gfxBufferAllocation));
EXPECT_FALSE(aubCsr->isAubWritable(*gfxImageAllocation));
@@ -785,7 +785,7 @@ HWTEST_F(AubCommandStreamReceiverTests, givenAubCommandStreamReceiverInSubCaptur
aubCsr->dumpAubNonWritable = true;
ResidencyContainer allocationsForResidency = {gfxBufferAllocation, gfxImageAllocation};
aubCsr->processResidency(allocationsForResidency);
aubCsr->processResidency(allocationsForResidency, 0u);
EXPECT_TRUE(aubCsr->isAubWritable(*gfxBufferAllocation));
EXPECT_TRUE(aubCsr->isAubWritable(*gfxImageAllocation));
@@ -810,7 +810,7 @@ HWTEST_F(AubCommandStreamReceiverTests, givenAubCommandStreamReceiverWhenProcess
aubCsr->dumpAubNonWritable = false;
ResidencyContainer allocationsForResidency = {gfxBufferAllocation, gfxImageAllocation};
aubCsr->processResidency(allocationsForResidency);
aubCsr->processResidency(allocationsForResidency, 0u);
EXPECT_FALSE(aubCsr->isAubWritable(*gfxBufferAllocation));
EXPECT_FALSE(aubCsr->isAubWritable(*gfxImageAllocation));

View File

@@ -1,5 +1,5 @@
/*
* Copyright (C) 2018-2019 Intel Corporation
* Copyright (C) 2018-2020 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
@@ -624,7 +624,7 @@ HWTEST_F(AubCommandStreamReceiverTests, givenAubCommandStreamReceiverWhenProcess
ASSERT_EQ(1u, aubCsr->externalAllocations.size());
ResidencyContainer allocationsForResidency;
aubCsr->processResidency(allocationsForResidency);
aubCsr->processResidency(allocationsForResidency, 0u);
EXPECT_TRUE(aubCsr->writeMemoryParametrization.wasCalled);
EXPECT_EQ(addr, aubCsr->writeMemoryParametrization.receivedAllocationView.first);
@@ -639,7 +639,7 @@ HWTEST_F(AubCommandStreamReceiverTests, givenAubCommandStreamReceiverWhenProcess
ASSERT_EQ(1u, aubCsr->externalAllocations.size());
ResidencyContainer allocationsForResidency;
aubCsr->processResidency(allocationsForResidency);
aubCsr->processResidency(allocationsForResidency, 0u);
EXPECT_TRUE(aubCsr->writeMemoryParametrization.wasCalled);
EXPECT_EQ(0u, aubCsr->writeMemoryParametrization.receivedAllocationView.first);

View File

@@ -543,7 +543,7 @@ HWTEST_F(AubFileStreamTests, givenAubCommandStreamReceiverWhenMakeResidentIsCall
MockGraphicsAllocation allocation(reinterpret_cast<void *>(0x1000), 0x1000);
ResidencyContainer allocationsForResidency = {&allocation};
aubCsr->processResidency(allocationsForResidency);
aubCsr->processResidency(allocationsForResidency, 0u);
EXPECT_TRUE(aubCsr->writeMemoryCalled);
}
@@ -619,7 +619,7 @@ HWTEST_F(AubFileStreamTests, givenAubCommandStreamReceiverWhenMakeResidentIsCall
MockGraphicsAllocation allocation(reinterpret_cast<void *>(0x1000), 0x1000);
ResidencyContainer allocationsForResidency = {&allocation};
aubCsr.processResidency(allocationsForResidency);
aubCsr.processResidency(allocationsForResidency, 0u);
EXPECT_TRUE(aubCsr.writeMemoryWithAubManagerCalled);
}

View File

@@ -200,7 +200,7 @@ TEST_F(CommandStreamReceiverTest, WhenMakingResidentThenAllocationIsPushedToMemo
}
TEST_F(CommandStreamReceiverTest, GivenNoParamatersWhenMakingResidentThenResidencyDoesNotOccur) {
commandStreamReceiver->processResidency(commandStreamReceiver->getResidencyAllocations());
commandStreamReceiver->processResidency(commandStreamReceiver->getResidencyAllocations(), 0u);
auto &residencyAllocations = commandStreamReceiver->getResidencyAllocations();
EXPECT_EQ(0u, residencyAllocations.size());
}

View File

@@ -40,7 +40,7 @@ struct MyMockCsr : UltCommandStreamReceiver<DEFAULT_TEST_FAMILY_NAME> {
flushParametrization.receivedBatchBuffer = &batchBuffer;
flushParametrization.receivedEngine = osContext->getEngineType();
flushParametrization.receivedAllocationsForResidency = &allocationsForResidency;
processResidency(allocationsForResidency);
processResidency(allocationsForResidency, 0u);
flushStamp->setStamp(flushParametrization.flushStampToReturn);
return true;
}
@@ -51,7 +51,7 @@ struct MyMockCsr : UltCommandStreamReceiver<DEFAULT_TEST_FAMILY_NAME> {
gfxAllocation.updateResidencyTaskCount(1, osContext->getContextId());
}
void processResidency(const ResidencyContainer &allocationsForResidency) override {
void processResidency(const ResidencyContainer &allocationsForResidency, uint32_t handleId) override {
processResidencyParameterization.wasCalled = true;
processResidencyParameterization.receivedAllocationsForResidency = &allocationsForResidency;
}

View File

@@ -276,7 +276,7 @@ HWTEST_F(TbxCommandStreamTests, givenTbxCommandStreamReceiverWhenProcessResidenc
EXPECT_FALSE(graphicsAllocation->isResident(tbxCsr->getOsContext().getContextId()));
ResidencyContainer allocationsForResidency = {graphicsAllocation};
tbxCsr->processResidency(allocationsForResidency);
tbxCsr->processResidency(allocationsForResidency, 0u);
EXPECT_TRUE(graphicsAllocation->isResident(tbxCsr->getOsContext().getContextId()));
EXPECT_EQ(tbxCsr->peekTaskCount() + 1, graphicsAllocation->getResidencyTaskCount(tbxCsr->getOsContext().getContextId()));
@@ -295,7 +295,7 @@ HWTEST_F(TbxCommandStreamTests, givenTbxCommandStreamReceiverWhenProcessResidenc
EXPECT_FALSE(graphicsAllocation->isResident(tbxCsr->getOsContext().getContextId()));
ResidencyContainer allocationsForResidency = {graphicsAllocation};
tbxCsr->processResidency(allocationsForResidency);
tbxCsr->processResidency(allocationsForResidency, 0u);
EXPECT_TRUE(graphicsAllocation->isResident(tbxCsr->getOsContext().getContextId()));
EXPECT_EQ(tbxCsr->peekTaskCount() + 1, graphicsAllocation->getResidencyTaskCount(tbxCsr->getOsContext().getContextId()));
@@ -522,7 +522,7 @@ HWTEST_F(TbxCommandStreamTests, givenTbxCommandStreamReceiverWhenMakeResidentIsC
MockGraphicsAllocation allocation(reinterpret_cast<void *>(0x1000), 0x1000);
ResidencyContainer allocationsForResidency = {&allocation};
tbxCsr.processResidency(allocationsForResidency);
tbxCsr.processResidency(allocationsForResidency, 0u);
EXPECT_TRUE(tbxCsr.writeMemoryWithAubManagerCalled);
}
@@ -788,7 +788,7 @@ HWTEST_F(TbxCommandStreamTests, givenTbxCsrWhenProcessResidencyIsCalledWithDumpT
tbxCsr->dumpTbxNonWritable = true;
ResidencyContainer allocationsForResidency = {gfxAllocation};
tbxCsr->processResidency(allocationsForResidency);
tbxCsr->processResidency(allocationsForResidency, 0u);
EXPECT_TRUE(tbxCsr->isTbxWritable(*gfxAllocation));
EXPECT_FALSE(tbxCsr->dumpTbxNonWritable);
@@ -808,7 +808,7 @@ HWTEST_F(TbxCommandStreamTests, givenTbxCsrWhenProcessResidencyIsCalledWithoutDu
EXPECT_FALSE(tbxCsr->dumpTbxNonWritable);
ResidencyContainer allocationsForResidency = {gfxAllocation};
tbxCsr->processResidency(allocationsForResidency);
tbxCsr->processResidency(allocationsForResidency, 0u);
EXPECT_FALSE(tbxCsr->isTbxWritable(*gfxAllocation));
EXPECT_FALSE(tbxCsr->dumpTbxNonWritable);

View File

@@ -122,7 +122,7 @@ class DrmCommandStreamEnhancedTest : public ::testing::Test {
template <typename GfxFamily>
void makeResidentBufferObjects(const DrmAllocation *drmAllocation) {
static_cast<TestedDrmCommandStreamReceiver<GfxFamily> *>(csr)->makeResidentBufferObjects(drmAllocation);
static_cast<TestedDrmCommandStreamReceiver<GfxFamily> *>(csr)->makeResidentBufferObjects(drmAllocation, 0u);
}
template <typename GfxFamily>

View File

@@ -565,7 +565,7 @@ HWTEST_TEMPLATED_F(DrmCommandStreamEnhancedTest, givenGemCloseWorkerInactiveMode
csr->makeResident(*dummyAllocation);
EXPECT_EQ(1u, bo->getRefCount());
csr->processResidency(csr->getResidencyAllocations());
csr->processResidency(csr->getResidencyAllocations(), 0u);
csr->makeNonResident(*dummyAllocation);
EXPECT_EQ(1u, bo->getRefCount());
@@ -585,7 +585,7 @@ HWTEST_TEMPLATED_F(DrmCommandStreamEnhancedTest, GivenTwoAllocationsWhenBackingS
EXPECT_TRUE(allocation->isResident(osContextId));
EXPECT_TRUE(allocation2->isResident(osContextId));
csr->processResidency(csr->getResidencyAllocations());
csr->processResidency(csr->getResidencyAllocations(), 0u);
EXPECT_TRUE(allocation->isResident(osContextId));
EXPECT_TRUE(allocation2->isResident(osContextId));
@@ -840,7 +840,7 @@ HWTEST_TEMPLATED_F(DrmCommandStreamEnhancedTest, makeResident) {
EXPECT_EQ(nullptr, allocation->getUnderlyingBuffer());
csr->makeResident(*allocation);
csr->processResidency(csr->getResidencyAllocations());
csr->processResidency(csr->getResidencyAllocations(), 0u);
EXPECT_TRUE(isResident<FamilyType>(buffer));
EXPECT_EQ(1u, buffer->getRefCount());
@@ -861,7 +861,7 @@ HWTEST_TEMPLATED_F(DrmCommandStreamEnhancedTest, makeResidentOnly) {
csr->makeResident(*allocation1);
csr->makeResident(*allocation2);
csr->processResidency(csr->getResidencyAllocations());
csr->processResidency(csr->getResidencyAllocations(), 0u);
EXPECT_TRUE(isResident<FamilyType>(buffer1));
EXPECT_TRUE(isResident<FamilyType>(buffer2));
@@ -881,14 +881,14 @@ HWTEST_TEMPLATED_F(DrmCommandStreamEnhancedTest, makeResidentTwice) {
auto allocation = new DrmAllocation(0, GraphicsAllocation::AllocationType::UNKNOWN, buffer, nullptr, buffer->peekSize(), (osHandle)0u, MemoryPool::MemoryNull);
csr->makeResident(*allocation);
csr->processResidency(csr->getResidencyAllocations());
csr->processResidency(csr->getResidencyAllocations(), 0u);
EXPECT_TRUE(isResident<FamilyType>(buffer));
EXPECT_EQ(1u, buffer->getRefCount());
csr->getResidencyAllocations().clear();
csr->makeResident(*allocation);
csr->processResidency(csr->getResidencyAllocations());
csr->processResidency(csr->getResidencyAllocations(), 0u);
EXPECT_TRUE(isResident<FamilyType>(buffer));
EXPECT_EQ(1u, buffer->getRefCount());
@@ -910,7 +910,7 @@ HWTEST_TEMPLATED_F(DrmCommandStreamEnhancedTest, makeResidentTwiceWhenFragmentSt
csr->makeResident(*allocation);
csr->makeResident(*allocation);
csr->processResidency(csr->getResidencyAllocations());
csr->processResidency(csr->getResidencyAllocations(), 0u);
for (int i = 0; i < maxFragmentsCount; i++) {
ASSERT_EQ(allocation->fragmentsStorage.fragmentStorageData[i].cpuPtr,
reqs.allocationFragments[i].allocationPtr);
@@ -946,7 +946,7 @@ HWTEST_TEMPLATED_F(DrmCommandStreamEnhancedTest, givenFragmentedAllocationsWithR
csr->makeResident(*graphicsAllocation);
csr->makeResident(*graphicsAllocation2);
csr->processResidency(csr->getResidencyAllocations());
csr->processResidency(csr->getResidencyAllocations(), 0u);
auto &osContext = csr->getOsContext();
@@ -972,7 +972,7 @@ HWTEST_TEMPLATED_F(DrmCommandStreamEnhancedTest, givenFragmentedAllocationsWithR
csr->makeResident(*graphicsAllocation);
csr->makeResident(*graphicsAllocation2);
csr->processResidency(csr->getResidencyAllocations());
csr->processResidency(csr->getResidencyAllocations(), 0u);
EXPECT_TRUE(graphicsAllocation->fragmentsStorage.fragmentStorageData[0].residency->resident[osContext.getContextId()]);
EXPECT_TRUE(graphicsAllocation->fragmentsStorage.fragmentStorageData[1].residency->resident[osContext.getContextId()]);
@@ -1005,7 +1005,7 @@ HWTEST_TEMPLATED_F(DrmCommandStreamEnhancedTest, GivenAllocationCreatedFromThree
ASSERT_EQ(3u, allocation->fragmentsStorage.fragmentCount);
csr->makeResident(*allocation);
csr->processResidency(csr->getResidencyAllocations());
csr->processResidency(csr->getResidencyAllocations(), 0u);
for (int i = 0; i < maxFragmentsCount; i++) {
ASSERT_EQ(allocation->fragmentsStorage.fragmentStorageData[i].cpuPtr,
@@ -1036,7 +1036,7 @@ HWTEST_TEMPLATED_F(DrmCommandStreamEnhancedTest, GivenAllocationsContainingDiffe
ASSERT_EQ(2u, reqs.requiredFragmentsCount);
csr->makeResident(*allocation);
csr->processResidency(csr->getResidencyAllocations());
csr->processResidency(csr->getResidencyAllocations(), 0u);
for (unsigned int i = 0; i < reqs.requiredFragmentsCount; i++) {
ASSERT_EQ(allocation->fragmentsStorage.fragmentStorageData[i].cpuPtr,
@@ -1061,7 +1061,7 @@ HWTEST_TEMPLATED_F(DrmCommandStreamEnhancedTest, GivenAllocationsContainingDiffe
ASSERT_EQ(1u, reqs.requiredFragmentsCount);
csr->makeResident(*allocation2);
csr->processResidency(csr->getResidencyAllocations());
csr->processResidency(csr->getResidencyAllocations(), 0u);
for (unsigned int i = 0; i < reqs.requiredFragmentsCount; i++) {
ASSERT_EQ(allocation2->fragmentsStorage.fragmentStorageData[i].cpuPtr,
@@ -1090,7 +1090,7 @@ HWTEST_TEMPLATED_F(DrmCommandStreamEnhancedTest, GivenTwoAllocationsWhenBackingS
csr->makeResident(*allocation);
csr->makeResident(*allocation2);
csr->processResidency(csr->getResidencyAllocations());
csr->processResidency(csr->getResidencyAllocations(), 0u);
EXPECT_EQ(getResidencyVector<FamilyType>().size(), 1u);
@@ -1124,7 +1124,7 @@ HWTEST_TEMPLATED_F(DrmCommandStreamEnhancedTest, ClearResidencyWhenFlushNotCalle
EXPECT_EQ(getResidencyVector<FamilyType>().size(), 0u);
csr->makeResident(*allocation1);
csr->makeResident(*allocation2);
csr->processResidency(csr->getResidencyAllocations());
csr->processResidency(csr->getResidencyAllocations(), 0u);
EXPECT_TRUE(isResident<FamilyType>(allocation1->getBO()));
EXPECT_TRUE(isResident<FamilyType>(allocation2->getBO()));
@@ -1266,7 +1266,7 @@ HWTEST_TEMPLATED_F(DrmCommandStreamEnhancedTest, MakeResidentClearResidencyAlloc
csr->makeResident(*allocation2);
EXPECT_NE(0u, csr->getResidencyAllocations().size());
csr->processResidency(csr->getResidencyAllocations());
csr->processResidency(csr->getResidencyAllocations(), 0u);
csr->makeSurfacePackNonResident(csr->getResidencyAllocations());
EXPECT_EQ(0u, csr->getResidencyAllocations().size());
@@ -1284,7 +1284,7 @@ HWTEST_TEMPLATED_F(DrmCommandStreamEnhancedTest, givenMultipleMakeResidentWhenMa
EXPECT_NE(0u, csr->getResidencyAllocations().size());
csr->processResidency(csr->getResidencyAllocations());
csr->processResidency(csr->getResidencyAllocations(), 0u);
csr->makeSurfacePackNonResident(csr->getResidencyAllocations());
EXPECT_EQ(0u, csr->getResidencyAllocations().size());
@@ -1349,7 +1349,7 @@ HWTEST_TEMPLATED_F(DrmCommandStreamEnhancedTest, BufferResidency) {
//make it resident 8 times
for (int c = 0; c < 8; c++) {
csr->makeResident(*buffer->getGraphicsAllocation());
csr->processResidency(csr->getResidencyAllocations());
csr->processResidency(csr->getResidencyAllocations(), 0u);
EXPECT_TRUE(buffer->getGraphicsAllocation()->isResident(osContextId));
EXPECT_EQ(buffer->getGraphicsAllocation()->getResidencyTaskCount(osContextId), csr->peekTaskCount() + 1);
}

View File

@@ -1948,7 +1948,7 @@ TEST_F(DrmMemoryManagerTest, givenTwoGraphicsAllocationsThatShareTheSameBufferOb
testedCsr->makeResident(*graphicsAllocation2);
EXPECT_EQ(2u, testedCsr->getResidencyAllocations().size());
testedCsr->processResidency(testedCsr->getResidencyAllocations());
testedCsr->processResidency(testedCsr->getResidencyAllocations(), 0u);
EXPECT_EQ(1u, testedCsr->residency.size());
@@ -1976,7 +1976,7 @@ TEST_F(DrmMemoryManagerTest, givenTwoGraphicsAllocationsThatDoesnShareTheSameBuf
testedCsr->makeResident(*graphicsAllocation2);
EXPECT_EQ(2u, testedCsr->getResidencyAllocations().size());
testedCsr->processResidency(testedCsr->getResidencyAllocations());
testedCsr->processResidency(testedCsr->getResidencyAllocations(), 0u);
EXPECT_EQ(2u, testedCsr->residency.size());

View File

@@ -715,7 +715,7 @@ TEST_F(WddmCommandStreamMockGdiTest, makeResidentClearsResidencyAllocations) {
EXPECT_EQ(trimListUnusedPosition, static_cast<WddmAllocation *>(commandBuffer)->getTrimCandidateListPosition(csr->getOsContext().getContextId()));
csr->processResidency(csr->getResidencyAllocations());
csr->processResidency(csr->getResidencyAllocations(), 0u);
csr->makeSurfacePackNonResident(csr->getResidencyAllocations());

View File

@@ -660,8 +660,8 @@ HWTEST_P(ProgramFromBinaryTest, givenIsaAllocationUsedByMultipleCsrsWhenItIsDele
csr0.makeResident(*kernelAllocation);
csr1.makeResident(*kernelAllocation);
csr0.processResidency(csr0.getResidencyAllocations());
csr1.processResidency(csr1.getResidencyAllocations());
csr0.processResidency(csr0.getResidencyAllocations(), 0u);
csr1.processResidency(csr1.getResidencyAllocations(), 0u);
csr0.makeNonResident(*kernelAllocation);
csr1.makeNonResident(*kernelAllocation);