diff --git a/shared/source/command_stream/command_stream_receiver.cpp b/shared/source/command_stream/command_stream_receiver.cpp index 46ba3c29d1..98a4497a31 100644 --- a/shared/source/command_stream/command_stream_receiver.cpp +++ b/shared/source/command_stream/command_stream_receiver.cpp @@ -170,6 +170,7 @@ void CommandStreamReceiver::makeResident(GraphicsAllocation &gfxAllocation) { } } } + gfxAllocation.updateTaskCount(submissionTaskCount, osContext->getContextId()); gfxAllocation.updateResidencyTaskCount(submissionTaskCount, osContext->getContextId()); } diff --git a/shared/test/unit_test/command_stream/command_stream_receiver_tests.cpp b/shared/test/unit_test/command_stream/command_stream_receiver_tests.cpp index 7632f01978..9962aee443 100644 --- a/shared/test/unit_test/command_stream/command_stream_receiver_tests.cpp +++ b/shared/test/unit_test/command_stream/command_stream_receiver_tests.cpp @@ -5251,6 +5251,26 @@ HWTEST_F(CommandStreamReceiverTest, givenCsrWhenInitializeDeviceWithFirstSubmiss EXPECT_EQ(1u, commandStreamReceiver.taskCount); } +HWTEST_F(CommandStreamReceiverTest, givenCsrWhenMakeResidentCalledThenUpdateTaskCountIfObjectIsAlwaysResident) { + auto &csr = pDevice->getUltCommandStreamReceiver(); + auto contextId = csr.getOsContext().getContextId(); + MockGraphicsAllocation graphicsAllocation; + + csr.makeResident(graphicsAllocation); + auto initialAllocTaskCount = graphicsAllocation.getTaskCount(contextId); + auto csrTaskCount = csr.peekTaskCount(); + EXPECT_EQ(initialAllocTaskCount, csr.peekTaskCount() + 1); + + graphicsAllocation.updateResidencyTaskCount(GraphicsAllocation::objectAlwaysResident, contextId); + csr.taskCount = 10; + + csr.makeResident(graphicsAllocation); + auto updatedTaskCount = graphicsAllocation.getTaskCount(contextId); + csrTaskCount = csr.peekTaskCount(); + EXPECT_EQ(updatedTaskCount, csr.peekTaskCount() + 1); + EXPECT_NE(updatedTaskCount, initialAllocTaskCount); +} + using CommandStreamReceiverHwHeaplessTest = Test; HWTEST_F(CommandStreamReceiverHwHeaplessTest, whenHeaplessCommandStreamReceiverFunctionsAreCalledThenExceptionIsThrown) {