DrmAllocation with correct pair of cpu address and gpu address

correct mapping of cpu and gpu address in memory allocation
in case of NonSVM. Also, used only aligned address since offset
is already calculated and written to "allocationOffset".
gpuBaseAddress is programmed with 0 instead of base address of
heap because it represents GPU's address space.

v2: add allocationOffset to the aligned address in allocation
    data to point to exact starting address of buffer in two
    NonSVM allocation unit tests

Change-Id: I32ef512de64a13459b7c132672f837c5cb210ada
Signed-off-by: dongwonk <dongwon.kim@intel.com>
This commit is contained in:
dongwonk
2019-02-07 11:22:41 -08:00
committed by sys_ocldev
parent 0240f239ad
commit c2f5fccfd0
2 changed files with 5 additions and 6 deletions

View File

@@ -2801,7 +2801,7 @@ TEST_F(DrmMemoryManagerTest, givenDrmMemoryManagerWhenAllocateGraphicsMemoryForN
auto allocation = memoryManager->allocateGraphicsMemoryForNonSvmHostPtr(13, hostPtr);
EXPECT_NE(nullptr, allocation);
EXPECT_EQ(reinterpret_cast<void *>(0x5001), allocation->getUnderlyingBuffer());
EXPECT_EQ(0x5001u, reinterpret_cast<uint64_t>(allocation->getUnderlyingBuffer()) + allocation->allocationOffset);
EXPECT_EQ(13u, allocation->getUnderlyingBufferSize());
EXPECT_EQ(1u, allocation->allocationOffset);
@@ -3069,7 +3069,7 @@ TEST_F(DrmMemoryManagerTest, givenDisabledHostPtrTrackingWhenAllocateGraphicsMem
auto allocation = memoryManager->allocateGraphicsMemoryForNonSvmHostPtr(13, hostPtr);
EXPECT_NE(nullptr, allocation);
EXPECT_EQ(reinterpret_cast<void *>(0x5001), allocation->getUnderlyingBuffer());
EXPECT_EQ(0x5001u, reinterpret_cast<uint64_t>(allocation->getUnderlyingBuffer()) + allocation->allocationOffset);
EXPECT_EQ(13u, allocation->getUnderlyingBufferSize());
EXPECT_EQ(1u, allocation->allocationOffset);