From ac1d2b9901077ee5daa2a5f75cf3e95c4efa9508 Mon Sep 17 00:00:00 2001 From: Maciej Dziuban Date: Fri, 14 Sep 2018 10:39:21 +0200 Subject: [PATCH] Change processResidency argument to a reference Change-Id: Ie313a8cc4e479a314bcf170917397c13fbb70d14 Signed-off-by: Maciej Dziuban --- .../aub_command_stream_receiver_hw.h | 2 +- .../aub_command_stream_receiver_hw.inl | 8 ++-- .../command_stream/command_stream_receiver.h | 2 +- .../command_stream_receiver_with_aub_dump.h | 2 +- .../command_stream_receiver_with_aub_dump.inl | 2 +- .../tbx_command_stream_receiver_hw.h | 2 +- .../tbx_command_stream_receiver_hw.inl | 8 ++-- .../os_interface/linux/drm_command_stream.h | 2 +- .../os_interface/linux/drm_command_stream.inl | 8 ++-- .../windows/wddm_device_command_stream.h | 2 +- .../windows/wddm_device_command_stream.inl | 7 ++-- .../aub_command_stream_tests.cpp | 6 +-- .../aub_command_stream_receiver_tests.cpp | 12 +++--- .../command_stream_receiver_tests.cpp | 2 +- ...nd_stream_receiver_with_aub_dump_tests.cpp | 6 +-- .../tbx_command_stream_tests.cpp | 4 +- .../linux/drm_command_stream_tests.cpp | 38 +++++++++---------- .../windows/device_command_stream_tests.cpp | 2 +- 18 files changed, 58 insertions(+), 57 deletions(-) diff --git a/runtime/command_stream/aub_command_stream_receiver_hw.h b/runtime/command_stream/aub_command_stream_receiver_hw.h index 29b243ac55..036d9bf834 100644 --- a/runtime/command_stream/aub_command_stream_receiver_hw.h +++ b/runtime/command_stream/aub_command_stream_receiver_hw.h @@ -43,7 +43,7 @@ class AUBCommandStreamReceiverHw : public CommandStreamReceiverHw { FlushStamp flush(BatchBuffer &batchBuffer, EngineType engineType, ResidencyContainer *allocationsForResidency, OsContext &osContext) override; void makeNonResident(GraphicsAllocation &gfxAllocation) override; - void processResidency(ResidencyContainer *allocationsForResidency, OsContext &osContext) override; + void processResidency(ResidencyContainer &allocationsForResidency, OsContext &osContext) override; void makeResidentExternal(AllocationView &allocationView); void makeNonResidentExternal(uint64_t gpuAddress); diff --git a/runtime/command_stream/aub_command_stream_receiver_hw.inl b/runtime/command_stream/aub_command_stream_receiver_hw.inl index cebd5e3ec1..9acbafebd2 100644 --- a/runtime/command_stream/aub_command_stream_receiver_hw.inl +++ b/runtime/command_stream/aub_command_stream_receiver_hw.inl @@ -315,7 +315,8 @@ FlushStamp AUBCommandStreamReceiverHw::flush(BatchBuffer &batchBuffer allocationsForResidency->push_back(batchBuffer.commandBufferAllocation); batchBuffer.commandBufferAllocation->residencyTaskCount = this->taskCount; } - processResidency(allocationsForResidency, osContext); + UNRECOVERABLE_IF(allocationsForResidency == nullptr); + processResidency(*allocationsForResidency, osContext); } if (DebugManager.flags.AddPatchInfoCommentsForAUBDump.get()) { addGUCStartMessage(static_cast(reinterpret_cast(pBatchBuffer)), engineType); @@ -582,7 +583,7 @@ bool AUBCommandStreamReceiverHw::writeMemory(AllocationView &allocati } template -void AUBCommandStreamReceiverHw::processResidency(ResidencyContainer *allocationsForResidency, OsContext &osContext) { +void AUBCommandStreamReceiverHw::processResidency(ResidencyContainer &allocationsForResidency, OsContext &osContext) { if (subCaptureManager->isSubCaptureMode()) { if (!subCaptureManager->isSubCaptureEnabled()) { return; @@ -595,8 +596,7 @@ void AUBCommandStreamReceiverHw::processResidency(ResidencyContainer } } - DEBUG_BREAK_IF(allocationsForResidency == nullptr); - for (auto &gfxAllocation : *allocationsForResidency) { + for (auto &gfxAllocation : allocationsForResidency) { if (dumpAubNonWritable) { gfxAllocation->setAubWritable(true); } diff --git a/runtime/command_stream/command_stream_receiver.h b/runtime/command_stream/command_stream_receiver.h index e74e8e49a1..50158e5aca 100644 --- a/runtime/command_stream/command_stream_receiver.h +++ b/runtime/command_stream/command_stream_receiver.h @@ -78,7 +78,7 @@ class CommandStreamReceiver { virtual void makeResident(GraphicsAllocation &gfxAllocation); virtual void makeNonResident(GraphicsAllocation &gfxAllocation); void makeSurfacePackNonResident(ResidencyContainer *allocationsForResidency); - virtual void processResidency(ResidencyContainer *allocationsForResidency, OsContext &osContext) {} + virtual void processResidency(ResidencyContainer &allocationsForResidency, OsContext &osContext) {} virtual void processEviction(); void makeResidentHostPtrAllocation(GraphicsAllocation *gfxAllocation); virtual void waitBeforeMakingNonResidentWhenRequired() {} diff --git a/runtime/command_stream/command_stream_receiver_with_aub_dump.h b/runtime/command_stream/command_stream_receiver_with_aub_dump.h index 6d3725e1b3..36e0fe363a 100644 --- a/runtime/command_stream/command_stream_receiver_with_aub_dump.h +++ b/runtime/command_stream/command_stream_receiver_with_aub_dump.h @@ -35,7 +35,7 @@ class CommandStreamReceiverWithAUBDump : public BaseCSR { CommandStreamReceiverWithAUBDump &operator=(const CommandStreamReceiverWithAUBDump &) = delete; FlushStamp flush(BatchBuffer &batchBuffer, EngineType engineOrdinal, ResidencyContainer *allocationsForResidency, OsContext &osContext) override; - void processResidency(ResidencyContainer *allocationsForResidency, OsContext &osContext) override; + void processResidency(ResidencyContainer &allocationsForResidency, OsContext &osContext) override; void activateAubSubCapture(const MultiDispatchInfo &dispatchInfo) override; diff --git a/runtime/command_stream/command_stream_receiver_with_aub_dump.inl b/runtime/command_stream/command_stream_receiver_with_aub_dump.inl index 605d1a465a..2d513fabaa 100644 --- a/runtime/command_stream/command_stream_receiver_with_aub_dump.inl +++ b/runtime/command_stream/command_stream_receiver_with_aub_dump.inl @@ -48,7 +48,7 @@ FlushStamp CommandStreamReceiverWithAUBDump::flush(BatchBuffer &batchBu } template -void CommandStreamReceiverWithAUBDump::processResidency(ResidencyContainer *allocationsForResidency, OsContext &osContext) { +void CommandStreamReceiverWithAUBDump::processResidency(ResidencyContainer &allocationsForResidency, OsContext &osContext) { BaseCSR::processResidency(allocationsForResidency, osContext); if (aubCSR) { aubCSR->processResidency(allocationsForResidency, osContext); diff --git a/runtime/command_stream/tbx_command_stream_receiver_hw.h b/runtime/command_stream/tbx_command_stream_receiver_hw.h index 4189cc2142..e10179b2d3 100644 --- a/runtime/command_stream/tbx_command_stream_receiver_hw.h +++ b/runtime/command_stream/tbx_command_stream_receiver_hw.h @@ -49,7 +49,7 @@ class TbxCommandStreamReceiverHw : public CommandStreamReceiverHw { FlushStamp flush(BatchBuffer &batchBuffer, EngineType engineType, ResidencyContainer *allocationsForResidency, OsContext &osContext) override; void makeCoherent(GraphicsAllocation &gfxAllocation) override; - void processResidency(ResidencyContainer *allocationsForResidency, OsContext &osContext) override; + void processResidency(ResidencyContainer &allocationsForResidency, OsContext &osContext) override; void waitBeforeMakingNonResidentWhenRequired() override; bool writeMemory(GraphicsAllocation &gfxAllocation); diff --git a/runtime/command_stream/tbx_command_stream_receiver_hw.inl b/runtime/command_stream/tbx_command_stream_receiver_hw.inl index f6bd784cca..c2bc3d3ed6 100644 --- a/runtime/command_stream/tbx_command_stream_receiver_hw.inl +++ b/runtime/command_stream/tbx_command_stream_receiver_hw.inl @@ -221,7 +221,8 @@ FlushStamp TbxCommandStreamReceiverHw::flush(BatchBuffer &batchBuffer } // Write allocations for residency - processResidency(allocationsForResidency, osContext); + UNRECOVERABLE_IF(allocationsForResidency == nullptr); + processResidency(*allocationsForResidency, osContext); // Add a batch buffer start to the RCS auto previousTail = engineInfo.tailRCS; @@ -367,9 +368,8 @@ bool TbxCommandStreamReceiverHw::writeMemory(GraphicsAllocation &gfxA } template -void TbxCommandStreamReceiverHw::processResidency(ResidencyContainer *allocationsForResidency, OsContext &osContext) { - DEBUG_BREAK_IF(allocationsForResidency == nullptr); - for (auto &gfxAllocation : *allocationsForResidency) { +void TbxCommandStreamReceiverHw::processResidency(ResidencyContainer &allocationsForResidency, OsContext &osContext) { + for (auto &gfxAllocation : allocationsForResidency) { if (!writeMemory(*gfxAllocation)) { DEBUG_BREAK_IF(!(gfxAllocation->getUnderlyingBufferSize() == 0)); } diff --git a/runtime/os_interface/linux/drm_command_stream.h b/runtime/os_interface/linux/drm_command_stream.h index 85c1eabf04..24a89bbecc 100644 --- a/runtime/os_interface/linux/drm_command_stream.h +++ b/runtime/os_interface/linux/drm_command_stream.h @@ -53,7 +53,7 @@ class DrmCommandStreamReceiver : public DeviceCommandStreamReceiver { FlushStamp flush(BatchBuffer &batchBuffer, EngineType engineType, ResidencyContainer *allocationsForResidency, OsContext &osContext) override; void makeResident(GraphicsAllocation &gfxAllocation) override; - void processResidency(ResidencyContainer *allocationsForResidency, OsContext &osContext) override; + void processResidency(ResidencyContainer &allocationsForResidency, OsContext &osContext) override; void makeNonResident(GraphicsAllocation &gfxAllocation) override; bool waitForFlushStamp(FlushStamp &flushStampToWait, OsContext &osContext) override; void overrideMediaVFEStateDirty(bool dirty) override; diff --git a/runtime/os_interface/linux/drm_command_stream.inl b/runtime/os_interface/linux/drm_command_stream.inl index 7d506ea34e..b279ccaf56 100644 --- a/runtime/os_interface/linux/drm_command_stream.inl +++ b/runtime/os_interface/linux/drm_command_stream.inl @@ -75,7 +75,8 @@ FlushStamp DrmCommandStreamReceiver::flush(BatchBuffer &batchBuffer, if (bb) { flushStamp = bb->peekHandle(); - this->processResidency(allocationsForResidency, osContext); + UNRECOVERABLE_IF(allocationsForResidency == nullptr); + this->processResidency(*allocationsForResidency, osContext); // Residency hold all allocation except command buffer, hence + 1 auto requiredSize = this->residency.size() + 1; if (requiredSize > this->execObjectsStorage.size()) { @@ -123,9 +124,8 @@ void DrmCommandStreamReceiver::makeResident(BufferObject *bo) { } template -void DrmCommandStreamReceiver::processResidency(ResidencyContainer *inputAllocationsForResidency, OsContext &osContext) { - UNRECOVERABLE_IF(inputAllocationsForResidency == nullptr); - for (auto &alloc : *inputAllocationsForResidency) { +void DrmCommandStreamReceiver::processResidency(ResidencyContainer &inputAllocationsForResidency, OsContext &osContext) { + for (auto &alloc : inputAllocationsForResidency) { auto drmAlloc = reinterpret_cast(alloc); if (drmAlloc->fragmentsStorage.fragmentCount) { for (unsigned int f = 0; f < drmAlloc->fragmentsStorage.fragmentCount; f++) { diff --git a/runtime/os_interface/windows/wddm_device_command_stream.h b/runtime/os_interface/windows/wddm_device_command_stream.h index 67038f8c53..f3529e3827 100644 --- a/runtime/os_interface/windows/wddm_device_command_stream.h +++ b/runtime/os_interface/windows/wddm_device_command_stream.h @@ -42,7 +42,7 @@ class WddmCommandStreamReceiver : public DeviceCommandStreamReceiver FlushStamp flush(BatchBuffer &batchBuffer, EngineType engineType, ResidencyContainer *allocationsForResidency, OsContext &osContext) override; void makeResident(GraphicsAllocation &gfxAllocation) override; - void processResidency(ResidencyContainer *allocationsForResidency, OsContext &osContext) override; + void processResidency(ResidencyContainer &allocationsForResidency, OsContext &osContext) override; void processEviction() override; bool waitForFlushStamp(FlushStamp &flushStampToWait, OsContext &osContext) override; diff --git a/runtime/os_interface/windows/wddm_device_command_stream.inl b/runtime/os_interface/windows/wddm_device_command_stream.inl index b19b7faf2e..ead4647ac7 100644 --- a/runtime/os_interface/windows/wddm_device_command_stream.inl +++ b/runtime/os_interface/windows/wddm_device_command_stream.inl @@ -106,7 +106,8 @@ FlushStamp WddmCommandStreamReceiver::flush(BatchBuffer &batchBuffer, batchBuffer.commandBufferAllocation->residencyTaskCount = this->taskCount; } - this->processResidency(allocationsForResidency, osContext); + UNRECOVERABLE_IF(allocationsForResidency == nullptr); + this->processResidency(*allocationsForResidency, osContext); COMMAND_BUFFER_HEADER *pHeader = reinterpret_cast(commandBufferHeader); pHeader->RequiresCoherency = batchBuffer.requiresCoherency; @@ -152,8 +153,8 @@ void WddmCommandStreamReceiver::makeResident(GraphicsAllocation &gfxA } template -void WddmCommandStreamReceiver::processResidency(ResidencyContainer *allocationsForResidency, OsContext &osContext) { - bool success = getMemoryManager()->makeResidentResidencyAllocations(allocationsForResidency, osContext); +void WddmCommandStreamReceiver::processResidency(ResidencyContainer &allocationsForResidency, OsContext &osContext) { + bool success = getMemoryManager()->makeResidentResidencyAllocations(&allocationsForResidency, osContext); DEBUG_BREAK_IF(!success); } diff --git a/unit_tests/aub_tests/command_stream/aub_command_stream_tests.cpp b/unit_tests/aub_tests/command_stream/aub_command_stream_tests.cpp index 6fd628d7fa..9ba0676ee4 100644 --- a/unit_tests/aub_tests/command_stream/aub_command_stream_tests.cpp +++ b/unit_tests/aub_tests/command_stream/aub_command_stream_tests.cpp @@ -112,7 +112,7 @@ TEST_F(AUBcommandstreamTests, makeResident) { auto &commandStreamReceiver = pDevice->getCommandStreamReceiver(); auto graphicsAllocation = commandStreamReceiver.createAllocationAndHandleResidency(buffer, size); ResidencyContainer allocationsForResidency = {graphicsAllocation}; - commandStreamReceiver.processResidency(&allocationsForResidency, *pDevice->getOsContext()); + commandStreamReceiver.processResidency(allocationsForResidency, *pDevice->getOsContext()); } HWTEST_F(AUBcommandstreamTests, expectMemorySingle) { @@ -121,7 +121,7 @@ HWTEST_F(AUBcommandstreamTests, expectMemorySingle) { auto &commandStreamReceiver = pDevice->getCommandStreamReceiver(); auto graphicsAllocation = commandStreamReceiver.createAllocationAndHandleResidency(&buffer, size); ResidencyContainer allocationsForResidency = {graphicsAllocation}; - commandStreamReceiver.processResidency(&allocationsForResidency, *pDevice->getOsContext()); + commandStreamReceiver.processResidency(allocationsForResidency, *pDevice->getOsContext()); AUBCommandStreamFixture::expectMemory(&buffer, &buffer, size); } @@ -137,7 +137,7 @@ HWTEST_F(AUBcommandstreamTests, expectMemoryLarge) { auto &commandStreamReceiver = pDevice->getCommandStreamReceiver(); auto graphicsAllocation = commandStreamReceiver.createAllocationAndHandleResidency(buffer, sizeBuffer); ResidencyContainer allocationsForResidency = {graphicsAllocation}; - commandStreamReceiver.processResidency(&allocationsForResidency, *pDevice->getOsContext()); + commandStreamReceiver.processResidency(allocationsForResidency, *pDevice->getOsContext()); AUBCommandStreamFixture::expectMemory(buffer, buffer, sizeBuffer); delete[] buffer; diff --git a/unit_tests/command_stream/aub_command_stream_receiver_tests.cpp b/unit_tests/command_stream/aub_command_stream_receiver_tests.cpp index dfa470260b..87b0cfda0e 100644 --- a/unit_tests/command_stream/aub_command_stream_receiver_tests.cpp +++ b/unit_tests/command_stream/aub_command_stream_receiver_tests.cpp @@ -634,7 +634,7 @@ HWTEST_F(AubCommandStreamReceiverTests, givenAubCommandStreamReceiverWhenProcess auto gfxDefaultAllocation = memoryManager->allocateGraphicsMemory(sizeof(uint32_t), sizeof(uint32_t), false, false); ResidencyContainer allocationsForResidency = {gfxDefaultAllocation}; - aubCsr->processResidency(&allocationsForResidency, *pDevice->getOsContext()); + aubCsr->processResidency(allocationsForResidency, *pDevice->getOsContext()); EXPECT_TRUE(gfxDefaultAllocation->isAubWritable()); @@ -676,7 +676,7 @@ HWTEST_F(AubCommandStreamReceiverTests, givenAubCommandStreamReceiverWhenProcess gfxImageAllocation->setAllocationType(GraphicsAllocation::AllocationType::IMAGE); ResidencyContainer allocationsForResidency = {gfxBufferAllocation, gfxImageAllocation}; - aubCsr->processResidency(&allocationsForResidency, *pDevice->getOsContext()); + aubCsr->processResidency(allocationsForResidency, *pDevice->getOsContext()); EXPECT_FALSE(gfxBufferAllocation->isAubWritable()); EXPECT_FALSE(gfxImageAllocation->isAubWritable()); @@ -702,7 +702,7 @@ HWTEST_F(AubCommandStreamReceiverTests, givenAubCommandStreamReceiverInSubCaptur aubCsr->dumpAubNonWritable = true; ResidencyContainer allocationsForResidency = {gfxBufferAllocation, gfxImageAllocation}; - aubCsr->processResidency(&allocationsForResidency, *pDevice->getOsContext()); + aubCsr->processResidency(allocationsForResidency, *pDevice->getOsContext()); EXPECT_TRUE(gfxBufferAllocation->isAubWritable()); EXPECT_TRUE(gfxImageAllocation->isAubWritable()); @@ -728,7 +728,7 @@ HWTEST_F(AubCommandStreamReceiverTests, givenAubCommandStreamReceiverWhenProcess aubCsr->dumpAubNonWritable = false; ResidencyContainer allocationsForResidency = {gfxBufferAllocation, gfxImageAllocation}; - aubCsr->processResidency(&allocationsForResidency, *pDevice->getOsContext()); + aubCsr->processResidency(allocationsForResidency, *pDevice->getOsContext()); EXPECT_FALSE(gfxBufferAllocation->isAubWritable()); EXPECT_FALSE(gfxImageAllocation->isAubWritable()); @@ -1881,7 +1881,7 @@ HWTEST_F(AubCommandStreamReceiverTests, givenAubCommandStreamReceiverWhenProcess ASSERT_EQ(1u, aubCsr->externalAllocations.size()); ResidencyContainer allocationsForResidency; - aubCsr->processResidency(&allocationsForResidency, *pDevice->getOsContext()); + aubCsr->processResidency(allocationsForResidency, *pDevice->getOsContext()); EXPECT_TRUE(aubCsr->writeMemoryParametrization.wasCalled); EXPECT_EQ(addr, aubCsr->writeMemoryParametrization.receivedAllocationView.first); @@ -1896,7 +1896,7 @@ HWTEST_F(AubCommandStreamReceiverTests, givenAubCommandStreamReceiverWhenProcess ASSERT_EQ(1u, aubCsr->externalAllocations.size()); ResidencyContainer allocationsForResidency; - aubCsr->processResidency(&allocationsForResidency, *pDevice->getOsContext()); + aubCsr->processResidency(allocationsForResidency, *pDevice->getOsContext()); EXPECT_TRUE(aubCsr->writeMemoryParametrization.wasCalled); EXPECT_EQ(0u, aubCsr->writeMemoryParametrization.receivedAllocationView.first); diff --git a/unit_tests/command_stream/command_stream_receiver_tests.cpp b/unit_tests/command_stream/command_stream_receiver_tests.cpp index 86b8401f39..e17e44948b 100644 --- a/unit_tests/command_stream/command_stream_receiver_tests.cpp +++ b/unit_tests/command_stream/command_stream_receiver_tests.cpp @@ -292,7 +292,7 @@ TEST_F(CommandStreamReceiverTest, makeResidentPushesAllocationToMemoryManagerRes } TEST_F(CommandStreamReceiverTest, makeResidentWithoutParametersDoesNothing) { - commandStreamReceiver->processResidency(&commandStreamReceiver->getResidencyAllocations(), *pDevice->getOsContext()); + commandStreamReceiver->processResidency(commandStreamReceiver->getResidencyAllocations(), *pDevice->getOsContext()); auto &residencyAllocations = commandStreamReceiver->getResidencyAllocations(); EXPECT_EQ(0u, residencyAllocations.size()); } diff --git a/unit_tests/command_stream/command_stream_receiver_with_aub_dump_tests.cpp b/unit_tests/command_stream/command_stream_receiver_with_aub_dump_tests.cpp index c01bfac5e3..ab29958be3 100644 --- a/unit_tests/command_stream/command_stream_receiver_with_aub_dump_tests.cpp +++ b/unit_tests/command_stream/command_stream_receiver_with_aub_dump_tests.cpp @@ -49,9 +49,9 @@ struct MyMockCsr : UltCommandStreamReceiver { makeResidentParameterization.receivedGfxAllocation = &gfxAllocation; } - void processResidency(ResidencyContainer *allocationsForResidency, OsContext &osContext) override { + void processResidency(ResidencyContainer &allocationsForResidency, OsContext &osContext) override { processResidencyParameterization.wasCalled = true; - processResidencyParameterization.receivedAllocationsForResidency = allocationsForResidency; + processResidencyParameterization.receivedAllocationsForResidency = &allocationsForResidency; } void makeNonResident(GraphicsAllocation &gfxAllocation) override { @@ -191,7 +191,7 @@ HWTEST_P(CommandStreamReceiverWithAubDumpTest, givenCommandStreamReceiverWithAub ResidencyContainer allocationsForResidency = {gfxAllocation}; OsContext osContext(nullptr, 0u); - csrWithAubDump->processResidency(&allocationsForResidency, osContext); + csrWithAubDump->processResidency(allocationsForResidency, osContext); EXPECT_TRUE(csrWithAubDump->processResidencyParameterization.wasCalled); EXPECT_EQ(&allocationsForResidency, csrWithAubDump->processResidencyParameterization.receivedAllocationsForResidency); diff --git a/unit_tests/command_stream/tbx_command_stream_tests.cpp b/unit_tests/command_stream/tbx_command_stream_tests.cpp index 175234e57c..17a0b5e152 100644 --- a/unit_tests/command_stream/tbx_command_stream_tests.cpp +++ b/unit_tests/command_stream/tbx_command_stream_tests.cpp @@ -243,7 +243,7 @@ HWTEST_F(TbxCommandStreamTests, givenTbxCommandStreamReceiverWhenProcessResidenc EXPECT_EQ(ObjectNotResident, graphicsAllocation->residencyTaskCount); tbxCsr->pushAllocationForResidency(graphicsAllocation); - tbxCsr->processResidency(&tbxCsr->getResidencyAllocations(), *pDevice->getOsContext()); + tbxCsr->processResidency(tbxCsr->getResidencyAllocations(), *pDevice->getOsContext()); EXPECT_NE(ObjectNotResident, graphicsAllocation->residencyTaskCount); EXPECT_EQ((int)tbxCsr->peekTaskCount() + 1, graphicsAllocation->residencyTaskCount); @@ -262,7 +262,7 @@ HWTEST_F(TbxCommandStreamTests, givenTbxCommandStreamReceiverWhenProcessResidenc EXPECT_EQ(ObjectNotResident, graphicsAllocation->residencyTaskCount); ResidencyContainer allocationsForResidency = {graphicsAllocation}; - tbxCsr->processResidency(&allocationsForResidency, *pDevice->getOsContext()); + tbxCsr->processResidency(allocationsForResidency, *pDevice->getOsContext()); EXPECT_NE(ObjectNotResident, graphicsAllocation->residencyTaskCount); EXPECT_EQ((int)tbxCsr->peekTaskCount() + 1, graphicsAllocation->residencyTaskCount); diff --git a/unit_tests/os_interface/linux/drm_command_stream_tests.cpp b/unit_tests/os_interface/linux/drm_command_stream_tests.cpp index bbbe38b960..5434651adf 100644 --- a/unit_tests/os_interface/linux/drm_command_stream_tests.cpp +++ b/unit_tests/os_interface/linux/drm_command_stream_tests.cpp @@ -879,7 +879,7 @@ TEST_F(DrmCommandStreamGemWorkerTests, givenGemCloseWorkerInactiveModeWhenMakeRe csr->makeResident(*dummyAllocation); EXPECT_EQ(1u, bo->getRefCount()); - csr->processResidency(&csr->getResidencyAllocations(), *osContext); + csr->processResidency(csr->getResidencyAllocations(), *osContext); csr->makeNonResident(*dummyAllocation); EXPECT_EQ(1u, bo->getRefCount()); @@ -899,7 +899,7 @@ TEST_F(DrmCommandStreamGemWorkerTests, GivenTwoAllocationsWhenBackingStorageIsDi EXPECT_FALSE(bo1->peekIsResident()); EXPECT_FALSE(bo2->peekIsResident()); - csr->processResidency(&csr->getResidencyAllocations(), *osContext); + csr->processResidency(csr->getResidencyAllocations(), *osContext); EXPECT_TRUE(bo1->peekIsResident()); EXPECT_TRUE(bo2->peekIsResident()); @@ -1135,7 +1135,7 @@ TEST_F(DrmCommandStreamLeaksTest, makeResident) { EXPECT_EQ(nullptr, allocation->getUnderlyingBuffer()); csr->makeResident(*allocation); - csr->processResidency(&csr->getResidencyAllocations(), *osContext); + csr->processResidency(csr->getResidencyAllocations(), *osContext); EXPECT_TRUE(isResident(buffer)); auto bo = getResident(buffer); @@ -1160,7 +1160,7 @@ TEST_F(DrmCommandStreamLeaksTest, makeResidentOnly) { csr->makeResident(*allocation1); csr->makeResident(*allocation2); - csr->processResidency(&csr->getResidencyAllocations(), *osContext); + csr->processResidency(csr->getResidencyAllocations(), *osContext); EXPECT_TRUE(isResident(buffer1)); EXPECT_TRUE(isResident(buffer2)); @@ -1184,7 +1184,7 @@ TEST_F(DrmCommandStreamLeaksTest, makeResidentTwice) { auto allocation = new DrmAllocation(buffer, nullptr, buffer->peekSize(), MemoryPool::MemoryNull); csr->makeResident(*allocation); - csr->processResidency(&csr->getResidencyAllocations(), *osContext); + csr->processResidency(csr->getResidencyAllocations(), *osContext); EXPECT_TRUE(isResident(buffer)); auto bo1 = getResident(buffer); @@ -1193,7 +1193,7 @@ TEST_F(DrmCommandStreamLeaksTest, makeResidentTwice) { csr->clearResidencyAllocations(); csr->makeResident(*allocation); - csr->processResidency(&csr->getResidencyAllocations(), *osContext); + csr->processResidency(csr->getResidencyAllocations(), *osContext); EXPECT_TRUE(isResident(buffer)); auto bo2 = getResident(buffer); @@ -1222,7 +1222,7 @@ TEST_F(DrmCommandStreamLeaksTest, makeResidentTwiceWhenFragmentStorage) { csr->makeResident(*allocation); csr->makeResident(*allocation); - csr->processResidency(&csr->getResidencyAllocations(), *osContext); + csr->processResidency(csr->getResidencyAllocations(), *osContext); for (int i = 0; i < max_fragments_count; i++) { ASSERT_EQ(allocation->fragmentsStorage.fragmentStorageData[i].cpuPtr, reqs.AllocationFragments[i].allocationPtr); @@ -1265,7 +1265,7 @@ TEST_F(DrmCommandStreamLeaksTest, givenFragmentedAllocationsWithResuedFragmentsW tCsr->makeResident(*graphicsAllocation); tCsr->makeResident(*graphicsAllocation2); - tCsr->processResidency(&csr->getResidencyAllocations(), *osContext); + tCsr->processResidency(csr->getResidencyAllocations(), *osContext); EXPECT_TRUE(graphicsAllocation->fragmentsStorage.fragmentStorageData[0].residency->resident); EXPECT_TRUE(graphicsAllocation->fragmentsStorage.fragmentStorageData[1].residency->resident); @@ -1289,7 +1289,7 @@ TEST_F(DrmCommandStreamLeaksTest, givenFragmentedAllocationsWithResuedFragmentsW tCsr->makeResident(*graphicsAllocation); tCsr->makeResident(*graphicsAllocation2); - tCsr->processResidency(&csr->getResidencyAllocations(), *osContext); + tCsr->processResidency(csr->getResidencyAllocations(), *osContext); EXPECT_TRUE(graphicsAllocation->fragmentsStorage.fragmentStorageData[0].residency->resident); EXPECT_TRUE(graphicsAllocation->fragmentsStorage.fragmentStorageData[1].residency->resident); @@ -1325,7 +1325,7 @@ TEST_F(DrmCommandStreamLeaksTest, GivenAllocationCreatedFromThreeFragmentsWhenMa ASSERT_EQ(3u, allocation->fragmentsStorage.fragmentCount); csr->makeResident(*allocation); - csr->processResidency(&csr->getResidencyAllocations(), *osContext); + csr->processResidency(csr->getResidencyAllocations(), *osContext); for (int i = 0; i < max_fragments_count; i++) { ASSERT_EQ(allocation->fragmentsStorage.fragmentStorageData[i].cpuPtr, @@ -1363,7 +1363,7 @@ TEST_F(DrmCommandStreamLeaksTest, GivenAllocationsContainingDifferentCountOfFrag ASSERT_EQ(2u, reqs.requiredFragmentsCount); csr->makeResident(*allocation); - csr->processResidency(&csr->getResidencyAllocations(), *osContext); + csr->processResidency(csr->getResidencyAllocations(), *osContext); for (unsigned int i = 0; i < reqs.requiredFragmentsCount; i++) { ASSERT_EQ(allocation->fragmentsStorage.fragmentStorageData[i].cpuPtr, @@ -1395,7 +1395,7 @@ TEST_F(DrmCommandStreamLeaksTest, GivenAllocationsContainingDifferentCountOfFrag ASSERT_EQ(1u, reqs.requiredFragmentsCount); csr->makeResident(*allocation2); - csr->processResidency(&csr->getResidencyAllocations(), *osContext); + csr->processResidency(csr->getResidencyAllocations(), *osContext); for (unsigned int i = 0; i < reqs.requiredFragmentsCount; i++) { ASSERT_EQ(allocation2->fragmentsStorage.fragmentStorageData[i].cpuPtr, @@ -1429,7 +1429,7 @@ TEST_F(DrmCommandStreamLeaksTest, GivenTwoAllocationsWhenBackingStorageIsTheSame csr->makeResident(*allocation); csr->makeResident(*allocation2); - csr->processResidency(&csr->getResidencyAllocations(), *osContext); + csr->processResidency(csr->getResidencyAllocations(), *osContext); EXPECT_EQ(tCsr->getResidencyVector()->size(), 1u); @@ -1452,7 +1452,7 @@ TEST_F(DrmCommandStreamLeaksTest, GivenTwoAllocationsWhenBackingStorageIsDiffere csr->makeResident(*allocation); csr->makeResident(*allocation2); - csr->processResidency(&csr->getResidencyAllocations(), *osContext); + csr->processResidency(csr->getResidencyAllocations(), *osContext); EXPECT_EQ(tCsr->getResidencyVector()->size(), 2u); @@ -1471,7 +1471,7 @@ TEST_F(DrmCommandStreamLeaksTest, makeResidentSizeZero) { EXPECT_EQ(buffer->peekSize(), allocation.getUnderlyingBufferSize()); csr->makeResident(allocation); - csr->processResidency(&csr->getResidencyAllocations(), *osContext); + csr->processResidency(csr->getResidencyAllocations(), *osContext); EXPECT_FALSE(isResident(buffer.get())); auto bo = getResident(buffer.get()); @@ -1500,7 +1500,7 @@ TEST_F(DrmCommandStreamLeaksTest, ClearResidencyWhenFlushNotCalled) { EXPECT_EQ(tCsr->getResidencyVector()->size(), 0u); csr->makeResident(*allocation1); csr->makeResident(*allocation2); - csr->processResidency(&csr->getResidencyAllocations(), *osContext); + csr->processResidency(csr->getResidencyAllocations(), *osContext); EXPECT_TRUE(isResident(allocation1->getBO())); EXPECT_TRUE(isResident(allocation2->getBO())); @@ -1642,7 +1642,7 @@ TEST_F(DrmCommandStreamLeaksTest, MakeResidentClearResidencyAllocationsInMemoryM csr->makeResident(*allocation2); EXPECT_NE(0u, csr->getResidencyAllocations().size()); - csr->processResidency(&csr->getResidencyAllocations(), *device->getOsContext()); + csr->processResidency(csr->getResidencyAllocations(), *device->getOsContext()); csr->makeSurfacePackNonResident(nullptr); EXPECT_EQ(0u, csr->getResidencyAllocations().size()); @@ -1660,7 +1660,7 @@ TEST_F(DrmCommandStreamLeaksTest, givenMultipleMakeResidentWhenMakeNonResidentIs EXPECT_NE(0u, csr->getResidencyAllocations().size()); - csr->processResidency(&csr->getResidencyAllocations(), *device->getOsContext()); + csr->processResidency(csr->getResidencyAllocations(), *device->getOsContext()); csr->makeSurfacePackNonResident(nullptr); EXPECT_EQ(0u, csr->getResidencyAllocations().size()); @@ -1722,7 +1722,7 @@ TEST_F(DrmCommandStreamLeaksTest, BufferResidency) { //make it resident 8 times for (int c = 0; c < 8; c++) { csr->makeResident(*buffer->getGraphicsAllocation()); - csr->processResidency(&csr->getResidencyAllocations(), *osContext); + csr->processResidency(csr->getResidencyAllocations(), *osContext); EXPECT_TRUE(buffer->getGraphicsAllocation()->isResident()); EXPECT_EQ(buffer->getGraphicsAllocation()->residencyTaskCount, (int)csr->peekTaskCount() + 1); } diff --git a/unit_tests/os_interface/windows/device_command_stream_tests.cpp b/unit_tests/os_interface/windows/device_command_stream_tests.cpp index 756b51af07..00fa891fc3 100644 --- a/unit_tests/os_interface/windows/device_command_stream_tests.cpp +++ b/unit_tests/os_interface/windows/device_command_stream_tests.cpp @@ -713,7 +713,7 @@ TEST_F(WddmCommandStreamMockGdiTest, makeResidentClearsResidencyAllocations) { EXPECT_EQ(trimListUnusedPosition, ((WddmAllocation *)commandBuffer)->getTrimCandidateListPosition()); - csr->processResidency(&csr->getResidencyAllocations(), *device->getOsContext()); + csr->processResidency(csr->getResidencyAllocations(), *device->getOsContext()); csr->makeSurfacePackNonResident(nullptr);