Fix zeroCopy property for images

- zeroCopy means no need for data transfer when cpu transfer is
chosen during map/unmap operations
- tests cleanup

Change-Id: Id312267e51d593781c6fe536b6e96f42f32e5c02
This commit is contained in:
Hoppe, Mateusz
2018-08-22 10:00:40 +02:00
committed by sys_ocldev
parent 9ac3529c6b
commit aaf2f94887
10 changed files with 145 additions and 406 deletions

View File

@@ -1699,18 +1699,20 @@ class OsAgnosticMemoryManagerForImagesWithNoHostPtr : public OsAgnosticMemoryMan
return imageAllocation;
};
void freeGraphicsMemoryImpl(GraphicsAllocation *imageAllocation) override {
imageAllocation->setCpuPtrAndGpuAddress(lockResourceParam.retCpuPtr, imageAllocation->getGpuAddress());
imageAllocation->setCpuPtrAndGpuAddress(cpuPtr, imageAllocation->getGpuAddress());
OsAgnosticMemoryManager::freeGraphicsMemoryImpl(imageAllocation);
};
void *lockResource(GraphicsAllocation *imageAllocation) override {
lockResourceParam.wasCalled = true;
lockResourceParam.inImageAllocation = imageAllocation;
lockResourceParam.retCpuPtr = cpuPtr;
lockCpuPtr = alignedMalloc(imageAllocation->getUnderlyingBufferSize(), MemoryConstants::pageSize);
lockResourceParam.retCpuPtr = lockCpuPtr;
return lockResourceParam.retCpuPtr;
};
void unlockResource(GraphicsAllocation *imageAllocation) override {
unlockResourceParam.wasCalled = true;
unlockResourceParam.inImageAllocation = imageAllocation;
alignedFree(lockCpuPtr);
};
struct LockResourceParam {
@@ -1725,6 +1727,7 @@ class OsAgnosticMemoryManagerForImagesWithNoHostPtr : public OsAgnosticMemoryMan
protected:
void *cpuPtr = nullptr;
void *lockCpuPtr = nullptr;
};
HWTEST_F(AubCommandStreamReceiverTests, givenAubCommandStreamReceiverWhenWriteMemoryIsCalledOnImageWithNoHostPtrThenResourceShouldBeLockedToGetCpuAddress) {