Add cmd buffer to container if needed

Command buffers in CommandContainer are removed
through cmdBufferAllocations. This PR ensures
that allocations will be stored there if they
are currently used by given cmd container.

Signed-off-by: Szymon Morek <szymon.morek@intel.com>
This commit is contained in:
Szymon Morek
2022-10-13 11:30:33 +00:00
committed by Compute-Runtime-Automation
parent 5078cc27e0
commit 3f17b26253
4 changed files with 25 additions and 3 deletions

View File

@@ -333,10 +333,14 @@ void CommandContainer::ensureHeapSizePrepared(size_t sshRequiredSize, size_t dsh
GraphicsAllocation *CommandContainer::reuseExistingCmdBuffer() {
size_t alignedSize = alignUp<size_t>(this->getTotalCmdBufferSize(), MemoryConstants::pageSize64k);
auto cmdBufferAllocation = this->reusableAllocationList->detachAllocation(alignedSize, nullptr, this->immediateCmdListCsr, AllocationType::COMMAND_BUFFER).release();
if (cmdBufferAllocation) {
this->cmdBufferAllocations.push_back(cmdBufferAllocation);
}
return cmdBufferAllocation;
}
void CommandContainer::addCurrentCommandBufferToReusableAllocationList() {
this->cmdBufferAllocations.erase(std::find(this->cmdBufferAllocations.begin(), this->cmdBufferAllocations.end(), this->commandStream->getGraphicsAllocation()));
this->storeAllocationAndFlushTagUpdate(this->commandStream->getGraphicsAllocation());
}