Simplify getAllocationProperties

Change-Id: I006337ec700e50259c46be1fd73fde34562c8b83
Related-To: NEO-2535
Signed-off-by: Filip Hazubski <filip.hazubski@intel.com>
This commit is contained in:
Filip Hazubski
2019-04-26 09:48:23 +02:00
committed by sys_ocldev
parent 068a8d7189
commit ddcd3fbbed
4 changed files with 45 additions and 17 deletions

View File

@ -135,3 +135,27 @@ TEST(MemObjHelper, givenParentMemObjAndHostPtrFlagsWhenValidatingMemoryPropertie
EXPECT_FALSE(MemObjHelper::validateMemoryPropertiesForImage(properties, imageWithAccessFlagsUnrestricted.get()));
}
}
TEST(MemObjHelper, givenDifferentParametersWhenCallingFillCachePolicyInPropertiesThenFlushL3FlagsAreCorrectlySet) {
AllocationProperties allocationProperties{0, GraphicsAllocation::AllocationType::BUFFER};
for (auto uncached : ::testing::Bool()) {
for (auto readOnly : ::testing::Bool()) {
for (auto deviceOnlyVisibilty : ::testing::Bool()) {
if (uncached || readOnly || deviceOnlyVisibilty) {
allocationProperties.flags.flushL3RequiredForRead = true;
allocationProperties.flags.flushL3RequiredForWrite = true;
MemObjHelper::fillCachePolicyInProperties(allocationProperties, uncached, readOnly, deviceOnlyVisibilty);
EXPECT_FALSE(allocationProperties.flags.flushL3RequiredForRead);
EXPECT_FALSE(allocationProperties.flags.flushL3RequiredForWrite);
} else {
allocationProperties.flags.flushL3RequiredForRead = false;
allocationProperties.flags.flushL3RequiredForWrite = false;
MemObjHelper::fillCachePolicyInProperties(allocationProperties, uncached, readOnly, deviceOnlyVisibilty);
EXPECT_TRUE(allocationProperties.flags.flushL3RequiredForRead);
EXPECT_TRUE(allocationProperties.flags.flushL3RequiredForWrite);
}
}
}
}
}