Do not allocate Linear Stream in system memory.
Change-Id: I2d9abaab3358907037265214cec80cc84d6b9c0a
This commit is contained in:
parent
16c3117b09
commit
fe85c1d974
|
@ -257,7 +257,6 @@ bool MemoryManager::getAllocationData(AllocationData &allocationData, const Allo
|
|||
|
||||
switch (properties.allocationType) {
|
||||
case GraphicsAllocation::AllocationType::UNDECIDED:
|
||||
case GraphicsAllocation::AllocationType::LINEAR_STREAM:
|
||||
case GraphicsAllocation::AllocationType::FILL_PATTERN:
|
||||
case GraphicsAllocation::AllocationType::TIMESTAMP_TAG_BUFFER:
|
||||
allocationData.flags.useSystemMemory = true;
|
||||
|
@ -275,6 +274,16 @@ bool MemoryManager::getAllocationData(AllocationData &allocationData, const Allo
|
|||
break;
|
||||
}
|
||||
|
||||
switch (properties.allocationType) {
|
||||
case GraphicsAllocation::AllocationType::LINEAR_STREAM:
|
||||
case GraphicsAllocation::AllocationType::KERNEL_ISA:
|
||||
case GraphicsAllocation::AllocationType::INTERNAL_HEAP:
|
||||
allocationData.flags.requiresCpuAccess = true;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
allocationData.flags.mustBeZeroCopy = mustBeZeroCopy;
|
||||
allocationData.flags.allocateMemory = properties.flags.allocateMemory;
|
||||
allocationData.flags.allow32Bit = allow32Bit;
|
||||
|
|
|
@ -199,7 +199,8 @@ class MemoryManager {
|
|||
uint32_t flushL3 : 1;
|
||||
uint32_t preferRenderCompressed : 1;
|
||||
uint32_t multiOsContextCapable : 1;
|
||||
uint32_t reserved : 22;
|
||||
uint32_t requiresCpuAccess : 1;
|
||||
uint32_t reserved : 21;
|
||||
} flags;
|
||||
uint32_t allFlags = 0;
|
||||
};
|
||||
|
|
|
@ -373,10 +373,11 @@ TEST(MemoryManagerTest, givenFillPatternTypeWhenGetAllocationDataIsCalledThenSys
|
|||
EXPECT_TRUE(allocData.flags.useSystemMemory);
|
||||
}
|
||||
|
||||
TEST(MemoryManagerTest, givenLinearStreamTypeWhenGetAllocationDataIsCalledThenSystemMemoryIsRequested) {
|
||||
TEST(MemoryManagerTest, givenLinearStreamTypeWhenGetAllocationDataIsCalledThenSystemMemoryIsNotRequested) {
|
||||
AllocationData allocData;
|
||||
MockMemoryManager::getAllocationData(allocData, {1, GraphicsAllocation::AllocationType::LINEAR_STREAM}, 0, nullptr);
|
||||
EXPECT_TRUE(allocData.flags.useSystemMemory);
|
||||
EXPECT_FALSE(allocData.flags.useSystemMemory);
|
||||
EXPECT_TRUE(allocData.flags.requiresCpuAccess);
|
||||
}
|
||||
|
||||
TEST(MemoryManagerTest, givenTimestampTagBufferTypeWhenGetAllocationDataIsCalledThenSystemMemoryIsRequested) {
|
||||
|
@ -422,14 +423,24 @@ TEST(MemoryManagerTest, givenInternalHeapTypeWhenGetAllocationDataIsCalledThenSy
|
|||
AllocationData allocData;
|
||||
MockMemoryManager::getAllocationData(allocData, {1, GraphicsAllocation::AllocationType::INTERNAL_HEAP}, 0, nullptr);
|
||||
EXPECT_FALSE(allocData.flags.useSystemMemory);
|
||||
EXPECT_TRUE(allocData.flags.requiresCpuAccess);
|
||||
}
|
||||
TEST(MemoryManagerTest, givenKernelIsaTypeWhenGetAllocationDataIsCalledThenSystemMemoryIsNotRequested) {
|
||||
AllocationData allocData;
|
||||
MockMemoryManager::getAllocationData(allocData, {1, GraphicsAllocation::AllocationType::KERNEL_ISA}, 0, nullptr);
|
||||
EXPECT_FALSE(allocData.flags.useSystemMemory);
|
||||
EXPECT_TRUE(allocData.flags.requiresCpuAccess);
|
||||
}
|
||||
|
||||
TEST(MemoryManagerTest, givenLinearStreamWhenGetAllocationDataIsCalledThenSystemMemoryIsNotRequested) {
|
||||
AllocationData allocData;
|
||||
MockMemoryManager::getAllocationData(allocData, {1, GraphicsAllocation::AllocationType::LINEAR_STREAM}, 0, nullptr);
|
||||
EXPECT_FALSE(allocData.flags.useSystemMemory);
|
||||
EXPECT_TRUE(allocData.flags.requiresCpuAccess);
|
||||
}
|
||||
|
||||
TEST(MemoryManagerTest, givenKernelIsaTypeWhenGetAllocationDataIsCalledThenInternalAllocationIsRequested) {
|
||||
AllocationData allocData;
|
||||
MockMemoryManager::getAllocationData(allocData, {1, GraphicsAllocation::AllocationType::KERNEL_ISA}, 0, nullptr);
|
||||
EXPECT_EQ(AllocationOrigin::INTERNAL_ALLOCATION, allocData.allocationOrigin);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue