Add Blitter support for ReadBufferRect

Change-Id: I530acc5a2b70fcd82f8ca5db46a0fa474d493a47
Signed-off-by: Krzysztof Gibala <krzysztof.gibala@intel.com>
Related-To: NEO-4013
This commit is contained in:
Krzysztof Gibala
2020-02-25 09:55:13 +01:00
committed by sys_ocldev
parent ec6d73e632
commit 0d342ac1aa
13 changed files with 440 additions and 120 deletions

View File

@@ -18,6 +18,7 @@ struct ClBlitProperties {
static BlitProperties constructProperties(BlitterConstants::BlitDirection blitDirection,
CommandStreamReceiver &commandStreamReceiver,
const BuiltinOpParams &builtinOpParams) {
if (BlitterConstants::BlitDirection::BufferToBuffer == blitDirection) {
auto dstOffset = builtinOpParams.dstOffset.x + builtinOpParams.dstMemObj->getOffset();
auto srcOffset = builtinOpParams.srcOffset.x + builtinOpParams.srcMemObj->getOffset();
@@ -28,21 +29,27 @@ struct ClBlitProperties {
}
GraphicsAllocation *gpuAllocation = nullptr;
size_t copyOffset = 0;
Vec3<size_t> copyOffset = 0;
void *hostPtr = nullptr;
size_t hostPtrOffset = 0;
Vec3<size_t> hostPtrOffset = 0;
uint64_t memObjGpuVa = 0;
uint64_t hostAllocGpuVa = 0;
GraphicsAllocation *hostAllocation = builtinOpParams.transferAllocation;
Vec3<size_t> copySize = 0;
size_t hostRowPitch = 0;
size_t hostSlicePitch = 0;
size_t gpuRowPitch = 0;
size_t gpuSlicePitch = 0;
if (BlitterConstants::BlitDirection::HostPtrToBuffer == blitDirection) {
// write buffer
hostPtr = builtinOpParams.srcPtr;
hostPtrOffset = builtinOpParams.srcOffset.x;
copyOffset = builtinOpParams.dstOffset.x;
hostPtrOffset = builtinOpParams.srcOffset;
copyOffset = builtinOpParams.dstOffset;
memObjGpuVa = castToUint64(builtinOpParams.dstPtr);
hostAllocGpuVa = castToUint64(builtinOpParams.srcPtr);
@@ -54,14 +61,15 @@ struct ClBlitProperties {
gpuAllocation = builtinOpParams.dstMemObj->getGraphicsAllocation();
memObjGpuVa = (gpuAllocation->getGpuAddress() + builtinOpParams.dstMemObj->getOffset());
}
copySize.x = builtinOpParams.size.x;
}
if (BlitterConstants::BlitDirection::BufferToHostPtr == blitDirection) {
// read buffer
hostPtr = builtinOpParams.dstPtr;
hostPtrOffset = builtinOpParams.dstOffset.x;
copyOffset = builtinOpParams.srcOffset.x;
hostPtrOffset = builtinOpParams.dstOffset;
copyOffset = builtinOpParams.srcOffset;
memObjGpuVa = castToUint64(builtinOpParams.srcPtr);
hostAllocGpuVa = castToUint64(builtinOpParams.dstPtr);
@@ -73,6 +81,12 @@ struct ClBlitProperties {
gpuAllocation = builtinOpParams.srcMemObj->getGraphicsAllocation();
memObjGpuVa = (gpuAllocation->getGpuAddress() + builtinOpParams.srcMemObj->getOffset());
}
hostRowPitch = builtinOpParams.dstRowPitch;
hostSlicePitch = builtinOpParams.dstSlicePitch;
gpuRowPitch = builtinOpParams.srcRowPitch;
gpuSlicePitch = builtinOpParams.srcSlicePitch;
copySize = builtinOpParams.size;
}
UNRECOVERABLE_IF(BlitterConstants::BlitDirection::HostPtrToBuffer != blitDirection &&
@@ -80,13 +94,15 @@ struct ClBlitProperties {
return BlitProperties::constructPropertiesForReadWriteBuffer(blitDirection, commandStreamReceiver, gpuAllocation,
hostAllocation, hostPtr, memObjGpuVa, hostAllocGpuVa,
hostPtrOffset, copyOffset, builtinOpParams.size.x);
hostPtrOffset, copyOffset, copySize,
hostRowPitch, hostSlicePitch,
gpuRowPitch, gpuSlicePitch);
}
static BlitterConstants::BlitDirection obtainBlitDirection(uint32_t commandType) {
if (CL_COMMAND_WRITE_BUFFER == commandType) {
return BlitterConstants::BlitDirection::HostPtrToBuffer;
} else if (CL_COMMAND_READ_BUFFER == commandType) {
} else if (CL_COMMAND_READ_BUFFER == commandType || CL_COMMAND_READ_BUFFER_RECT == commandType) {
return BlitterConstants::BlitDirection::BufferToHostPtr;
} else {
UNRECOVERABLE_IF(CL_COMMAND_COPY_BUFFER != commandType);