Add allocation type for Write Combined memory

Related-To: NEO-3392
Change-Id: I8c61b2ca2a25325d47095568703888688a2eb069
Signed-off-by: Krzysztof Gibala <krzysztof.gibala@intel.com>
This commit is contained in:
Krzysztof Gibala
2019-07-02 16:39:32 +02:00
committed by sys_ocldev
parent 931bd04a99
commit 09e87879db
7 changed files with 48 additions and 4 deletions

View File

@@ -933,7 +933,8 @@ AllocationTypeTestCase allocationTypeValues[] = {
{GraphicsAllocation::AllocationType::SVM_ZERO_COPY, "SVM_ZERO_COPY"},
{GraphicsAllocation::AllocationType::TAG_BUFFER, "TAG_BUFFER"},
{GraphicsAllocation::AllocationType::TIMESTAMP_PACKET_TAG_BUFFER, "TIMESTAMP_PACKET_TAG_BUFFER"},
{GraphicsAllocation::AllocationType::UNKNOWN, "UNKNOWN"}};
{GraphicsAllocation::AllocationType::UNKNOWN, "UNKNOWN"},
{GraphicsAllocation::AllocationType::WRITE_COMBINED, "WRITE_COMBINED"}};
class AllocationTypeLogging : public ::testing::TestWithParam<AllocationTypeTestCase> {};

View File

@@ -1692,6 +1692,25 @@ TEST_F(WddmMemoryManagerSimpleTest, givenSvmCpuAllocationWhenSizeAndAlignmentPro
memoryManager->freeGraphicsMemory(allocation);
}
TEST_F(WddmMemoryManagerSimpleTest, givenWriteCombinedAllocationThenCpuAddressIsEqualToGpuAddress) {
if (is32bit) {
GTEST_SKIP();
}
memoryManager.reset(new MockWddmMemoryManager(true, true, *executionEnvironment));
size_t size = 2 * MemoryConstants::megaByte;
auto allocation = static_cast<WddmAllocation *>(memoryManager->allocateGraphicsMemoryWithProperties({size, GraphicsAllocation::AllocationType::WRITE_COMBINED}));
ASSERT_NE(nullptr, allocation);
EXPECT_EQ(size, allocation->getUnderlyingBufferSize());
EXPECT_NE(nullptr, allocation->getUnderlyingBuffer());
EXPECT_NE(nullptr, reinterpret_cast<void *>(allocation->getGpuAddress()));
if (executionEnvironment->isFullRangeSvm()) {
EXPECT_EQ(allocation->getUnderlyingBuffer(), reinterpret_cast<void *>(allocation->getGpuAddress()));
}
memoryManager->freeGraphicsMemory(allocation);
}
TEST_F(WddmMemoryManagerSimpleTest, whenCreatingWddmMemoryManagerThenSupportsMultiStorageResourcesFlagIsSetToFalse) {
EXPECT_TRUE(memoryManager->supportsMultiStorageResources);
}