diff --git a/shared/source/command_stream/command_stream_receiver.cpp b/shared/source/command_stream/command_stream_receiver.cpp index f716fd4e3b..3a8f31b0c1 100644 --- a/shared/source/command_stream/command_stream_receiver.cpp +++ b/shared/source/command_stream/command_stream_receiver.cpp @@ -156,7 +156,7 @@ void CommandStreamReceiver::makeResident(GraphicsAllocation &gfxAllocation) { gfxAllocation.updateTaskCount(submissionTaskCount, osContext->getContextId()); if (gfxAllocation.isResidencyTaskCountBelow(submissionTaskCount, osContext->getContextId())) { - auto pushAllocations = !this->osContext->isDirectSubmissionLightActive(); + auto pushAllocations = this->pushAllocationsForMakeResident; if (debugManager.flags.MakeEachAllocationResident.get() != -1) { pushAllocations = !debugManager.flags.MakeEachAllocationResident.get(); diff --git a/shared/source/command_stream/command_stream_receiver.h b/shared/source/command_stream/command_stream_receiver.h index d04c3b5be0..6f7b4a52d6 100644 --- a/shared/source/command_stream/command_stream_receiver.h +++ b/shared/source/command_stream/command_stream_receiver.h @@ -688,6 +688,7 @@ class CommandStreamReceiver : NEO::NonCopyableAndNonMovableClass { bool lastSystolicPipelineSelectMode = false; bool requiresInstructionCacheFlush = false; bool requiresDcFlush = false; + bool pushAllocationsForMakeResident = true; bool localMemoryEnabled = false; bool pageTableManagerInitialized = false; diff --git a/shared/source/command_stream/command_stream_receiver_hw_base.inl b/shared/source/command_stream/command_stream_receiver_hw_base.inl index 294ce0f354..4dfe38c9ac 100644 --- a/shared/source/command_stream/command_stream_receiver_hw_base.inl +++ b/shared/source/command_stream/command_stream_receiver_hw_base.inl @@ -1411,8 +1411,11 @@ inline bool CommandStreamReceiverHw::initDirectSubmission() { this->overrideDispatchPolicy(DispatchMode::immediateDispatch); } } + this->osContext->setDirectSubmissionActive(); + if (this->osContext->isDirectSubmissionLightActive()) { + this->pushAllocationsForMakeResident = false; + } } - this->osContext->setDirectSubmissionActive(); } return ret; } diff --git a/shared/test/common/mocks/linux/mock_drm_command_stream_receiver.h b/shared/test/common/mocks/linux/mock_drm_command_stream_receiver.h index 8b8f2f5696..0c6d3fe293 100644 --- a/shared/test/common/mocks/linux/mock_drm_command_stream_receiver.h +++ b/shared/test/common/mocks/linux/mock_drm_command_stream_receiver.h @@ -36,6 +36,7 @@ class TestedDrmCommandStreamReceiver : public DrmCommandStreamReceiverrootDeviceEnvironments[rootDeviceIndex]->memoryOperationsInterface.reset(oldMemoryOperationsInterface); } +HWTEST_TEMPLATED_F(DrmCommandStreamDirectSubmissionTest, givenDirectSubmissionLightWhenMakeResidentThenDoNotAddToCsrResidencyContainer) { + auto testedCsr = static_cast *>(csr); + testedCsr->directSubmission.reset(); + csr->initDirectSubmission(); + EXPECT_FALSE(testedCsr->pushAllocationsForMakeResident); + EXPECT_EQ(testedCsr->getResidencyAllocations().size(), 0u); + + DrmAllocation graphicsAllocation(0, 1u /*num gmms*/, AllocationType::unknown, nullptr, nullptr, 1024, static_cast(1u), MemoryPool::memoryNull); + csr->makeResident(graphicsAllocation); + + EXPECT_EQ(testedCsr->getResidencyAllocations().size(), 0u); +} + template struct MockDrmDirectSubmission : public DrmDirectSubmission> { using DrmDirectSubmission>::currentTagData;