Align command buffers to 64KB

Change-Id: Id1fbd7c6f1aee48c4b69ec305d5332cb0aa86507
Signed-off-by: Jobczyk, Lukasz <lukasz.jobczyk@intel.com>
This commit is contained in:
Jobczyk, Lukasz
2019-02-14 12:56:03 +01:00
committed by sys_ocldev
parent af2dc200c5
commit 2bcecf3e62
6 changed files with 23 additions and 24 deletions

View File

@@ -208,15 +208,14 @@ LinearStream &CommandQueue::getCS(size_t minRequiredSize) {
if (commandStream->getAvailableSpace() < minRequiredSize) {
// If not, allocate a new block. allocate full pages
minRequiredSize = alignUp(minRequiredSize, MemoryConstants::pageSize);
auto requiredSize = minRequiredSize + CSRequirements::csOverfetchSize;
minRequiredSize += CSRequirements::csOverfetchSize;
minRequiredSize = alignUp(minRequiredSize, MemoryConstants::pageSize64k);
auto allocationType = GraphicsAllocation::AllocationType::LINEAR_STREAM;
GraphicsAllocation *allocation = storageForAllocation->obtainReusableAllocation(requiredSize, allocationType).release();
GraphicsAllocation *allocation = storageForAllocation->obtainReusableAllocation(minRequiredSize, allocationType).release();
if (!allocation) {
allocation = memoryManager->allocateGraphicsMemoryWithProperties({requiredSize, allocationType});
allocation = memoryManager->allocateGraphicsMemoryWithProperties({minRequiredSize, allocationType});
}
// Deallocate the old block, if not null
@@ -225,7 +224,7 @@ LinearStream &CommandQueue::getCS(size_t minRequiredSize) {
if (oldAllocation) {
storageForAllocation->storeAllocation(std::unique_ptr<GraphicsAllocation>(oldAllocation), REUSABLE_ALLOCATION);
}
commandStream->replaceBuffer(allocation->getUnderlyingBuffer(), minRequiredSize - CSRequirements::minCommandQueueCommandStreamSize);
commandStream->replaceBuffer(allocation->getUnderlyingBuffer(), minRequiredSize - CSRequirements::minCommandQueueCommandStreamSize - CSRequirements::csOverfetchSize);
commandStream->replaceGraphicsAllocation(allocation);
}