Require system memory for command buffers.

- Except when they ask for multiOsContext capabilities.

Change-Id: I4589bd48cd6dc7a582c7f3bb7d481874ce576d22
Signed-off-by: Michal Mrozek <michal.mrozek@intel.com>
This commit is contained in:
Michal Mrozek 2020-04-07 12:22:47 +02:00 committed by sys_ocldev
parent 1544f23281
commit 23dd6b95ec
2 changed files with 26 additions and 0 deletions

View File

@ -47,6 +47,27 @@ TEST(MemoryManagerGetAlloctionDataTest, givenNonHostMemoryAllocatoinTypeWhenAllo
EXPECT_EQ(nullptr, allocData.hostPtr);
}
TEST(MemoryManagerGetAlloctionDataTest, givenCommandBufferAllocationTypeWhenGetAllocationDataIsCalledThenSystemMemoryIsRequested) {
AllocationData allocData;
AllocationProperties properties(0, true, 10, GraphicsAllocation::AllocationType::COMMAND_BUFFER, false);
MockMemoryManager mockMemoryManager;
MockMemoryManager::getAllocationData(allocData, properties, nullptr, mockMemoryManager.createStorageInfoFromProperties(properties));
EXPECT_TRUE(allocData.flags.useSystemMemory);
}
TEST(MemoryManagerGetAlloctionDataTest, givenCommandBufferAllocationTypeAndMultiOsStorageRequirementWhenGetAllocationDataIsCalledThenSystemMemoryIsRequested) {
AllocationData allocData;
AllocationProperties properties(0, true, 10, GraphicsAllocation::AllocationType::COMMAND_BUFFER, true);
properties.flags.multiOsContextCapable = true;
MockMemoryManager mockMemoryManager;
MockMemoryManager::getAllocationData(allocData, properties, nullptr, mockMemoryManager.createStorageInfoFromProperties(properties));
EXPECT_FALSE(allocData.flags.useSystemMemory);
}
TEST(MemoryManagerGetAlloctionDataTest, givenAllocateMemoryFlagTrueWhenHostPtrIsNotNullThenAllocationDataHasHostPtrNulled) {
AllocationData allocData;
char memory = 0;

View File

@ -280,6 +280,7 @@ bool MemoryManager::getAllocationData(AllocationData &allocationData, const Allo
}
switch (properties.allocationType) {
case GraphicsAllocation::AllocationType::COMMAND_BUFFER:
case GraphicsAllocation::AllocationType::BUFFER_HOST_MEMORY:
case GraphicsAllocation::AllocationType::DEVICE_QUEUE_BUFFER:
case GraphicsAllocation::AllocationType::EXTERNAL_HOST_PTR:
@ -311,6 +312,10 @@ bool MemoryManager::getAllocationData(AllocationData &allocationData, const Allo
}
}
if (properties.allocationType == GraphicsAllocation::AllocationType::COMMAND_BUFFER && properties.flags.multiOsContextCapable) {
allocationData.flags.useSystemMemory = false;
}
switch (properties.allocationType) {
case GraphicsAllocation::AllocationType::COMMAND_BUFFER:
case GraphicsAllocation::AllocationType::DEVICE_QUEUE_BUFFER: