/* * Copyright (C) 2019-2025 Intel Corporation * * SPDX-License-Identifier: MIT * */ #include "shared/source/command_container/command_encoder.h" #include "shared/source/gmm_helper/gmm_helper.h" #include "shared/source/helpers/blit_properties.h" #include "shared/source/helpers/gfx_core_helper.h" #include "shared/source/helpers/register_offsets.h" #include "shared/source/helpers/timestamp_packet.h" #include "shared/source/utilities/lookup_array.h" #include namespace NEO { template uint64_t BlitCommandsHelper::getMaxBlitWidth(const RootDeviceEnvironment &rootDeviceEnvironment) { if (debugManager.flags.LimitBlitterMaxWidth.get() != -1) { return static_cast(debugManager.flags.LimitBlitterMaxWidth.get()); } auto maxBlitWidthOverride = getMaxBlitWidthOverride(rootDeviceEnvironment); if (maxBlitWidthOverride > 0) { return maxBlitWidthOverride; } return BlitterConstants::maxBlitWidth; } template uint64_t BlitCommandsHelper::getMaxBlitHeight(const RootDeviceEnvironment &rootDeviceEnvironment, bool isSystemMemoryPoolUsed) { if (debugManager.flags.LimitBlitterMaxHeight.get() != -1) { return static_cast(debugManager.flags.LimitBlitterMaxHeight.get()); } auto maxBlitHeightOverride = getMaxBlitHeightOverride(rootDeviceEnvironment, isSystemMemoryPoolUsed); if (maxBlitHeightOverride > 0) { return maxBlitHeightOverride; } return BlitterConstants::maxBlitHeight; } template void BlitCommandsHelper::dispatchPreBlitCommand(LinearStream &linearStream, RootDeviceEnvironment &rootDeviceEnvironment) { if (BlitCommandsHelper::preBlitCommandWARequired()) { NEO::EncodeDummyBlitWaArgs waArgs{false, &rootDeviceEnvironment}; MiFlushArgs args{waArgs}; EncodeMiFlushDW::programWithWa(linearStream, 0, 0, args); } } template size_t BlitCommandsHelper::estimatePreBlitCommandSize() { if (BlitCommandsHelper::preBlitCommandWARequired()) { return EncodeMiFlushDW::getCommandSizeWithWa({}); } return 0u; } template void BlitCommandsHelper::dispatchPostBlitCommand(LinearStream &linearStream, RootDeviceEnvironment &rootDeviceEnvironment) { EncodeDummyBlitWaArgs waArgs{false, &rootDeviceEnvironment}; MiFlushArgs args{waArgs}; if (debugManager.flags.PostBlitCommand.get() != BlitterConstants::PostBlitMode::defaultMode) { switch (debugManager.flags.PostBlitCommand.get()) { case BlitterConstants::PostBlitMode::miArbCheck: EncodeMiArbCheck::program(linearStream, std::nullopt); return; case BlitterConstants::PostBlitMode::miFlush: EncodeMiFlushDW::programWithWa(linearStream, 0, 0, args); return; default: return; } } if (BlitCommandsHelper::miArbCheckWaRequired()) { EncodeMiFlushDW::programWithWa(linearStream, 0, 0, args); } EncodeMiArbCheck::program(linearStream, std::nullopt); } template size_t BlitCommandsHelper::estimatePostBlitCommandSize() { EncodeDummyBlitWaArgs waArgs{}; if (debugManager.flags.PostBlitCommand.get() != BlitterConstants::PostBlitMode::defaultMode) { switch (debugManager.flags.PostBlitCommand.get()) { case BlitterConstants::PostBlitMode::miArbCheck: return EncodeMiArbCheck::getCommandSize(); case BlitterConstants::PostBlitMode::miFlush: return EncodeMiFlushDW::getCommandSizeWithWa(waArgs); default: return 0; } } size_t size = 0u; if (BlitCommandsHelper::miArbCheckWaRequired()) { size += EncodeMiFlushDW::getCommandSizeWithWa(waArgs); } size += EncodeMiArbCheck::getCommandSize(); return size; } template size_t BlitCommandsHelper::estimateBlitCommandSize(const Vec3 ©Size, const CsrDependencies &csrDependencies, bool updateTimestampPacket, bool profilingEnabled, bool isImage, const RootDeviceEnvironment &rootDeviceEnvironment, bool isSystemMemoryPoolUsed, bool relaxedOrderingEnabled) { size_t timestampCmdSize = 0; if (updateTimestampPacket) { EncodeDummyBlitWaArgs waArgs{true, const_cast(&rootDeviceEnvironment)}; timestampCmdSize += EncodeMiFlushDW::getCommandSizeWithWa(waArgs); if (profilingEnabled) { timestampCmdSize += getProfilingMmioCmdsSize(); } } size_t nBlits = 0u; size_t sizePerBlit = 0u; if (isImage) { nBlits = getNumberOfBlitsForCopyRegion(copySize, rootDeviceEnvironment, isSystemMemoryPoolUsed); sizePerBlit = sizeof(typename GfxFamily::XY_BLOCK_COPY_BLT); } else { nBlits = std::min(getNumberOfBlitsForCopyRegion(copySize, rootDeviceEnvironment, isSystemMemoryPoolUsed), getNumberOfBlitsForCopyPerRow(copySize, rootDeviceEnvironment, isSystemMemoryPoolUsed)); sizePerBlit = sizeof(typename GfxFamily::XY_COPY_BLT); } sizePerBlit += estimatePostBlitCommandSize(); return TimestampPacketHelper::getRequiredCmdStreamSize(csrDependencies, relaxedOrderingEnabled) + TimestampPacketHelper::getRequiredCmdStreamSizeForMultiRootDeviceSyncNodesContainer(csrDependencies) + (sizePerBlit * nBlits) + timestampCmdSize + estimatePreBlitCommandSize(); } template size_t BlitCommandsHelper::estimateBlitCommandsSize(const BlitPropertiesContainer &blitPropertiesContainer, bool profilingEnabled, bool debugPauseEnabled, bool blitterDirectSubmission, bool relaxedOrderingEnabled, const RootDeviceEnvironment &rootDeviceEnvironment) { size_t size = 0; EncodeDummyBlitWaArgs waArgs{false, const_cast(&rootDeviceEnvironment)}; for (auto &blitProperties : blitPropertiesContainer) { auto updateTimestampPacket = blitProperties.blitSyncProperties.outputTimestampPacket != nullptr; auto isImage = blitProperties.isImageOperation(); size += BlitCommandsHelper::estimateBlitCommandSize(blitProperties.copySize, blitProperties.csrDependencies, updateTimestampPacket, profilingEnabled, isImage, rootDeviceEnvironment, blitProperties.isSystemMemoryPoolUsed, relaxedOrderingEnabled); if (blitProperties.multiRootDeviceEventSync != nullptr) { size += EncodeMiFlushDW::getCommandSizeWithWa(waArgs); } } waArgs.isWaRequired = true; size += BlitCommandsHelper::getWaCmdsSize(blitPropertiesContainer); size += 2 * MemorySynchronizationCommands::getSizeForAdditonalSynchronization(rootDeviceEnvironment); size += EncodeMiFlushDW::getCommandSizeWithWa(waArgs); size += blitterDirectSubmission ? sizeof(typename GfxFamily::MI_BATCH_BUFFER_START) : sizeof(typename GfxFamily::MI_BATCH_BUFFER_END); if (debugPauseEnabled) { size += BlitCommandsHelper::getSizeForDebugPauseCommands(rootDeviceEnvironment); } size += BlitCommandsHelper::getSizeForGlobalSequencerFlush(); if (relaxedOrderingEnabled) { size += 2 * EncodeSetMMIO::sizeREG; } if (debugManager.flags.FlushTlbBeforeCopy.get() == 1) { size += EncodeMiFlushDW::getCommandSizeWithWa(waArgs); } return alignUp(size, MemoryConstants::cacheLineSize); } template uint64_t BlitCommandsHelper::calculateBlitCommandDestinationBaseAddress(const BlitProperties &blitProperties, uint64_t offset, uint64_t row, uint64_t slice) { return blitProperties.dstGpuAddress + blitProperties.dstOffset.x * blitProperties.bytesPerPixel + offset + blitProperties.dstOffset.y * blitProperties.dstRowPitch + blitProperties.dstOffset.z * blitProperties.dstSlicePitch + row * blitProperties.dstRowPitch + slice * blitProperties.dstSlicePitch; } template uint64_t BlitCommandsHelper::calculateBlitCommandSourceBaseAddress(const BlitProperties &blitProperties, uint64_t offset, uint64_t row, uint64_t slice) { return blitProperties.srcGpuAddress + blitProperties.srcOffset.x * blitProperties.bytesPerPixel + offset + blitProperties.srcOffset.y * blitProperties.srcRowPitch + blitProperties.srcOffset.z * blitProperties.srcSlicePitch + row * blitProperties.srcRowPitch + slice * blitProperties.srcSlicePitch; } template void BlitCommandsHelper::dispatchBlitCommandsForBufferPerRow(const BlitProperties &blitProperties, LinearStream &linearStream, RootDeviceEnvironment &rootDeviceEnvironment) { uint64_t width = 1; uint64_t height = 1; PRINT_DEBUG_STRING(debugManager.flags.PrintBlitDispatchDetails.get(), stdout, "\nBlit dispatch with AuxTranslationDirection %u ", static_cast(blitProperties.auxTranslationDirection)); dispatchPreBlitCommand(linearStream, rootDeviceEnvironment); auto bltCmd = GfxFamily::cmdInitXyCopyBlt; const auto maxWidth = getMaxBlitWidth(rootDeviceEnvironment); const auto maxHeight = getMaxBlitHeight(rootDeviceEnvironment, blitProperties.isSystemMemoryPoolUsed); appendColorDepth(blitProperties, bltCmd); for (uint64_t slice = 0; slice < blitProperties.copySize.z; slice++) { for (uint64_t row = 0; row < blitProperties.copySize.y; row++) { uint64_t offset = 0; uint64_t sizeToBlit = blitProperties.copySize.x; while (sizeToBlit != 0) { if (sizeToBlit > maxWidth) { // dispatch 2D blit: maxBlitWidth x (1 .. maxBlitHeight) width = maxWidth; height = std::min((sizeToBlit / width), maxHeight); } else { // dispatch 1D blt: (1 .. maxBlitWidth) x 1 width = sizeToBlit; height = 1; } bltCmd.setDestinationX2CoordinateRight(static_cast(width)); bltCmd.setDestinationY2CoordinateBottom(static_cast(height)); bltCmd.setDestinationPitch(static_cast(width)); bltCmd.setSourcePitch(static_cast(width)); auto dstAddr = calculateBlitCommandDestinationBaseAddress(blitProperties, offset, row, slice); auto srcAddr = calculateBlitCommandSourceBaseAddress(blitProperties, offset, row, slice); PRINT_DEBUG_STRING(debugManager.flags.PrintBlitDispatchDetails.get(), stdout, "\nBlit command. width: %u, height: %u, srcAddr: %#llx, dstAddr: %#llx ", width, height, srcAddr, dstAddr); bltCmd.setDestinationBaseAddress(dstAddr); bltCmd.setSourceBaseAddress(srcAddr); appendBlitCommandsForBuffer(blitProperties, bltCmd, rootDeviceEnvironment); auto bltStream = linearStream.getSpaceForCmd(); *bltStream = bltCmd; dispatchPostBlitCommand(linearStream, rootDeviceEnvironment); auto blitSize = width * height; sizeToBlit -= blitSize; offset += blitSize; } } } } template void BlitCommandsHelper::appendBlitMemSetCommand(const BlitProperties &blitProperties, void *blitCmd) {} template void BlitCommandsHelper::dispatchBlitMemoryFill(const BlitProperties &blitProperties, LinearStream &linearStream, RootDeviceEnvironment &rootDeviceEnvironment) { using XY_COLOR_BLT = typename GfxFamily::XY_COLOR_BLT; auto blitCmd = GfxFamily::cmdInitXyColorBlt; const auto maxWidth = getMaxBlitWidth(rootDeviceEnvironment); const auto maxHeight = getMaxBlitHeight(rootDeviceEnvironment, true); auto colorDepth = COLOR_DEPTH::COLOR_DEPTH_128_BIT_COLOR; size_t patternSize = 16; const LookupArray colorDepthLookup({{ {1, COLOR_DEPTH::COLOR_DEPTH_8_BIT_COLOR}, {2, COLOR_DEPTH::COLOR_DEPTH_16_BIT_COLOR}, {4, COLOR_DEPTH::COLOR_DEPTH_32_BIT_COLOR}, {8, COLOR_DEPTH::COLOR_DEPTH_64_BIT_COLOR}, }}); auto colorDepthV = colorDepthLookup.find(blitProperties.fillPatternSize); if (colorDepthV.has_value()) { colorDepth = *colorDepthV; patternSize = blitProperties.fillPatternSize; } blitCmd.setFillColor(blitProperties.fillPattern); blitCmd.setColorDepth(colorDepth); uint64_t sizeToFill = blitProperties.copySize.x / patternSize; uint64_t offset = blitProperties.dstOffset.x; while (sizeToFill != 0) { auto tmpCmd = blitCmd; tmpCmd.setDestinationBaseAddress(ptrOffset(blitProperties.dstAllocation->getGpuAddress(), static_cast(offset))); uint64_t height = 0; uint64_t width = 0; if (sizeToFill <= maxWidth) { width = sizeToFill; height = 1; } else { width = maxWidth; height = std::min((sizeToFill / width), maxHeight); if (height > 1) { appendTilingEnable(tmpCmd); } } tmpCmd.setDestinationX2CoordinateRight(static_cast(width)); tmpCmd.setDestinationY2CoordinateBottom(static_cast(height)); tmpCmd.setDestinationPitch(static_cast(width * patternSize)); appendBlitMemoryOptionsForFillBuffer(blitProperties.dstAllocation, tmpCmd, rootDeviceEnvironment); appendBlitFillCommand(blitProperties, tmpCmd); auto cmd = linearStream.getSpaceForCmd(); *cmd = tmpCmd; auto blitSize = width * height; offset += (blitSize * patternSize); sizeToFill -= blitSize; } } template void BlitCommandsHelper::dispatchBlitCommandsForImageRegion(const BlitProperties &blitProperties, LinearStream &linearStream, RootDeviceEnvironment &rootDeviceEnvironment) { auto srcSlicePitch = static_cast(blitProperties.srcSlicePitch); auto dstSlicePitch = static_cast(blitProperties.dstSlicePitch); UNRECOVERABLE_IF(blitProperties.copySize.x > BlitterConstants::maxBlitWidth || blitProperties.copySize.y > BlitterConstants::maxBlitHeight); auto bltCmd = GfxFamily::cmdInitXyBlockCopyBlt; bltCmd.setSourceBaseAddress(blitProperties.srcGpuAddress); bltCmd.setDestinationBaseAddress(blitProperties.dstGpuAddress); bltCmd.setDestinationX1CoordinateLeft(static_cast(blitProperties.dstOffset.x)); bltCmd.setDestinationY1CoordinateTop(static_cast(blitProperties.dstOffset.y)); bltCmd.setDestinationX2CoordinateRight(static_cast(blitProperties.dstOffset.x + blitProperties.copySize.x)); bltCmd.setDestinationY2CoordinateBottom(static_cast(blitProperties.dstOffset.y + blitProperties.copySize.y)); bltCmd.setSourceX1CoordinateLeft(static_cast(blitProperties.srcOffset.x)); bltCmd.setSourceY1CoordinateTop(static_cast(blitProperties.srcOffset.y)); appendBlitCommandsBlockCopy(blitProperties, bltCmd, rootDeviceEnvironment); appendBlitCommandsForImages(blitProperties, bltCmd, rootDeviceEnvironment, srcSlicePitch, dstSlicePitch); appendColorDepth(blitProperties, bltCmd); appendSurfaceType(blitProperties, bltCmd); dispatchPreBlitCommand(linearStream, rootDeviceEnvironment); for (uint32_t i = 0; i < blitProperties.copySize.z; i++) { appendSliceOffsets(blitProperties, bltCmd, i, rootDeviceEnvironment, srcSlicePitch, dstSlicePitch); if (debugManager.flags.PrintImageBlitBlockCopyCmdDetails.get()) { printImageBlitBlockCopyCommand(bltCmd, i); } auto cmd = linearStream.getSpaceForCmd(); *cmd = bltCmd; dispatchPostBlitCommand(linearStream, rootDeviceEnvironment); } } template void BlitCommandsHelper::dispatchDebugPauseCommands(LinearStream &commandStream, uint64_t debugPauseStateGPUAddress, DebugPauseState confirmationTrigger, DebugPauseState waitCondition, RootDeviceEnvironment &rootDeviceEnvironment) { using COMPARE_OPERATION = typename GfxFamily::MI_SEMAPHORE_WAIT::COMPARE_OPERATION; NEO::EncodeDummyBlitWaArgs waArgs{false, &rootDeviceEnvironment}; MiFlushArgs args{waArgs}; args.commandWithPostSync = true; EncodeMiFlushDW::programWithWa(commandStream, debugPauseStateGPUAddress, static_cast(confirmationTrigger), args); EncodeSemaphore::addMiSemaphoreWaitCommand(commandStream, debugPauseStateGPUAddress, static_cast(waitCondition), COMPARE_OPERATION::COMPARE_OPERATION_SAD_EQUAL_SDD, false, false, false, false, nullptr); } template size_t BlitCommandsHelper::getSizeForDebugPauseCommands(const RootDeviceEnvironment &rootDeviceEnvironment) { EncodeDummyBlitWaArgs waArgs{false, const_cast(&rootDeviceEnvironment)}; return (EncodeMiFlushDW::getCommandSizeWithWa(waArgs) + EncodeSemaphore::getSizeMiSemaphoreWait()) * 2; } template uint32_t BlitCommandsHelper::getAvailableBytesPerPixel(size_t copySize, uint32_t srcOrigin, uint32_t dstOrigin, size_t srcSize, size_t dstSize) { uint32_t bytesPerPixel = BlitterConstants::maxBytesPerPixel; while (bytesPerPixel > 1) { if (copySize % bytesPerPixel == 0 && srcSize % bytesPerPixel == 0 && dstSize % bytesPerPixel == 0) { if ((srcOrigin ? (srcOrigin % bytesPerPixel == 0) : true) && (dstOrigin ? (dstOrigin % bytesPerPixel == 0) : true)) { break; } } bytesPerPixel >>= 1; } return bytesPerPixel; } template void BlitCommandsHelper::dispatchBlitCommands(const BlitProperties &blitProperties, LinearStream &linearStream, RootDeviceEnvironment &rootDeviceEnvironment) { if (blitProperties.isImageOperation()) { dispatchBlitCommandsForImageRegion(blitProperties, linearStream, rootDeviceEnvironment); } else { bool preferCopyBufferRegion = isCopyRegionPreferred(blitProperties.copySize, rootDeviceEnvironment, blitProperties.isSystemMemoryPoolUsed); preferCopyBufferRegion ? dispatchBlitCommandsForBufferRegion(blitProperties, linearStream, rootDeviceEnvironment) : dispatchBlitCommandsForBufferPerRow(blitProperties, linearStream, rootDeviceEnvironment); } } template uint64_t BlitCommandsHelper::calculateBlitCommandSourceBaseAddressCopyRegion(const BlitProperties &blitProperties, size_t slice) { return blitProperties.srcGpuAddress + blitProperties.srcOffset.x * blitProperties.bytesPerPixel + (blitProperties.srcOffset.y * blitProperties.srcRowPitch) + (blitProperties.srcSlicePitch * (slice + blitProperties.srcOffset.z)); } template uint64_t BlitCommandsHelper::calculateBlitCommandDestinationBaseAddressCopyRegion(const BlitProperties &blitProperties, size_t slice) { return blitProperties.dstGpuAddress + blitProperties.dstOffset.x * blitProperties.bytesPerPixel + (blitProperties.dstOffset.y * blitProperties.dstRowPitch) + (blitProperties.dstSlicePitch * (slice + blitProperties.dstOffset.z)); } template template void BlitCommandsHelper::appendBlitCommandsForBuffer(const BlitProperties &blitProperties, T &blitCmd, const RootDeviceEnvironment &rootDeviceEnvironment) { appendBlitCommandsBlockCopy(blitProperties, blitCmd, rootDeviceEnvironment); } template void BlitCommandsHelper::appendBlitCommandsMemCopy(const BlitProperties &blitProperties, typename GfxFamily::XY_COPY_BLT &blitCmd, const RootDeviceEnvironment &rootDeviceEnvironment) { } template void BlitCommandsHelper::dispatchBlitCommandsForBufferRegion(const BlitProperties &blitProperties, LinearStream &linearStream, RootDeviceEnvironment &rootDeviceEnvironment) { const auto maxWidthToCopy = getMaxBlitWidth(rootDeviceEnvironment); const auto maxHeightToCopy = getMaxBlitHeight(rootDeviceEnvironment, blitProperties.isSystemMemoryPoolUsed); dispatchPreBlitCommand(linearStream, rootDeviceEnvironment); auto bltCmd = GfxFamily::cmdInitXyCopyBlt; bltCmd.setSourcePitch(static_cast(blitProperties.srcRowPitch)); bltCmd.setDestinationPitch(static_cast(blitProperties.dstRowPitch)); appendColorDepth(blitProperties, bltCmd); for (size_t slice = 0u; slice < blitProperties.copySize.z; ++slice) { auto srcAddress = calculateBlitCommandSourceBaseAddressCopyRegion(blitProperties, slice); auto dstAddress = calculateBlitCommandDestinationBaseAddressCopyRegion(blitProperties, slice); auto heightToCopy = blitProperties.copySize.y; while (heightToCopy > 0) { auto height = static_cast(std::min(heightToCopy, static_cast(maxHeightToCopy))); auto widthToCopy = blitProperties.copySize.x; while (widthToCopy > 0) { auto width = static_cast(std::min(widthToCopy, static_cast(maxWidthToCopy))); bltCmd.setSourceBaseAddress(srcAddress); bltCmd.setDestinationBaseAddress(dstAddress); bltCmd.setDestinationX2CoordinateRight(width); bltCmd.setDestinationY2CoordinateBottom(height); appendBlitCommandsForBuffer(blitProperties, bltCmd, rootDeviceEnvironment); auto cmd = linearStream.getSpaceForCmd(); *cmd = bltCmd; dispatchPostBlitCommand(linearStream, rootDeviceEnvironment); srcAddress += width; dstAddress += width; widthToCopy -= width; } heightToCopy -= height; srcAddress += (blitProperties.srcRowPitch - blitProperties.copySize.x); srcAddress += (blitProperties.srcRowPitch * (height - 1)); dstAddress += (blitProperties.dstRowPitch - blitProperties.copySize.x); dstAddress += (blitProperties.dstRowPitch * (height - 1)); } } } template bool BlitCommandsHelper::isCopyRegionPreferred(const Vec3 ©Size, const RootDeviceEnvironment &rootDeviceEnvironment, bool isSystemMemoryPoolUsed) { bool preferCopyRegion = getNumberOfBlitsForCopyRegion(copySize, rootDeviceEnvironment, isSystemMemoryPoolUsed) < getNumberOfBlitsForCopyPerRow(copySize, rootDeviceEnvironment, isSystemMemoryPoolUsed); return preferCopyRegion; } template size_t BlitCommandsHelper::getNumberOfBlitsForCopyRegion(const Vec3 ©Size, const RootDeviceEnvironment &rootDeviceEnvironment, bool isSystemMemoryPoolUsed) { auto maxWidthToCopy = getMaxBlitWidth(rootDeviceEnvironment); auto maxHeightToCopy = getMaxBlitHeight(rootDeviceEnvironment, isSystemMemoryPoolUsed); auto xBlits = static_cast(std::ceil(copySize.x / static_cast(maxWidthToCopy))); auto yBlits = static_cast(std::ceil(copySize.y / static_cast(maxHeightToCopy))); auto zBlits = static_cast(copySize.z); auto nBlits = xBlits * yBlits * zBlits; return nBlits; } template size_t BlitCommandsHelper::getNumberOfBlitsForCopyPerRow(const Vec3 ©Size, const RootDeviceEnvironment &rootDeviceEnvironment, bool isSystemMemoryPoolUsed) { size_t xBlits = 0u; uint64_t width = 1; uint64_t height = 1; uint64_t sizeToBlit = copySize.x; const auto maxWidth = getMaxBlitWidth(rootDeviceEnvironment); const auto maxHeight = getMaxBlitHeight(rootDeviceEnvironment, isSystemMemoryPoolUsed); while (sizeToBlit != 0) { if (sizeToBlit > getMaxBlitWidth(rootDeviceEnvironment)) { // dispatch 2D blit: maxBlitWidth x (1 .. maxBlitHeight) width = maxWidth; height = std::min((sizeToBlit / width), maxHeight); } else { // dispatch 1D blt: (1 .. maxBlitWidth) x 1 width = sizeToBlit; height = 1; } sizeToBlit -= (width * height); xBlits++; } auto yBlits = copySize.y; auto zBlits = copySize.z; auto nBlits = xBlits * yBlits * zBlits; return nBlits; } template bool BlitCommandsHelper::preBlitCommandWARequired() { return false; } template void BlitCommandsHelper::appendExtraMemoryProperties(typename GfxFamily::XY_BLOCK_COPY_BLT &blitCmd, const RootDeviceEnvironment &rootDeviceEnvironment) {} template void BlitCommandsHelper::appendExtraMemoryProperties(typename GfxFamily::XY_COLOR_BLT &blitCmd, const RootDeviceEnvironment &rootDeviceEnvironment) {} template void BlitCommandsHelper::encodeProfilingStartMmios(LinearStream &cmdStream, const TagNodeBase ×tampPacketNode) { auto timestampContextStartGpuAddress = TimestampPacketHelper::getContextStartGpuAddress(timestampPacketNode); auto timestampGlobalStartAddress = TimestampPacketHelper::getGlobalStartGpuAddress(timestampPacketNode); EncodeStoreMMIO::encode(cmdStream, RegisterOffsets::gpThreadTimeRegAddressOffsetLow, timestampContextStartGpuAddress, false, nullptr, true); EncodeStoreMMIO::encode(cmdStream, RegisterOffsets::globalTimestampLdw, timestampGlobalStartAddress, false, nullptr, true); } template void BlitCommandsHelper::encodeProfilingEndMmios(LinearStream &cmdStream, const TagNodeBase ×tampPacketNode) { auto timestampContextEndGpuAddress = TimestampPacketHelper::getContextEndGpuAddress(timestampPacketNode); auto timestampGlobalEndAddress = TimestampPacketHelper::getGlobalEndGpuAddress(timestampPacketNode); EncodeStoreMMIO::encode(cmdStream, RegisterOffsets::gpThreadTimeRegAddressOffsetLow, timestampContextEndGpuAddress, false, nullptr, true); EncodeStoreMMIO::encode(cmdStream, RegisterOffsets::globalTimestampLdw, timestampGlobalEndAddress, false, nullptr, true); } template size_t BlitCommandsHelper::getProfilingMmioCmdsSize() { return 4 * sizeof(typename GfxFamily::MI_STORE_REGISTER_MEM); } template void BlitCommandsHelper::appendBaseAddressOffset(const BlitProperties &blitProperties, typename GfxFamily::XY_BLOCK_COPY_BLT &blitCmd, const bool isSource) {} template void BlitCommandsHelper::encodeWa(LinearStream &cmdStream, const BlitProperties &blitProperties, uint32_t &latestSentBcsWaValue) { } template size_t BlitCommandsHelper::getWaCmdsSize(const BlitPropertiesContainer &blitPropertiesContainer) { return 0; } template void BlitCommandsHelper::adjustControlSurfaceType(const BlitProperties &blitProperties, typename GfxFamily::XY_BLOCK_COPY_BLT &blitCmd) {} template void BlitCommandsHelper::appendBlitFillCommand(const BlitProperties &blitProperties, typename GfxFamily::XY_COLOR_BLT &blitCmd) {} template void BlitCommandsHelper::dispatchBlitMemoryColorFill(const BlitProperties &blitProperties, LinearStream &linearStream, RootDeviceEnvironment &rootDeviceEnvironment) { if (blitProperties.fillPatternSize == 1) { NEO::BlitCommandsHelper::dispatchBlitMemoryByteFill(blitProperties, linearStream, rootDeviceEnvironment); } else { NEO::BlitCommandsHelper::dispatchBlitMemoryFill(blitProperties, linearStream, rootDeviceEnvironment); } } } // namespace NEO