fix: Restore main command stream when reset cmd list

Signed-off-by: Lukasz Jobczyk <lukasz.jobczyk@intel.com>
This commit is contained in:
Lukasz Jobczyk
2024-04-09 11:43:41 +00:00
committed by Compute-Runtime-Automation
parent 6ffa756457
commit 4106398002
2 changed files with 17 additions and 2 deletions

View File

@@ -930,6 +930,11 @@ HWTEST2_F(CommandListCreate, givenSecondaryCommandStreamForImmediateCmdListWhenC
EXPECT_EQ(commandList->getCmdContainer().getCommandStream(), secondaryCmdStream);
EXPECT_TRUE(MemoryPoolHelper::isSystemMemoryPool(commandList->getCmdContainer().getCommandStream()->getGraphicsAllocation()->getMemoryPool()));
commandList->reset();
EXPECT_FALSE(MemoryPoolHelper::isSystemMemoryPool(commandList->getCmdContainer().getCommandStream()->getGraphicsAllocation()->getMemoryPool()));
EXPECT_TRUE(MemoryPoolHelper::isSystemMemoryPool(reinterpret_cast<CmdContainerMock *>(&commandList->getCmdContainer())->secondaryCommandStreamForImmediateCmdList->getGraphicsAllocation()->getMemoryPool()));
}
HWTEST2_F(CommandListCreate, givenNoSecondaryCommandStreamForImmediateCmdListWhenCheckAvailableSpaceThenNotSwapCommandStreams, IsAtLeastSkl) {

View File

@@ -195,8 +195,18 @@ void CommandContainer::reset() {
getDeallocationContainer().clear();
sshAllocations.clear();
this->handleCmdBufferAllocations(1u);
cmdBufferAllocations.erase(cmdBufferAllocations.begin() + 1, cmdBufferAllocations.end());
auto defaultCmdBuffersCnt = 1u + this->useSecondaryCommandStream;
this->handleCmdBufferAllocations(defaultCmdBuffersCnt);
cmdBufferAllocations.erase(cmdBufferAllocations.begin() + defaultCmdBuffersCnt, cmdBufferAllocations.end());
if (this->useSecondaryCommandStream) {
if (!NEO::MemoryPoolHelper::isSystemMemoryPool(this->getCommandStream()->getGraphicsAllocation()->getMemoryPool())) {
this->swapStreams();
}
setCmdBuffer(cmdBufferAllocations[1]);
this->swapStreams();
}
setCmdBuffer(cmdBufferAllocations[0]);