Refactor [1/n]: Make compression preference allocation property

Signed-off-by: Bartosz Dunajski <bartosz.dunajski@intel.com>
This commit is contained in:
Bartosz Dunajski
2021-12-02 12:21:33 +00:00
committed by Compute-Runtime-Automation
parent 4461b8ea3f
commit 7b55d38e34
29 changed files with 109 additions and 104 deletions

View File

@@ -194,6 +194,8 @@ Buffer *Buffer::create(Context *context,
memoryManager->isLocalMemorySupported(rootDeviceIndex),
HwHelper::get(hwInfo->platform.eRenderCoreFamily).isBufferSizeSuitableForRenderCompression(size, *hwInfo));
bool preferCompressed = (allocationInfo[rootDeviceIndex].allocationType == GraphicsAllocation::AllocationType::BUFFER_COMPRESSED);
if (ptr) {
if (!memoryProperties.flags.useHostPtr) {
if (!memoryProperties.flags.copyHostPtr) {
@@ -210,7 +212,7 @@ Buffer *Buffer::create(Context *context,
return nullptr;
}
if (allocationInfo[rootDeviceIndex].allocationType == GraphicsAllocation::AllocationType::BUFFER_COMPRESSED) {
if (preferCompressed) {
allocationInfo[rootDeviceIndex].zeroCopyAllowed = false;
allocationInfo[rootDeviceIndex].allocateMemory = true;
}
@@ -277,12 +279,14 @@ Buffer *Buffer::create(Context *context,
allocationInfo[rootDeviceIndex].allocateMemory, size, allocationInfo[rootDeviceIndex].allocationType, context->areMultiStorageAllocationsPreferred(),
*hwInfo, context->getDeviceBitfieldForAllocation(rootDeviceIndex), context->isSingleDeviceContext());
allocProperties.flags.crossRootDeviceAccess = context->getRootDeviceIndices().size() > 1;
allocProperties.flags.preferCompressed = preferCompressed;
allocationInfo[rootDeviceIndex].memory = memoryManager->createGraphicsAllocationFromExistingStorage(allocProperties, ptr, multiGraphicsAllocation);
} else {
AllocationProperties allocProperties = MemoryPropertiesHelper::getAllocationProperties(rootDeviceIndex, memoryProperties,
allocationInfo[rootDeviceIndex].allocateMemory, size, allocationInfo[rootDeviceIndex].allocationType, context->areMultiStorageAllocationsPreferred(),
*hwInfo, context->getDeviceBitfieldForAllocation(rootDeviceIndex), context->isSingleDeviceContext());
allocProperties.flags.crossRootDeviceAccess = context->getRootDeviceIndices().size() > 1;
allocProperties.flags.preferCompressed = preferCompressed;
allocationInfo[rootDeviceIndex].memory = memoryManager->allocateGraphicsMemoryWithProperties(allocProperties, hostPtr);
if (allocationInfo[rootDeviceIndex].memory) {
ptr = reinterpret_cast<void *>(allocationInfo[rootDeviceIndex].memory->getUnderlyingBuffer());