mirror of
https://github.com/intel/compute-runtime.git
synced 2026-01-08 14:02:58 +08:00
Add map allocation for images
Related-To: NEO-3097 Change-Id: I5bfd89fd597a8d55597ff7a2aa05b2abd278d5bd Signed-off-by: Zbigniew Zdanowicz <zbigniew.zdanowicz@intel.com>
This commit is contained in:
committed by
sys_ocldev
parent
18a9e164e1
commit
0c6823afd6
@@ -350,7 +350,7 @@ Image *Image::create(Context *context,
|
||||
} else {
|
||||
errcodeRet = cmdQ->enqueueWriteImage(image, CL_TRUE, ©Origin[0], ©Region[0],
|
||||
hostPtrRowPitch, hostPtrSlicePitch,
|
||||
hostPtr, 0, nullptr, nullptr);
|
||||
hostPtr, nullptr, 0, nullptr, nullptr);
|
||||
}
|
||||
} else {
|
||||
image->transferData(memory->getUnderlyingBuffer(), imgInfo.rowPitch, imgInfo.slicePitch,
|
||||
@@ -945,7 +945,7 @@ cl_int Image::writeNV12Planes(const void *hostPtr, size_t hostPtrRowPitch) {
|
||||
nullptr,
|
||||
retVal));
|
||||
|
||||
retVal = cmdQ->enqueueWriteImage(imageYPlane.get(), CL_TRUE, origin, region, hostPtrRowPitch, 0, hostPtr, 0, nullptr, nullptr);
|
||||
retVal = cmdQ->enqueueWriteImage(imageYPlane.get(), CL_TRUE, origin, region, hostPtrRowPitch, 0, hostPtr, nullptr, 0, nullptr, nullptr);
|
||||
|
||||
// UV Plane is two times smaller than Plane Y
|
||||
region[0] = region[0] / 2;
|
||||
@@ -967,7 +967,7 @@ cl_int Image::writeNV12Planes(const void *hostPtr, size_t hostPtrRowPitch) {
|
||||
nullptr,
|
||||
retVal));
|
||||
|
||||
retVal = cmdQ->enqueueWriteImage(imageUVPlane.get(), CL_TRUE, origin, region, hostPtrRowPitch, 0, hostPtr, 0, nullptr, nullptr);
|
||||
retVal = cmdQ->enqueueWriteImage(imageUVPlane.get(), CL_TRUE, origin, region, hostPtrRowPitch, 0, hostPtr, nullptr, 0, nullptr, nullptr);
|
||||
|
||||
return retVal;
|
||||
}
|
||||
|
||||
@@ -314,19 +314,20 @@ void *MemObj::getBasePtrForMap() {
|
||||
if (associatedMemObject) {
|
||||
return associatedMemObject->getBasePtrForMap();
|
||||
}
|
||||
if (getMapAllocation()) {
|
||||
return getMapAllocation()->getUnderlyingBuffer();
|
||||
}
|
||||
if (getFlags() & CL_MEM_USE_HOST_PTR) {
|
||||
return getHostPtr();
|
||||
} else {
|
||||
TakeOwnershipWrapper<MemObj> memObjOwnership(*this);
|
||||
auto memory = memoryManager->allocateSystemMemory(getSize(), MemoryConstants::pageSize);
|
||||
setAllocatedMapPtr(memory);
|
||||
AllocationProperties properties{false, getSize(), GraphicsAllocation::AllocationType::EXTERNAL_HOST_PTR};
|
||||
auto allocation = memoryManager->allocateGraphicsMemoryWithProperties(properties, memory);
|
||||
setMapAllocation(allocation);
|
||||
return getAllocatedMapPtr();
|
||||
if (getMapAllocation()) {
|
||||
return getMapAllocation()->getUnderlyingBuffer();
|
||||
} else {
|
||||
auto memory = memoryManager->allocateSystemMemory(getSize(), MemoryConstants::pageSize);
|
||||
setAllocatedMapPtr(memory);
|
||||
AllocationProperties properties{false, getSize(), GraphicsAllocation::AllocationType::EXTERNAL_HOST_PTR};
|
||||
auto allocation = memoryManager->allocateGraphicsMemoryWithProperties(properties, memory);
|
||||
setMapAllocation(allocation);
|
||||
return getAllocatedMapPtr();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user