Support offsets in blitter

Related-To: NEO-3020

Change-Id: I7ce13f0cf890c47fd40e92b5bb20c4f4ce291653
Signed-off-by: Filip Hazubski <filip.hazubski@intel.com>
This commit is contained in:
Filip Hazubski
2019-05-28 17:13:47 +02:00
committed by sys_ocldev
parent 0d19aa2bfa
commit befbffc967
10 changed files with 49 additions and 17 deletions

View File

@@ -420,9 +420,9 @@ void CommandStreamReceiver::blitWithHostPtr(Buffer &buffer, void *hostPtr, uint6
true, false, true));
if (BlitterConstants::BlitWithHostPtrDirection::FromHostPtr == copyDirection) {
blitBuffer(buffer, *hostPtrBuffer, hostPtrSize, csrDependencies);
blitBuffer(buffer, *hostPtrBuffer, 0, 0, hostPtrSize, csrDependencies);
} else {
blitBuffer(*hostPtrBuffer, buffer, hostPtrSize, csrDependencies);
blitBuffer(*hostPtrBuffer, buffer, 0, 0, hostPtrSize, csrDependencies);
}
}
} // namespace NEO

View File

@@ -176,7 +176,8 @@ class CommandStreamReceiver {
void blitWithHostPtr(Buffer &buffer, void *hostPtr, uint64_t hostPtrSize,
BlitterConstants::BlitWithHostPtrDirection copyDirection, CsrDependencies &csrDependencies);
virtual void blitBuffer(Buffer &dstBuffer, Buffer &srcBuffer, uint64_t sourceSize, CsrDependencies &csrDependencies) = 0;
virtual void blitBuffer(Buffer &dstBuffer, Buffer &srcBuffer, uint64_t dstOffset, uint64_t srcOffset,
uint64_t copySize, CsrDependencies &csrDependencies) = 0;
ScratchSpaceController *getScratchSpaceController() const {
return scratchSpaceController.get();

View File

@@ -70,7 +70,8 @@ class CommandStreamReceiverHw : public CommandStreamReceiver {
return CommandStreamReceiverType::CSR_HW;
}
void blitBuffer(Buffer &dstBuffer, Buffer &srcBuffer, uint64_t sourceSize, CsrDependencies &csrDependencies) override;
void blitBuffer(Buffer &dstBuffer, Buffer &srcBuffer, uint64_t dstOffset, uint64_t srcOffset,
uint64_t copySize, CsrDependencies &csrDependencies) override;
protected:
using CommandStreamReceiver::osContext;

View File

@@ -725,21 +725,22 @@ bool CommandStreamReceiverHw<GfxFamily>::detectInitProgrammingFlagsRequired(cons
}
template <typename GfxFamily>
void CommandStreamReceiverHw<GfxFamily>::blitBuffer(Buffer &dstBuffer, Buffer &srcBuffer, uint64_t sourceSize, CsrDependencies &csrDependencies) {
void CommandStreamReceiverHw<GfxFamily>::blitBuffer(Buffer &dstBuffer, Buffer &srcBuffer, uint64_t dstOffset, uint64_t srcOffset,
uint64_t copySize, CsrDependencies &csrDependencies) {
using MI_BATCH_BUFFER_END = typename GfxFamily::MI_BATCH_BUFFER_END;
using MI_FLUSH_DW = typename GfxFamily::MI_FLUSH_DW;
UNRECOVERABLE_IF(osContext->getEngineType() != aub_stream::EngineType::ENGINE_BCS);
auto lock = obtainUniqueOwnership();
auto &commandStream = getCS(BlitCommandsHelper<GfxFamily>::estimateBlitCommandsSize(sourceSize, csrDependencies));
auto &commandStream = getCS(BlitCommandsHelper<GfxFamily>::estimateBlitCommandsSize(copySize, csrDependencies));
auto commandStreamStart = commandStream.getUsed();
auto newTaskCount = taskCount + 1;
latestSentTaskCount = newTaskCount;
TimestampPacketHelper::programCsrDependencies<GfxFamily>(commandStream, csrDependencies);
BlitCommandsHelper<GfxFamily>::dispatchBlitCommandsForBuffer(dstBuffer, srcBuffer, commandStream, sourceSize);
BlitCommandsHelper<GfxFamily>::dispatchBlitCommandsForBuffer(dstBuffer, srcBuffer, commandStream, dstOffset, srcOffset, copySize);
auto miFlushDwCmd = reinterpret_cast<MI_FLUSH_DW *>(commandStream.getSpace(sizeof(MI_FLUSH_DW)));
*miFlushDwCmd = GfxFamily::cmdInitMiFlushDw;

View File

@@ -16,7 +16,8 @@ class LinearStream;
template <typename GfxFamily>
struct BlitCommandsHelper {
static size_t estimateBlitCommandsSize(uint64_t copySize, CsrDependencies &csrDependencies);
static void dispatchBlitCommandsForBuffer(Buffer &dstBuffer, Buffer &srcBuffer, LinearStream &linearStream, uint64_t copySize);
static void dispatchBlitCommandsForBuffer(Buffer &dstBuffer, Buffer &srcBuffer, LinearStream &linearStream,
uint64_t dstOffset, uint64_t srcOffset, uint64_t copySize);
static void appendBlitCommandsForBuffer(Buffer &dstBuffer, Buffer &srcBuffer, typename GfxFamily::XY_COPY_BLT &blitCmd);
};
} // namespace NEO

View File

@@ -39,8 +39,8 @@ size_t BlitCommandsHelper<GfxFamily>::estimateBlitCommandsSize(uint64_t copySize
}
template <typename GfxFamily>
void BlitCommandsHelper<GfxFamily>::dispatchBlitCommandsForBuffer(Buffer &dstBuffer, Buffer &srcBuffer,
LinearStream &linearStream, uint64_t copySize) {
void BlitCommandsHelper<GfxFamily>::dispatchBlitCommandsForBuffer(Buffer &dstBuffer, Buffer &srcBuffer, LinearStream &linearStream,
uint64_t dstOffset, uint64_t srcOffset, uint64_t copySize) {
uint64_t sizeToBlit = copySize;
uint64_t width = 1;
uint64_t height = 1;
@@ -71,8 +71,8 @@ void BlitCommandsHelper<GfxFamily>::dispatchBlitCommandsForBuffer(Buffer &dstBuf
bltCmd->setDestinationPitch(static_cast<uint32_t>(width));
bltCmd->setSourcePitch(static_cast<uint32_t>(width));
bltCmd->setDestinationBaseAddress(dstBuffer.getGraphicsAllocation()->getGpuAddress() + offset);
bltCmd->setSourceBaseAddress(srcBuffer.getGraphicsAllocation()->getGpuAddress() + offset);
bltCmd->setDestinationBaseAddress(dstBuffer.getGraphicsAllocation()->getGpuAddress() + dstOffset + offset);
bltCmd->setSourceBaseAddress(srcBuffer.getGraphicsAllocation()->getGpuAddress() + srcOffset + offset);
appendBlitCommandsForBuffer(dstBuffer, srcBuffer, *bltCmd);