mirror of
https://github.com/intel/compute-runtime.git
synced 2025-12-21 17:29:14 +08:00
Align command buffers to 64KB
Change-Id: Id1fbd7c6f1aee48c4b69ec305d5332cb0aa86507 Signed-off-by: Jobczyk, Lukasz <lukasz.jobczyk@intel.com>
This commit is contained in:
committed by
sys_ocldev
parent
af2dc200c5
commit
2bcecf3e62
@@ -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);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user