mirror of
https://github.com/intel/compute-runtime.git
synced 2025-12-24 21:18:24 +08:00
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:
committed by
sys_ocldev
parent
9ac3529c6b
commit
aaf2f94887
@@ -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) {
|
||||
|
||||
Reference in New Issue
Block a user