Simplify Memory Manager API [3/4]

- remove method allocateGraphicsMemory(size_t size)
- pass allocation type in allocation properties
- set allocation type in allocateGraphicsMemoryInPreferredPool

Change-Id: Ia9296d0ab2f711b7d78aff615cb56b3a246b60ec
Signed-off-by: Mateusz Jablonski <mateusz.jablonski@intel.com>
This commit is contained in:
Mateusz Jablonski
2018-12-11 18:56:37 +01:00
committed by sys_ocldev
parent 686785ce5d
commit 8ec072d39c
64 changed files with 371 additions and 339 deletions

View File

@@ -192,9 +192,9 @@ Buffer *Buffer::create(Context *context,
}
if (!memory) {
AllocationProperties allocProperties = MemObjHelper::getAllocationProperties(properties.flags_intel, allocateMemory, size);
AllocationProperties allocProperties = MemObjHelper::getAllocationProperties(properties.flags_intel, allocateMemory, size, allocationType);
DevicesBitfield devices = MemObjHelper::getDevicesBitfield(properties);
memory = memoryManager->allocateGraphicsMemoryInPreferredPool(allocProperties, devices, hostPtr, allocationType);
memory = memoryManager->allocateGraphicsMemoryInPreferredPool(allocProperties, devices, hostPtr);
}
if (allocateMemory && memory && MemoryPool::isSystemMemoryPool(memory->getMemoryPool())) {
@@ -207,9 +207,9 @@ Buffer *Buffer::create(Context *context,
allocationType = GraphicsAllocation::AllocationType::BUFFER_HOST_MEMORY;
zeroCopyAllowed = false;
copyMemoryFromHostPtr = true;
AllocationProperties allocProperties = MemObjHelper::getAllocationProperties(properties.flags_intel, true, size);
AllocationProperties allocProperties = MemObjHelper::getAllocationProperties(properties.flags_intel, true, size, allocationType);
DevicesBitfield devices = MemObjHelper::getDevicesBitfield(properties);
memory = memoryManager->allocateGraphicsMemoryInPreferredPool(allocProperties, devices, nullptr, allocationType);
memory = memoryManager->allocateGraphicsMemoryInPreferredPool(allocProperties, devices, nullptr);
}
if (!memory) {

View File

@@ -33,8 +33,8 @@ bool MemObjHelper::validateExtraMemoryProperties(const MemoryProperties &propert
return true;
}
AllocationProperties MemObjHelper::getAllocationProperties(cl_mem_flags_intel flags, bool allocateMemory, size_t size) {
return AllocationProperties(allocateMemory, size);
AllocationProperties MemObjHelper::getAllocationProperties(cl_mem_flags_intel flags, bool allocateMemory, size_t size, GraphicsAllocation::AllocationType type) {
return AllocationProperties(allocateMemory, size, type);
}
DevicesBitfield MemObjHelper::getDevicesBitfield(const MemoryProperties &properties) {

View File

@@ -50,7 +50,7 @@ class MemObjHelper {
static bool validateExtraMemoryProperties(const MemoryProperties &properties);
static AllocationProperties getAllocationProperties(cl_mem_flags_intel flags, bool allocateMemory, size_t size);
static AllocationProperties getAllocationProperties(cl_mem_flags_intel flags, bool allocateMemory, size_t size, GraphicsAllocation::AllocationType type);
static DevicesBitfield getDevicesBitfield(const MemoryProperties &properties);

View File

@@ -51,9 +51,9 @@ Pipe *Pipe::create(Context *context,
memoryProperties.flags = flags;
while (true) {
auto size = static_cast<size_t>(packetSize * (maxPackets + 1) + intelPipeHeaderReservedSpace);
AllocationProperties allocProperties = MemObjHelper::getAllocationProperties(flags, true, size);
AllocationProperties allocProperties = MemObjHelper::getAllocationProperties(flags, true, size, GraphicsAllocation::AllocationType::PIPE);
DevicesBitfield devices = MemObjHelper::getDevicesBitfield(memoryProperties);
GraphicsAllocation *memory = memoryManager->allocateGraphicsMemoryInPreferredPool(allocProperties, devices, nullptr, GraphicsAllocation::AllocationType::PIPE);
GraphicsAllocation *memory = memoryManager->allocateGraphicsMemoryInPreferredPool(allocProperties, devices, nullptr);
if (!memory) {
errcodeRet = CL_OUT_OF_HOST_MEMORY;
break;