mirror of
https://github.com/intel/compute-runtime.git
synced 2025-12-20 08:53:55 +08:00
fix: apply additional blit only for first and last blit commands
Modified BlitCommandsHelper object to apply additional blit properties only to first and last blit commands properly Related-To: NEO-13003 Signed-off-by: Young Jin Yoon <young.jin.yoon@intel.com>
This commit is contained in:
committed by
Compute-Runtime-Automation
parent
195ce3049e
commit
eae350bc45
@@ -211,16 +211,14 @@ void BlitCommandsHelper<GfxFamily>::dispatchBlitCommandsForBufferPerRow(const Bl
|
|||||||
|
|
||||||
const bool useAdditionalBlitProperties = rootDeviceEnvironment.getHelper<ProductHelper>().useAdditionalBlitProperties();
|
const bool useAdditionalBlitProperties = rootDeviceEnvironment.getHelper<ProductHelper>().useAdditionalBlitProperties();
|
||||||
|
|
||||||
if (useAdditionalBlitProperties) {
|
bool firstCommand = true;
|
||||||
applyAdditionalBlitProperties(blitProperties, bltCmd, rootDeviceEnvironment, false);
|
|
||||||
}
|
|
||||||
|
|
||||||
for (uint64_t slice = 0; slice < blitProperties.copySize.z; slice++) {
|
for (uint64_t slice = 0; slice < blitProperties.copySize.z; slice++) {
|
||||||
for (uint64_t row = 0; row < blitProperties.copySize.y; row++) {
|
for (uint64_t row = 0; row < blitProperties.copySize.y; row++) {
|
||||||
uint64_t offset = 0;
|
uint64_t offset = 0;
|
||||||
uint64_t sizeToBlit = blitProperties.copySize.x;
|
uint64_t sizeToBlit = blitProperties.copySize.x;
|
||||||
bool lastIteration = (slice == blitProperties.copySize.z - 1) && (row == blitProperties.copySize.y - 1);
|
bool lastIteration = (slice == blitProperties.copySize.z - 1) && (row == blitProperties.copySize.y - 1);
|
||||||
while (sizeToBlit != 0) {
|
while (sizeToBlit != 0) {
|
||||||
|
auto tmpCmd = bltCmd;
|
||||||
if (sizeToBlit > maxWidth) {
|
if (sizeToBlit > maxWidth) {
|
||||||
// dispatch 2D blit: maxBlitWidth x (1 .. maxBlitHeight)
|
// dispatch 2D blit: maxBlitWidth x (1 .. maxBlitHeight)
|
||||||
width = maxWidth;
|
width = maxWidth;
|
||||||
@@ -231,12 +229,12 @@ void BlitCommandsHelper<GfxFamily>::dispatchBlitCommandsForBufferPerRow(const Bl
|
|||||||
height = 1;
|
height = 1;
|
||||||
}
|
}
|
||||||
auto blitSize = width * height;
|
auto blitSize = width * height;
|
||||||
auto lastCommand = lastIteration && (sizeToBlit - blitSize == 0);
|
bool lastCommand = lastIteration && (sizeToBlit - blitSize == 0);
|
||||||
|
|
||||||
bltCmd.setDestinationX2CoordinateRight(static_cast<uint32_t>(width));
|
tmpCmd.setDestinationX2CoordinateRight(static_cast<uint32_t>(width));
|
||||||
bltCmd.setDestinationY2CoordinateBottom(static_cast<uint32_t>(height));
|
tmpCmd.setDestinationY2CoordinateBottom(static_cast<uint32_t>(height));
|
||||||
bltCmd.setDestinationPitch(static_cast<uint32_t>(width));
|
tmpCmd.setDestinationPitch(static_cast<uint32_t>(width));
|
||||||
bltCmd.setSourcePitch(static_cast<uint32_t>(width));
|
tmpCmd.setSourcePitch(static_cast<uint32_t>(width));
|
||||||
|
|
||||||
auto dstAddr = calculateBlitCommandDestinationBaseAddress(blitProperties, offset, row, slice);
|
auto dstAddr = calculateBlitCommandDestinationBaseAddress(blitProperties, offset, row, slice);
|
||||||
auto srcAddr = calculateBlitCommandSourceBaseAddress(blitProperties, offset, row, slice);
|
auto srcAddr = calculateBlitCommandSourceBaseAddress(blitProperties, offset, row, slice);
|
||||||
@@ -244,16 +242,17 @@ void BlitCommandsHelper<GfxFamily>::dispatchBlitCommandsForBufferPerRow(const Bl
|
|||||||
PRINT_DEBUG_STRING(debugManager.flags.PrintBlitDispatchDetails.get(), stdout,
|
PRINT_DEBUG_STRING(debugManager.flags.PrintBlitDispatchDetails.get(), stdout,
|
||||||
"\nBlit command. width: %u, height: %u, srcAddr: %#llx, dstAddr: %#llx ", width, height, srcAddr, dstAddr);
|
"\nBlit command. width: %u, height: %u, srcAddr: %#llx, dstAddr: %#llx ", width, height, srcAddr, dstAddr);
|
||||||
|
|
||||||
bltCmd.setDestinationBaseAddress(dstAddr);
|
tmpCmd.setDestinationBaseAddress(dstAddr);
|
||||||
bltCmd.setSourceBaseAddress(srcAddr);
|
tmpCmd.setSourceBaseAddress(srcAddr);
|
||||||
if (useAdditionalBlitProperties && lastCommand) {
|
if (useAdditionalBlitProperties && (firstCommand || lastCommand)) {
|
||||||
applyAdditionalBlitProperties(blitProperties, bltCmd, rootDeviceEnvironment, lastCommand);
|
applyAdditionalBlitProperties(blitProperties, tmpCmd, rootDeviceEnvironment, lastCommand);
|
||||||
|
firstCommand = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
appendBlitCommandsForBuffer(blitProperties, bltCmd, rootDeviceEnvironment);
|
appendBlitCommandsForBuffer(blitProperties, tmpCmd, rootDeviceEnvironment);
|
||||||
|
|
||||||
auto bltStream = linearStream.getSpaceForCmd<typename GfxFamily::XY_COPY_BLT>();
|
auto bltStream = linearStream.getSpaceForCmd<typename GfxFamily::XY_COPY_BLT>();
|
||||||
*bltStream = bltCmd;
|
*bltStream = tmpCmd;
|
||||||
|
|
||||||
dispatchPostBlitCommand(linearStream, rootDeviceEnvironment);
|
dispatchPostBlitCommand(linearStream, rootDeviceEnvironment);
|
||||||
|
|
||||||
@@ -294,10 +293,7 @@ void BlitCommandsHelper<GfxFamily>::dispatchBlitMemoryFill(const BlitProperties
|
|||||||
blitCmd.setColorDepth(colorDepth);
|
blitCmd.setColorDepth(colorDepth);
|
||||||
const bool useAdditionalBlitProperties = rootDeviceEnvironment.getHelper<ProductHelper>().useAdditionalBlitProperties();
|
const bool useAdditionalBlitProperties = rootDeviceEnvironment.getHelper<ProductHelper>().useAdditionalBlitProperties();
|
||||||
|
|
||||||
if (useAdditionalBlitProperties) {
|
bool firstCommand = true;
|
||||||
applyAdditionalBlitProperties(blitProperties, blitCmd, rootDeviceEnvironment, false);
|
|
||||||
}
|
|
||||||
|
|
||||||
uint64_t sizeToFill = blitProperties.copySize.x / patternSize;
|
uint64_t sizeToFill = blitProperties.copySize.x / patternSize;
|
||||||
uint64_t offset = blitProperties.dstOffset.x;
|
uint64_t offset = blitProperties.dstOffset.x;
|
||||||
while (sizeToFill != 0) {
|
while (sizeToFill != 0) {
|
||||||
@@ -321,12 +317,13 @@ void BlitCommandsHelper<GfxFamily>::dispatchBlitMemoryFill(const BlitProperties
|
|||||||
tmpCmd.setDestinationY2CoordinateBottom(static_cast<uint32_t>(height));
|
tmpCmd.setDestinationY2CoordinateBottom(static_cast<uint32_t>(height));
|
||||||
tmpCmd.setDestinationPitch(static_cast<uint32_t>(width * patternSize));
|
tmpCmd.setDestinationPitch(static_cast<uint32_t>(width * patternSize));
|
||||||
|
|
||||||
if (useAdditionalBlitProperties && lastCommand) {
|
|
||||||
applyAdditionalBlitProperties(blitProperties, tmpCmd, rootDeviceEnvironment, lastCommand);
|
|
||||||
}
|
|
||||||
appendBlitMemoryOptionsForFillBuffer(blitProperties.dstAllocation, tmpCmd, rootDeviceEnvironment);
|
appendBlitMemoryOptionsForFillBuffer(blitProperties.dstAllocation, tmpCmd, rootDeviceEnvironment);
|
||||||
appendBlitFillCommand(blitProperties, tmpCmd);
|
appendBlitFillCommand(blitProperties, tmpCmd);
|
||||||
|
|
||||||
|
if (useAdditionalBlitProperties && (firstCommand || lastCommand)) {
|
||||||
|
applyAdditionalBlitProperties(blitProperties, tmpCmd, rootDeviceEnvironment, lastCommand);
|
||||||
|
firstCommand = false;
|
||||||
|
}
|
||||||
auto cmd = linearStream.getSpaceForCmd<XY_COLOR_BLT>();
|
auto cmd = linearStream.getSpaceForCmd<XY_COLOR_BLT>();
|
||||||
*cmd = tmpCmd;
|
*cmd = tmpCmd;
|
||||||
offset += (blitSize * patternSize);
|
offset += (blitSize * patternSize);
|
||||||
@@ -362,22 +359,19 @@ void BlitCommandsHelper<GfxFamily>::dispatchBlitCommandsForImageRegion(const Bli
|
|||||||
dispatchPreBlitCommand(linearStream, rootDeviceEnvironment);
|
dispatchPreBlitCommand(linearStream, rootDeviceEnvironment);
|
||||||
const bool useAdditionalBlitProperties = rootDeviceEnvironment.getHelper<ProductHelper>().useAdditionalBlitProperties();
|
const bool useAdditionalBlitProperties = rootDeviceEnvironment.getHelper<ProductHelper>().useAdditionalBlitProperties();
|
||||||
|
|
||||||
if (useAdditionalBlitProperties) {
|
|
||||||
applyAdditionalBlitProperties(blitProperties, bltCmd, rootDeviceEnvironment, false);
|
|
||||||
}
|
|
||||||
|
|
||||||
for (uint32_t i = 0; i < blitProperties.copySize.z; i++) {
|
for (uint32_t i = 0; i < blitProperties.copySize.z; i++) {
|
||||||
appendSliceOffsets(blitProperties, bltCmd, i, rootDeviceEnvironment, srcSlicePitch, dstSlicePitch);
|
auto tmpCmd = bltCmd;
|
||||||
|
appendSliceOffsets(blitProperties, tmpCmd, i, rootDeviceEnvironment, srcSlicePitch, dstSlicePitch);
|
||||||
|
|
||||||
if (debugManager.flags.PrintImageBlitBlockCopyCmdDetails.get()) {
|
if (debugManager.flags.PrintImageBlitBlockCopyCmdDetails.get()) {
|
||||||
printImageBlitBlockCopyCommand(bltCmd, i);
|
printImageBlitBlockCopyCommand(tmpCmd, i);
|
||||||
}
|
}
|
||||||
|
bool lastCommand = (i == (blitProperties.copySize.z - 1));
|
||||||
if (useAdditionalBlitProperties && i == (blitProperties.copySize.z - 1)) {
|
if (useAdditionalBlitProperties && (i == 0 || lastCommand)) {
|
||||||
applyAdditionalBlitProperties(blitProperties, bltCmd, rootDeviceEnvironment, true);
|
applyAdditionalBlitProperties(blitProperties, tmpCmd, rootDeviceEnvironment, lastCommand);
|
||||||
}
|
}
|
||||||
auto cmd = linearStream.getSpaceForCmd<typename GfxFamily::XY_BLOCK_COPY_BLT>();
|
auto cmd = linearStream.getSpaceForCmd<typename GfxFamily::XY_BLOCK_COPY_BLT>();
|
||||||
*cmd = bltCmd;
|
*cmd = tmpCmd;
|
||||||
dispatchPostBlitCommand(linearStream, rootDeviceEnvironment);
|
dispatchPostBlitCommand(linearStream, rootDeviceEnvironment);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -34,12 +34,9 @@ void BlitCommandsHelper<GfxFamily>::dispatchBlitMemoryByteFill(const BlitPropert
|
|||||||
|
|
||||||
const bool useAdditionalBlitProperties = rootDeviceEnvironment.getHelper<ProductHelper>().useAdditionalBlitProperties();
|
const bool useAdditionalBlitProperties = rootDeviceEnvironment.getHelper<ProductHelper>().useAdditionalBlitProperties();
|
||||||
|
|
||||||
if (useAdditionalBlitProperties) {
|
|
||||||
applyAdditionalBlitProperties(blitProperties, blitCmd, rootDeviceEnvironment, false);
|
|
||||||
}
|
|
||||||
|
|
||||||
auto sizeToFill = blitProperties.copySize.x;
|
auto sizeToFill = blitProperties.copySize.x;
|
||||||
uint64_t offset = blitProperties.dstOffset.x;
|
uint64_t offset = blitProperties.dstOffset.x;
|
||||||
|
bool firstCommand = true;
|
||||||
while (sizeToFill != 0) {
|
while (sizeToFill != 0) {
|
||||||
auto tmpCmd = blitCmd;
|
auto tmpCmd = blitCmd;
|
||||||
tmpCmd.setDestinationStartAddress(ptrOffset(blitProperties.dstAllocation->getGpuAddress(), static_cast<size_t>(offset)));
|
tmpCmd.setDestinationStartAddress(ptrOffset(blitProperties.dstAllocation->getGpuAddress(), static_cast<size_t>(offset)));
|
||||||
@@ -61,8 +58,9 @@ void BlitCommandsHelper<GfxFamily>::dispatchBlitMemoryByteFill(const BlitPropert
|
|||||||
tmpCmd.setFillHeight(static_cast<uint32_t>(height));
|
tmpCmd.setFillHeight(static_cast<uint32_t>(height));
|
||||||
tmpCmd.setDestinationPitch(static_cast<uint32_t>(width));
|
tmpCmd.setDestinationPitch(static_cast<uint32_t>(width));
|
||||||
|
|
||||||
if (useAdditionalBlitProperties && lastCommand) {
|
if (useAdditionalBlitProperties && (firstCommand || lastCommand)) {
|
||||||
applyAdditionalBlitProperties(blitProperties, tmpCmd, rootDeviceEnvironment, lastCommand);
|
applyAdditionalBlitProperties(blitProperties, tmpCmd, rootDeviceEnvironment, lastCommand);
|
||||||
|
firstCommand = false;
|
||||||
}
|
}
|
||||||
appendBlitMemSetCommand(blitProperties, &tmpCmd);
|
appendBlitMemSetCommand(blitProperties, &tmpCmd);
|
||||||
|
|
||||||
|
|||||||
@@ -764,9 +764,9 @@ HWTEST2_F(BlitTests, givenPlatformWithBlitSyncPropertiesWithAndWithoutUseAdditio
|
|||||||
|
|
||||||
size_t copySizeX = BlitterConstants::maxBlitWidth - 1;
|
size_t copySizeX = BlitterConstants::maxBlitWidth - 1;
|
||||||
size_t copySizeY = BlitterConstants::maxBlitHeight - 1;
|
size_t copySizeY = BlitterConstants::maxBlitHeight - 1;
|
||||||
Vec3<size_t> copySize = {copySizeX, copySizeY, 0x2};
|
Vec3<size_t> copySize = {copySizeX, copySizeY, 0x3};
|
||||||
Vec3<size_t> srcSize = {copySizeX, copySizeY, 0x2};
|
Vec3<size_t> srcSize = {copySizeX, copySizeY, 0x3};
|
||||||
Vec3<size_t> dstSize = {copySizeX, copySizeY, 0x2};
|
Vec3<size_t> dstSize = {copySizeX, copySizeY, 0x3};
|
||||||
|
|
||||||
size_t srcRowPitch = srcSize.x;
|
size_t srcRowPitch = srcSize.x;
|
||||||
size_t srcSlicePitch = srcSize.y;
|
size_t srcSlicePitch = srcSize.y;
|
||||||
@@ -798,7 +798,7 @@ HWTEST2_F(BlitTests, givenPlatformWithBlitSyncPropertiesWithAndWithoutUseAdditio
|
|||||||
}
|
}
|
||||||
|
|
||||||
HWTEST2_F(BlitTests, givenPlatformWithBlitSyncPropertiesAndSingleBytePatternWithAndWithoutUseAdditionalPropertiesWhenCallingDispatchBlitMemoryColorFillThenTheResultsAreTheSame, MatchAny) {
|
HWTEST2_F(BlitTests, givenPlatformWithBlitSyncPropertiesAndSingleBytePatternWithAndWithoutUseAdditionalPropertiesWhenCallingDispatchBlitMemoryColorFillThenTheResultsAreTheSame, MatchAny) {
|
||||||
size_t dstSize = sizeof(uint8_t) * (BlitterConstants::maxBlitWidth * BlitterConstants::maxBlitHeight);
|
size_t dstSize = 2 * BlitterConstants::maxBlitSetWidth + sizeof(uint8_t);
|
||||||
MockGraphicsAllocation dstAlloc(0, 1u /*num gmms*/, AllocationType::internalHostMemory,
|
MockGraphicsAllocation dstAlloc(0, 1u /*num gmms*/, AllocationType::internalHostMemory,
|
||||||
reinterpret_cast<void *>(0x1234), 0x1000, 0, dstSize,
|
reinterpret_cast<void *>(0x1234), 0x1000, 0, dstSize,
|
||||||
MemoryPool::system4KBPages, MemoryManager::maxOsContextCount);
|
MemoryPool::system4KBPages, MemoryManager::maxOsContextCount);
|
||||||
@@ -806,16 +806,17 @@ HWTEST2_F(BlitTests, givenPlatformWithBlitSyncPropertiesAndSingleBytePatternWith
|
|||||||
pattern[0] = 0x1;
|
pattern[0] = 0x1;
|
||||||
auto blitProperties = BlitProperties::constructPropertiesForMemoryFill(&dstAlloc, dstSize, pattern, sizeof(uint8_t), 0);
|
auto blitProperties = BlitProperties::constructPropertiesForMemoryFill(&dstAlloc, dstSize, pattern, sizeof(uint8_t), 0);
|
||||||
|
|
||||||
uint32_t streamBuffer[800] = {};
|
uint32_t streamBuffer[1200] = {};
|
||||||
LinearStream stream(streamBuffer, sizeof(streamBuffer));
|
LinearStream stream(streamBuffer, sizeof(streamBuffer));
|
||||||
NEO::BlitCommandsHelper<FamilyType>::dispatchBlitMemoryColorFill(blitProperties, stream, pDevice->getRootDeviceEnvironmentRef());
|
NEO::BlitCommandsHelper<FamilyType>::dispatchBlitMemoryColorFill(blitProperties, stream, pDevice->getRootDeviceEnvironmentRef());
|
||||||
|
|
||||||
|
EXPECT_EQ(1u, blitProperties.fillPatternSize);
|
||||||
// change productHelper to return true
|
// change productHelper to return true
|
||||||
pDevice->getRootDeviceEnvironmentRef().productHelper.reset(new MockProductHelperHw<productFamily>);
|
pDevice->getRootDeviceEnvironmentRef().productHelper.reset(new MockProductHelperHw<productFamily>);
|
||||||
auto *mockProductHelper = static_cast<MockProductHelperHw<productFamily> *>(pDevice->getRootDeviceEnvironmentRef().productHelper.get());
|
auto *mockProductHelper = static_cast<MockProductHelperHw<productFamily> *>(pDevice->getRootDeviceEnvironmentRef().productHelper.get());
|
||||||
mockProductHelper->enableAdditionalBlitProperties = true;
|
mockProductHelper->enableAdditionalBlitProperties = true;
|
||||||
|
|
||||||
uint32_t streamBuffer2[800] = {};
|
uint32_t streamBuffer2[1200] = {};
|
||||||
LinearStream stream2(streamBuffer2, sizeof(streamBuffer2));
|
LinearStream stream2(streamBuffer2, sizeof(streamBuffer2));
|
||||||
NEO::BlitCommandsHelper<FamilyType>::dispatchBlitMemoryColorFill(blitProperties, stream2, pDevice->getRootDeviceEnvironmentRef());
|
NEO::BlitCommandsHelper<FamilyType>::dispatchBlitMemoryColorFill(blitProperties, stream2, pDevice->getRootDeviceEnvironmentRef());
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user