Refactor allocateGraphicsMemoryInPreferredPool

- extend AllocationType to code necessary flags
- remove redundant args
- refactor Buffer::create()

Change-Id: Ic4b2e0931fad8198ad1cf4f79de210d815048ccf
This commit is contained in:
Hoppe, Mateusz
2018-07-24 18:36:26 +02:00
committed by sys_ocldev
parent c2454d5aa2
commit 4441387969
27 changed files with 468 additions and 112 deletions

View File

@@ -1223,16 +1223,16 @@ TEST(OsAgnosticMemoryManager, givenDisabledAsyncDeleterFlagWhenMemoryManagerIsCr
DebugManager.flags.EnableDeferredDeleter.set(defaultEnableDeferredDeleterFlag);
}
TEST(OsAgnosticMemoryManager, GivenEnabled64kbPagesWhenAllocationIsCreatedThenAlignedto64KbAllocationIsReturned) {
TEST(OsAgnosticMemoryManager, GivenEnabled64kbPagesWhenHostMemoryAllocationIsCreatedThenAlignedto64KbAllocationIsReturned) {
DebugManagerStateRestore dbgRestore;
DebugManager.flags.Enable64kbpages.set(true);
OsAgnosticMemoryManager memoryManager(true);
GraphicsAllocation *galloc = memoryManager.allocateGraphicsMemoryInPreferredPool(true, true, false, false, nullptr, 64 * 1024, GraphicsAllocation::AllocationType::BUFFER);
GraphicsAllocation *galloc = memoryManager.allocateGraphicsMemoryInPreferredPool(true, nullptr, 64 * 1024, GraphicsAllocation::AllocationType::BUFFER_HOST_MEMORY);
EXPECT_NE(nullptr, galloc);
memoryManager.freeGraphicsMemory(galloc);
galloc = memoryManager.allocateGraphicsMemoryInPreferredPool(true, true, true, false, nullptr, 64 * 1024, GraphicsAllocation::AllocationType::BUFFER);
galloc = memoryManager.allocateGraphicsMemoryInPreferredPool(true, nullptr, 64 * 1024, GraphicsAllocation::AllocationType::BUFFER_HOST_MEMORY);
EXPECT_NE(nullptr, galloc);
EXPECT_NE(nullptr, galloc->getUnderlyingBuffer());
EXPECT_EQ(0u, (uintptr_t)galloc->getUnderlyingBuffer() % MemoryConstants::pageSize64k);